Unit 5 MCQ
Unit 5 MCQ
Unit 5 MCQ
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)
1 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
2 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
b) Union of intervals
c) Debugging
Answer: d
3 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
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
5 www.studymaterialz.in
CS8391 DATA STRUCTURES
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?
6 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
7 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
8 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
9 www.studymaterialz.in
CS8391 DATA STRUCTURES
a) 7-ordered
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
10 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
11 www.studymaterialz.in
CS8391 DATA STRUCTURES
Answer: d
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?
12 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
13 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
14 www.studymaterialz.in
CS8391 DATA STRUCTURES
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
15 www.studymaterialz.in