Top 350+ Solved Data Structures (DS) MCQ Questions Answer
Q. What operation does the following diagram depict?
a. inserting a leaf node
b. inserting an internal node
c. deleting a node with 0 or 1 child
d. none
Q. Using what formula can a parent node be located in an array?
a. (i+1)/2
b. (i-1)/2
c. i/2
d. 2i/2
Q. Which of the following properties are obeyed by all three tree – traversals?
a. Left subtrees are visited before right subtrees
b. Right subtrees are visited before left subtrees
c. Root node is visited before left subtree
d. Root node is visited before right subtree
Q. For the tree below, write the pre-order traversal.
a. 2, 7, 2, 6, 5, 11, 5, 9, 4
b. 2, 7, 5, 2, 6, 9, 5, 11, 4
c. 2, 5, 11, 6, 7, 4, 9, 5, 2
d. none
Q. For the tree below, write the post-order traversal.
a. 2, 7, 2, 6, 5, 11, 5, 9, 4
b. 2, 7, 5, 2, 6, 9, 5, 11, 4
c. 2, 5, 11, 6, 7, 4, 9, 5, 2
d. none
Q. What is the time complexity of pre-order traversal in the iterative fashion?
a. O(1)
b. O(n)
c. O(logn)
d. O(nlogn)
Q. What is the space complexity of the post-order traversal in the recursive fashion? (d is the treedepth and n is the number of nodes)
a. O(1)
b. O(nlogd)
c. O(logd)
d. O(d)
Q. To obtain a prefix expression, which of the tree traversals is used?
a. Level-order traversal
b. Pre-order traversal
c. Post-order traversal
d. In-order traversal
Q. Consider the following data. The pre order traversal of a binary tree is A, B, E, C, D. The in ordertraversal of the same binary tree is B, E, A, D, C. The level order sequence for the binary tree is
a. A, C, D, B, E
b. A, B, C, D, E
c. A, B, C, E, D
d. D, B, E, A, C
Q. The post-order traversal of a binary tree is O P Q R S T. Then possible pre-order traversal will be
a. T Q R S O P
b. T O Q R P S
c. T Q O P S R
d. T Q O S P R