1/39
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Which search algorithm would be best to use with ordered data?
A binary search
3 multiple choice options
The number of elements in the adjacency matrix of a graph having 7 vertices is ?
49
3 multiple choice options
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
Which of the following is longest proper prefix which is also suffix of "ABCA"?
'A'
3 multiple choice options
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
The total number of edges that connect to node u is called
Degree
3 multiple choice options
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
In Linked List implementation, a node carries information regarding
Data and Link
3 multiple choice options
According to Stack data structure, what is output for input "finaltest"?
tsetlanif
3 multiple choice options
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
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
Which is the most appropriate definition for recursion?
A function that calls another execution instance of the same function.
3 multiple choice options
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
What is the hash function used in the division method?
h(k) k mod m
3 multiple choice options
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
The number of swappings needed to sort the numbers 8, 22, 7, 9, 31 in ascending order
3
3 multiple choice options
The complexity of binary search algorithm is...
O(logn).
3 multiple choice options
A graph in which exists a path between any two nodes is called
Connected graph
3 multiple choice options
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
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
Which sorting algorithm is the best if the list is already in order?
Insertion Sort
3 multiple choice options
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
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
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
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
In a hash table, an element with key k is stored at index
H(k)
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
Recursion calls are stored on the memory in which data structure?
Stack
3 multiple choice options
A sorting algorithm that uses the divide and conquer technique is?
Quick sort
3 multiple choice options
In a stack we can add and remove an element
only at/from one position
3 multiple choice options
Which of the following algorithm does not divide the list?
Linear search
3 multiple choice options
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
Given a hash table T with 20 slots that stores 1000 elements, the load factor for T is
50
Linear search is highly inefficient compared to binary search when dealing with:
large and sorted arrays
3 multiple choice options
What will be the output of the following code?
b=[1] * 5
print(b)
[1, 1, 1, 1, 1]
3 multiple choice options
Two algorithms, used for finding a minimum spanning tree, are Kruskal and Dijkstra. Which cycle detection method?
The Kruskal algorithm.
3 multiple choice options
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
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
What is the output of the following code? my_list = ["Hello", "Python"]
print("-".join(my_list))
Hello-Python
3 multiple choice options
What is a hash table?
A structure that maps values to keys
3 multiple choice options