Data Structure Multiple-Choice Questions

1. A queue follows _________:

a. LIFO principle

b. FIFO principle

c. Linear tree

d. Ordered array

Answer: (b) FIFO principle

2. The time complexity used for inserting a node in a priority queue on the basis of key is:

a. O(n)

b. O(n2)

c. O(nlogn)

d. O(logn)

Answer: (a) O(n)

3. Which of these is a postfix expression?

a. a+b-c

b. +ab

c. abc*+de-+

d. a*b(c+d)

Answer: (c) abc*+de-+

4. Which data structure do we use for testing a palindrome?

a. Heap

b. Tree

c. Priority queue

d. Stack

Answer: (d) Stack

5. Which of these will form an inversion in this given array?

arr = {2,8,5,3}

a. (2,8)

b. (8,5), (8,3)

c. (2,8), (2,5), (1,3)

d. (8,5), (8,3), (5,3)

Answer: (d) (8,5), (8,3), (5,3)

6. Which one isn’t the property of the XOR lists?

a. X⊕0 = X

b. X⊕X = 0

c. X⊕0 = 1

d. (X⊕Y)⊕Z = X⊕(Y⊕Z)

Answer: (c) X⊕0 = 1

7. The tango tree is a type of:

a. Binary Search Tree

b. K-ary Tree

c. Ternary Tree

d. AVL Tree

Answer: (a) Binary Search Tree

8. In an AA-tree, we can remove a left horizontal link by:

a. inserting a new element

b. deleting both the elements

c. performing left rotation

d. performing right rotation

Answer: (d) performing right rotation

9. We can use a self–balancing binary search tree for implementing the:

a. Hash table

b. Priority queue

c. Heap sort and Priority queue

d. Heap sort

Answer: (b) Priority Queue

10. A splay operation refers to:

a. the removal of leaf node

b. the movement of root to leaf

c. the movement of a node to root

d. the movement of parent node to a child node’s down

Answer: (c) the movement of a node to root

11. Out of these, which one is NOT true about a 2-3 tree?

a. it is perfectly balanced

b. the leaves are always at the same level

c. it refers to a B-tree of the order 3

d. postorder traversal would yield the elements in a sorted order

Answer: (d) postorder traversal would yield the elements in a sorted order

12. How do we define the Ackermann’s function?

a. for i<1, A(1,i) = i+1

b. for i = j, A(i,j) = i+j

c. for i>=j, A(i,j) = i+j

d. for i>=1, A(1,i) = i+1

Answer: (d) for i>=1, A(1,i) = i+1

13. A recursive implementation would presumably fail in skew heaps because:

a. lack of stack space

b. time complexity

c. these heaps are self adjusting

d. efficiency gets reduced

Answer: (a) lack of stack space

14. Which operation can we NOT perform directly in a d-heap?

a. create

b. find

c. delete

d. insert

Answer: (b) find

15. The time does taken for the construction of suffix tree is:

a. Linear to the Length of Tree

b. Exponential to the Length of Tree

c. O (M!)

d. O (log M)

Answer: (a) Linear to the Length of Tree

16. The best technique for handling collision is:

a. Separate chaining

b. Double hashing

c. Linear probing

d. Quadratic probing

Answer: (d) Quadratic probing

17. Which one is the most desirable out of these traits of a hash function?

a. it must cause more collisions

b. it must be easy to implement

c. it must cause less collisions

d. it must occupy less space

Answer: (c) it must cause less collisions

18. What is the time complexity for checking if an undirected graph with E edges and V vertices is Bipartite, given its adjacency matrix?

a. O(E)

b. O(V)

c. O(E*E)

d. O(V*V)

Answer: (d) O(V*V)


Discover more from EduGrown School

Subscribe to get the latest posts sent to your email.