Fundamentals of Data Structure - MCQ - V
Fundamentals of Data Structure - MCQ - V
Answer: a
a) B and E
b) C and D
c) A and E
Answer: d
a) G is a complete graph
Answer: c
a) (n*(n+1))/2
b) (n*(n-1))/2
c) n
a) True
b) False
Answer: a
a) 15
b) 3
c) 1
d) 11
Answer: b
7. If a simple graph G, contains n vertices and m edges, the number of edges in the Graph
G'(Complement of G) is
a) (n*n-n-2*m)/2
b) (n*n+n+2*m)/2
c) (n*n-n-2*m)/2
d) (n*n-n+2*m)/2
Answer: a
a) Must be connected
b) Must be unweighted
Answer: a
a) 24
b) 21
c) 25
d) 16
Answer: c
10. Which of the following is true?
Answer: b
11. For a given graph G having v vertices and e edges which is connected and has no cycles, which of
the following statements is true?
a) v=e
b) v = e+1
c) v + 1 = e
d) v = e-1
Answer: b
12. For which of the following combinations of the degrees of vertices would the connected graph be
eulerian?
a) 1,2,3
b) 2,3,4
c) 2,4,5
d) 1,3,5
Answer: a
a) Multi Graph
b) Regular Graph
c) Simple Graph
d) Complete Graph
Answer: b
d) No way to represent
Answer: c
15. The number of possible undirected graphs which may have self loops but no multiple edges and
have n vertices is
a) 2((n*(n-1))/2)
b) 2((n*(n+1))/2)
c) 2((n-1)*(n-1))/2)
d) 2((n*n)/2)
Answer: d
16. Given a plane graph, G having 2 connected component, having 6 vertices, 7 edges and 4 regions.
What will be the number of connected components?
a) 1
b) 2
c) 3
d) 4
Answer: b
17. Number of vertices with odd degrees in a graph having a eulerian walk is
a) 0
b) Can’t be predicted
c) 2
d) either 0 or 2
Answer: d
Answer: b
19. What is the number of vertices of degree 2 in a path graph having n vertices,here n>2.
a) n-2
b) n
c) 2
d) 0
Answer: a
Answer: d
21. In the given graph which edge should be removed to make it a Bipartite Graph?
a) A-C
b) B-E
c) C-D
Answer: a
22. What would the time complexity to check if an undirected graph with V vertices and E edges is
Bipartite or not given its adjacency matrix?
a) O(E*E)
b) O(V*V)O(E)
c) O(V)
Answer: b
23. Which of the following is not a topological sorting of the given graph?
a) A B C D E F
b) A B F E D C
c) A B E C F D
Answer: d
24. With V(greater than 1) vertices, how many edges at most can a Directed Acyclic Graph possess?
a) (V*(V-1))/2
b) (V*(V+1))/2
c) (V+1)C2
d) (V-1)C2
Answer: a
a) cubic
b) quadratic
c) linear
d) logarithmic
Answer: c
26. If there are more than 1 topological sorting of a DAG is possible, which of the following is true.
Answer: b
27. What sequence would the BFS traversal of the given graph yield?
a) A F D B C E
b) C B A F E D
c) A B D C E F
Answer: c
28. a) 0 2 3 1 4
b) 0 3 2 4 1
c) 0 2 3 4 1
d) 0 3 2 1 4
Answer: b
Answer: d
30. What is the value of the sum of the minimum in-degree and maximum out-degree of an Directed
Acyclic Graph?
a) Depends on a Graph
Answer: b
d) When the list has only a few elements and When performing a single search in an unordered list
Answer: d
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(1)
Answer: d
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(1)
Answer: c
4. What is the best case and worst case complexity of ordered linear search?
a) O(nlogn), O(logn)
b) O(logn), O(nlogn)
c) O(n), O(1)
d) O(1), O(n)
Answer: d
Answer: a
Answer: b
Answer: b
8. Given an input arr = {2,5,7,99,899}; key = 899; What is the level of recursion?
a) 5
b) 2
c) 3
d) 4
Answer: c
9. Given an array arr = {45,77,89,90,94,99,100} and key = 99; what are the mid values(corresponding
array elements) in the first and second levels of recursion?
a) 90 and 99
b) 90 and 94
c) 89 and 99
d) 89 and 94
Answer: a
10. What is the worst case complexity of binary search using recursion?
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: b
11. What is the average case time complexity of binary search using recursion?
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: b
c) Debugging
Answer: d
c) Greedy algorithm
d) Dynamic programming
Answer: b
14. Given an array arr = {5,6,77,88,99} and key = 88; How many iterations are done until the element
is found?
a) 1
b) 3
c) 4
d) 2
Answer: d
15. Given an array arr = {45,77,89,90,94,99,100} and key = 100; What are the mid
values(corresponding array elements) generated in the first and second iterations?
a) 90 and 99
b) 90 and 100
c) 89 and 94
d) 94 and 99
Answer: a
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: b
17. What is an external sorting algorithm?
Answer: a
Answer: b
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: d
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: d
21. Which of the following is not an advantage of optimised bubble sort over other sorting techniques
in case of sorted elements?
a) It is faster
Answer: c
22. The given array is arr = {1, 2, 4, 3}. Bubble sort is used to sort the array elements. How many
iterations will be done to sort the array?
a) 4
b) 2
c) 1
d) 0
Answer: a
23. What is the best case efficiency of bubble sort in the improvised version?
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: c
24. The given array is arr = {1,2,4,3}. Bubble sort is used to sort the array elements. How many
iterations will be done to sort the array with improvised version?
a) 4
b) 2
c) 1
d) 0
Answer: b
Answer: a
26. In the following scenarios, when will you use selection sort?
a) The input is already sorted
Answer: c
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: d
28. What is the advantage of selection sort over other sorting techniques?
b) It is scalable
Answer: a
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: d
b) It is not scalable
Answer: b
31. The given array is arr = {3,4,5,2,1}. The number of iterations in bubble sort and selection sort
respectively are,
a) 5 and 4
b) 4 and 5
c) 2 and 4
d) 2 and 5
Answer: a
32. The given array is arr = {1,2,3,4,5}. (bubble sort is implemented with a flag variable)The number
of iterations in selection sort and bubble sort respectively are,
a) 5 and 4
b) 1 and 4
c) 0 and 4
d) 4 and 1
Answer: d
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: d
Answer: b
Answer: b
36. Shell sort is applied on the elements 27 59 49 37 15 90 81 39 and the chosen decreasing sequence of
increments is (5,3,1). The result after the first iteration will be
a) 27 59 49 37 15 90 81 39
b) 27 59 37 49 15 90 81 39
c) 27 59 39 37 15 90 81 49
d) 15 59 49 37 27 90 81 39
Answer: c
Answer: d
a) insertion sort
b) selection sort
d) quick sort
Answer: a
b) 5-ordered
Answer: d
40. If Hibbard increments (h1= 1, h2= 3, h3= 7, …, hk = 2k–1) are used in a Shell sort implementation,
then the best case time complexity will be
a) O(nlogn)
b) O(n)
c) O(n2)
d) O(logn)
Answer: a
41. Records R1, R2, R3,.. RN with keys K1, K2, K3,.. KN are said to be h-ordered, if
Answer: d
a) Shell sort’s passes completely sort the elements before going on to the next-smallest gap while Comb
sort’s passes do not completely sort the elements
b) Shell sort’s passes do not completely sort the elements before going on to the next-smallest gap like in
Comb sort
c) Comb sort’s passes completely sort the elements before going on to the next-smallest gap like in Shell sort
d) Shell sort’s passes do not completely sort the elements before going on to the next-smallest gap while
Comb sort’s passes completely sort the elements
Answer: a
a) Heap sort
b) Smooth sort
c) Quick sort
Answer: d
44. What is the worst case time complexity of LSD radix sort?
a) O(nlogn)
b) O(wn)
c) O(n)
d) O(n + w)
Answer: b
a) (w/logR)
b) N(w/logR)
c) (w/log(RN))
d) (wN/log(N))
Answer: a
Answer: b
a) Heap sort
b) Selection sort
48. Which of the following should be used to sort a huge database on a fixed-length key field?
a) Insertion sort
b) Merge sort
d) Quick sort
Answer: c
49. Which of the following is a combination of LSD and MSD radix sorts?
d) Flash sort
Answer: a
50. Which of the following is true for the LSD radix sort?
Answer: b
a) hashing by division
b) hashing by multiplication
c) universal hashing
d) open addressing
Answer: c
52. Which hash function satisfies the condition of simple uniform hashing?
a) h(k) = lowerbound(km)
b) h(k)= upperbound(mk)
c) h(k)= lowerbound(k)
d) h(k)= upperbound(k)
Answer: a
53. a) 14963
b) 14392
c) 12784
d) 14452
Answer: d
a) h(k) = k/m
b) h(k) = k mod m
c) h(k) = m/k
d) h(k) = m mod k
Answer: b
c) 2p – 1
d) 2p
Answer: a
a) open addressing
b) universal hashing
c) hashing by division
d) hashing by multiplication
Answer: b
57. Using division method, in a given hash table of size 157, the key of value 172 be placed at position
a) 19
b) 72
c) 15
d) 17
Answer: c
58. How many steps are involved in creating a hash function using a multiplication method?
a) 1
b) 4
c) 3
d) 2
Answer: d
Answer: a
b) using constant
d) simple multiplication
Answer: c
61. What is the table size when the value of p is 7 in multiplication method of creating hash functions?
a) 14
b) 128
c) 49
d) 127
Answer: b
a) 123
b) 456
c) 70
Answer: d
63. What is the average retrieval time when n keys hash to the same slot?
a) Theta(n)
b) Theta(n2)
c) Theta(nlog n)
d) Big-Oh(n2)
Answer: a