183
93.3k

550+ Data Structures (DS) Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) , Information Technology Engineering (IT) , Bachelor of Science in Computer Science FY (BSc CS) , Bachelor of Science in Information Technology FY (BSc IT) , Bachelor of Computer Applications (BCA) .

Chapters

Chapter: Searching, Sorting and Hashing Techniques
201.

Shell sort is an improvement on

A. insertion sort
B. selection sort
C. binary tree sort
D. quick sort
Answer» A. insertion sort
202.

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
Answer» D. both 7-ordered and 5-ordered
203.

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)
Answer» A. O(nlogn)
204.

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
Answer» D. Ki <= Ki+h for 1<= i <= N-h
205.

Which of the following is true?

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. 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
206.

Which of the following is the distribution sort?

A. Heap sort
B. Smooth sort
C. Quick sort
D. LSD radix sort
Answer» D. LSD radix sort
207.

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. O(wn)
208.

LSD radix sort requires passes to sort N elements.

A. (w/logR)
B. N(w/logR)
C. (w/log(RN))
D. (wN/log(N))
Answer» A. (w/logR)
209.

Which of the following is false?

A. LSD radix sort is an integer sorting algorithm
B. LSD radix sort is a comparison sorting algorithm
C. LSD radix sort is a distribution sort
D. LSD radix sort uses bucket sort
Answer» B. LSD radix sort is a comparison sorting algorithm
210.

Which of the following sorting algorithm is stable?

A. Heap sort
B. Selection sort
C. In-place MSD radix sort
D. LSD radix sort
Answer» D. LSD radix sort
211.

Which of the following should be used to sort a huge database on a fixed-length key field?

A. Insertion sort
B. Merge sort
C. LSD radix sort
D. Quick sort
Answer» C. LSD radix sort
212.

Which of the following is a combination of LSD and MSD radix sorts?

A. Forward radix sort
B. 3-way radix quick sort
C. Trie base radix sort
D. Flash sort
Answer» A. Forward radix sort
213.

Which of the following is true for the LSD radix sort?

A. works best for variable length strings
B. accesses memory randomly
C. inner loop has less instructions
D. sorts the keys in left-to-right order
Answer» B. accesses memory randomly
214.

Which scheme uses a randomization approach?

A. hashing by division
B. hashing by multiplication
C. universal hashing
D. open addressing
Answer» C. universal hashing
215.

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. h(k) = lowerbound(km)
216.

What is the hash function used in the division method?

A. h(k) = k/m
B. h(k) = k mod m
C. h(k) = m/k
D. h(k) = m mod k
Answer» B. h(k) = k mod m
217.

What can be the value of m in the division method?

A. Any prime number
B. Any even number
C. 2p – 1
D. 2p
Answer» A. Any prime number
218.

Which scheme provides good performance?

A. open addressing
B. universal hashing
C. hashing by division
D. hashing by multiplication
Answer» B. universal hashing
219.

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. 15
220.

How many steps are involved in creating a hash function using a multiplication method?

A. 1
B. 4
C. 3
D. 2
Answer» D. 2
221.

What is the hash function used in multiplication method?

A. h(k) = floor( m(kA mod 1))
B. h(k) = ceil( m(kA mod 1))
C. h(k) = floor(kA mod m)
D. h(k) = ceil( kA mod m)
Answer» A. h(k) = floor( m(kA mod 1))
222.

What is the advantage of the multiplication method?

A. only 2 steps are involved
B. using constant
C. value of m not critical
D. simple multiplication
Answer» C. value of m not critical
223.

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. 128
224.

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. Theta(n)
More MCQs
225.

Which if the following is/are the levels of implementation of data structure

A. abstract level
B. application level
C. implementation level
D. all of the above
Answer» D. all of the above
226.

A binary search tree whose left subtree and right subtree differ in hight by at most 1 unit is called ……

