CSD203 - FE FALL 2022

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/39

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

40 Terms

1
New cards

Which search algorithm would be best to use with ordered data?

A binary search

3 multiple choice options

2
New cards

The number of elements in the adjacency matrix of a graph having 7 vertices is ?

49

3 multiple choice options

3
New cards

What is the output of the following list operation?

aList[10, 20, 30, 40, 50, 60, 70, 80] print(aList[2.5])

[30, 40, 50]

3 multiple choice options

4
New cards

Which of the following is longest proper prefix which is also suffix of "ABCA"?

'A'

3 multiple choice options

5
New cards

What will be the output of the following code?

def f(n):

if (n<10)

return n-5

return f(n+1).

print(f(4))

-1

3 multiple choice options

6
New cards

The total number of edges that connect to node u is called

Degree

3 multiple choice options

7
New cards

What does the following code do?

def Operation(self, newdata)

NewNode Node(newdata)

if self.head is None:

self.head = NewNode

return

laste = self.head

while(laste.next):

laste laste.next

laste.next=NewNode

Insert a new node at the tail of the list

3 multiple choice options

8
New cards

In Linked List implementation, a node carries information regarding

Data and Link

3 multiple choice options

9
New cards

According to Stack data structure, what is output for input "finaltest"?

tsetlanif

3 multiple choice options

10
New cards

Given a string S="ABCDEFABCD' and a pattern P = "BC".

What is the return value when applying KMP algorithm? (the string is indexed from 0)

1, 7

3 multiple choice options

11
New cards

Given data compression rate is 0.25 and the length of input data is 8.

What is the length of output data?

2

3 multiple choice options

12
New cards

Which is the most appropriate definition for recursion?

A function that calls another execution instance of the same function.

3 multiple choice options

13
New cards

Given an empty queue Q, what does it look like after the following operations? Q.enqueue(1)

Q enqueue(2)

Q.dequeue()

Q.enqueue(3)

Q.dequeue()

3

3 multiple choice options

14
New cards

What is the hash function used in the division method?

h(k) k mod m

3 multiple choice options

15
New cards

For the given hash table with size 100 and folding method is used, in what location will the k hashed using probing?

5

3 multiple choice options

16
New cards

The number of swappings needed to sort the numbers 8, 22, 7, 9, 31 in ascending order

3

3 multiple choice options

17
New cards

The complexity of binary search algorithm is...

O(logn).

3 multiple choice options

18
New cards

A graph in which exists a path between any two nodes is called

Connected graph

3 multiple choice options

19
New cards

Suppose a singly linked list of integers is given below:

head-1-2-3-4-5->None

What will be the output of the following code?

def listprint(self):

printval = self.head

while printval next is not None:

print (printval data) printval = __________printval.next

1 2 3 4

3 multiple choice options

20
New cards

Following function is used to calculate factorial number of n.

What is the missing line?

def fact(num):

if num == 0:

return 1

else :

return........

num * fact(num-1)

3 multiple choice options

21
New cards

Which sorting algorithm is the best if the list is already in order?

Insertion Sort

3 multiple choice options

22
New cards

Which of the following cases occurs when searching an array using linear search the value b equal to the first element of the array?

The best case

3 multiple choice options

23
New cards

What does the following function do

def Func(self, root):

if root:

self. Func (root.left) __________print(root.data)

self. Func (root.right)

Traverse the tree in In-order

3 multiple choice options

24
New cards

A linear list of elements in which deletion can be done from one end (front) and insertion can the other end (rear) is known as a?

Queue

3 multiple choice options

25
New cards

What will be the output of the following code?

a=[1, 2, 3, 4, 5]

b=a[2:4]

print(b)

[3, 4]

3 multiple choice options

26
New cards

In a hash table, an element with key k is stored at index

H(k)

27
New cards

Given an empty Stack S and a sequence of the following operations:

Push(F;

Push(P);

Pop(S);

Push(T);

Pop(S);

Push(U)

What does the stack S look like?

FU

3 multiple choice options

28
New cards

Recursion calls are stored on the memory in which data structure?

Stack

3 multiple choice options

29
New cards

A sorting algorithm that uses the divide and conquer technique is?

Quick sort

3 multiple choice options

30
New cards

In a stack we can add and remove an element

only at/from one position

3 multiple choice options

31
New cards

Which of the following algorithm does not divide the list?

Linear search

3 multiple choice options

32
New cards

A chained hash table has an array size of 255.

What is the maximum number of elements the table?

There is no limit

3 multiple choice options

33
New cards

Given a hash table T with 20 slots that stores 1000 elements, the load factor for T is

50

34
New cards

Linear search is highly inefficient compared to binary search when dealing with:

large and sorted arrays

3 multiple choice options

35
New cards

What will be the output of the following code?

b=[1] * 5

print(b)

[1, 1, 1, 1, 1]

3 multiple choice options

36
New cards

Two algorithms, used for finding a minimum spanning tree, are Kruskal and Dijkstra. Which cycle detection method?

The Kruskal algorithm.

3 multiple choice options

37
New cards

A What is the output of the following program?

a=[1,2,3,4,5]

a[0]=6;

print(len(a))

5

3 multiple choice options

38
New cards

What will be the output of the following code?

def rec(n):

if n > 5:

return n

else

return n + rec(n+2)

print(rec(1))

16

3 multiple choice options

39
New cards

What is the output of the following code? my_list = ["Hello", "Python"]

print("-".join(my_list))

Hello-Python

3 multiple choice options

40
New cards

What is a hash table?

A structure that maps values to keys

3 multiple choice options