Top 350+ Solved Data Structures (DS) MCQ Questions Answer
Q. In the following scenarios, when will you use selection sort?
a. The input is already sorted
b. A large file has to be sorted
c. Large values need to be sorted with small keys
d. Small values need to be sorted with large keys
Q. What is the advantage of selection sort over other sorting techniques?
a. It requires no additional storage space
b. It is scalable
c. It works best for inputs which are already sorted
d. It is faster than any other sorting technique
Q. What is the disadvantage of selection sort?
a. It requires auxiliary memory
b. It is not scalable
c. It can be used for small keys8
d. It takes linear time to sort the elements
Q. The given array is arr = {3,4,5,2,1}. The number of iterations in bubble sort and selection sortrespectively are,
a. 5 and 4
b. 4 and 5
c. 2 and 4
d. 2 and 5
Q. The given array is arr = {1,2,3,4,5}. (bubble sort is implemented with a flag variable)The numberof 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
Q. Shell sort is also known as
a. diminishing decrement sort
b. diminishing increment sort
c. partition exchange sort
d. diminishing insertion sort
Q. Statement 1: Shell sort is a stable sorting algorithm.Statement 2: Shell sort is an in-place sorting algorithm.
a. Both statements are true
b. Statement 2 is true but statement 1 is false
c. Statement 2 is false but statement 1 is true
d. none
Q. 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
Q. Shell sort is an improvement on
a. insertion sort
b. selection sort
c. binary tree sort
d. quick sort
Q. An array that is first 7-sorted, then 5-sorted becomes
a. 7-ordered
b. 5-ordered
c. both 2-ordered and 5-ordered
d. both 7-ordered and 5-ordered
Q. If Hibbard increments (h1= 1, h2= 3, h3= 7, …, hk = 2k–1) are used in a Shell sortimplementation, then the best case time complexity will be
a. O(nlogn)
b. O(n)
c. O(n2)
d. O(logn)
Q. Records R1, R2, R3,.. RN with keys K1, K2, K3,.. KN are said to be h-ordered, if
a. Ki <= Ki+h for 1<= i*h <= N
b. Kh <= Ki+h for 1<= i <= N
c. Ki <= Kh for 1<= i <= h
d. Ki <= Ki+h for 1<= i <= N-h