A. avl tree
B. red-black tree
C. lemma tree
D. none of the above
Answer» A. avl tree
227.

Stack is also called as

A. last in first out
B. first in last out
C. last in last out
D. first in first out
Answer» A. last in first out
228.

…………… is not the component of data structure.

A. operations
B. storage structures
C. algorithms
D. none of above
Answer» D. none of above
229.

Which of the following is not the part of ADT description?

A. data
B. operations
C. both of the above
D. none of the above
Answer» D. none of the above
230.

……………. Is a pile in which items are added at one end and removed from the other.

A. stack
B. queue
C. list
D. none of the above
Answer» B. queue
231.

………… is very useful in situation when data have to stored and then retrieved in reverse order.

A. stack
B. queue
C. list
D. link list
Answer» A. stack
232.

Which data structure allows deleting data elements from and inserting at rear?

A. stacks
B. queues
C. dequeues
D. binary search tree
Answer» B. queues
233.

Which of the following data structure can’t store the non-homogeneous data elements?

A. arrays
B. records
C. pointers
D. stacks
Answer» A. arrays
234.

A ……. is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out.

A. queue linked list
B. stacks linked list
C. both of them
D. neither of them
Answer» A. queue linked list
235.

Which of the following is non-liner data structure?

A. stacks
B. list
C. strings
D. trees
Answer» D. trees
236.

Herder node is used as sentinel in …..

A. graphs
B. stacks
C. binary tree
D. queues
Answer» C. binary tree
237.

Which data structure is used in breadth first search of a graph to hold nodes?

A. stack
B. queue
C. tree
D. array
Answer» B. queue
238.

Identify the data structure which allows deletions at both ends of the list but insertion at only one end.

A. input restricted dequeue
B. output restricted qequeue
C. priority queues
D. stack
Answer» A. input restricted dequeue
239.

Which of the following data structure is non linear type?

A. strings
B. lists
C. stacks
D. graph
Answer» D. graph
240.

Which of the following data structure is linear type?

A. graph
B. trees
C. binary tree
D. stack
Answer» D. stack
241.

To represent hierarchical relationship between elements, Which data structure is suitable?

A. dequeue
B. priority
C. tree
D. graph
Answer» C. tree
242.

A directed graph is ………………. if there is a path from each vertex to every other vertex in the digraph.

A. weakly connected
B. strongly connected
C. tightly connected
D. linearly connected
Answer» B. strongly connected
243.

In the …………….. traversal we process all of a vertex’s descendants before we move to an adjacent vertex.

A. depth first
B. breadth first
C. with first
D. depth limited
Answer» A. depth first
244.

The number of comparisons done by sequential search is ………………

A. (n/2)+1
B. (n+1)/2
C. (n-1)/2
D. (n+2)/2
Answer» B. (n+1)/2
245.

In ……………, search start at the beginning of the list and check every element in the list.

A. linear search
B. binary search
C. hash search
D. binary tree search
Answer» A. linear search
246.

Which of the following is not the internal sort?

A. insertion sort
B. bubble sort
C. merge sort
D. heap sort
Answer» C. merge sort
247.

A graph is said to be ……………… if the vertices can be split into two sets V1 and V2 such there are no edges between two vertices of V1 or two vertices of V2.

A. partite
B. bipartite
C. rooted
D. bisects
Answer» B. bipartite
248.

In a queue, the initial values of front pointer f rare pointer r should be …….. and ……….. respectively.

A. 0 and 1
B. 0 and -1
C. -1 and 0
D. 1 and 0
Answer» B. 0 and -1
249.

In a circular queue the value of r will be ..

A. r=r+1
B. r=(r+1)% [queue_size – 1]
C. r=(r+1)% queue_size
D. r=(r-1)% queue_size
Answer» C. r=(r+1)% queue_size
250.

The advantage of …………….. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists.

A. lists
B. linked lists
C. trees
D. queues
Answer» B. linked lists

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.