Top 350+ Solved Data Structures (DS) MCQ Questions Answer
Q. A binary search tree contains values 7, 8, 13, 26, 35, 40, 70, 75. Which one of the following is a validpost-order sequence of the tree provided the pre-order sequence as 35, 13, 7, 8, 26, 70, 40 and 75?
a. 7, 8, 26, 13, 75, 40, 70, 35
b. 26, 13, 7, 8, 70, 75, 40, 35
c. 7, 8, 13, 26, 35, 40, 70, 75
d. 8, 7, 26, 13, 40, 75, 70, 35
Q. Which of the following pair’s traversals on a binary tree can build the tree uniquely?
a. post-order and pre-order
b. post-order and in-order
c. post-order and level order
d. level order and preorder
Q. A full binary tree can be generated using
a. post-order and pre-order traversal
b. pre-order traversal
c. post-order traversal
d. in-order traversal
Q. The maximum number of nodes in a tree for which post-order and pre-order traversals may beequal is
a. 3
b. 1
c. 2
d. any number
Q. The pre-order and in-order are traversals of a binary tree are T M L N P O Q and L M N T O P Q.Which of following is post-order traversal of the tree?
a. L N M O Q P T
b. N M O P O L T
c. L M N O P Q T
d. O P L M N Q T
Q. Find the postorder traversal of the binary tree shown below.
a. P Q R S T U V W X
b. W R S Q P V T U X
c. S W T Q X U V R P
d. none
Q. For the tree below, write the in-order traversal.
a. 6, 2, 5, 7, 11, 2, 5, 9, 4
b. 6, 5, 2, 11, 7, 4, 9, 5, 2
c. 2, 7, 2, 6, 5, 11, 5, 9, 4
d. none
Q. For the tree below, write the level-order traversal.
a. 2, 7, 2, 6, 5, 11, 5, 9, 4
b. 2, 7, 5, 2, 11, 9, 6, 5, 4
c. 2, 5, 11, 6, 7, 4, 9, 5, 2
d. none
Q. What is the space complexity of the in-order traversal in the recursive fashion? (d is the tree depthand n is the number of nodes)
a. O(1)
b. O(nlogd)
c. O(logd)
d. O(d)
Q. Which of the following graph traversals closely imitates level order traversal of a binary tree?
a. Depth First Search
b. Breadth First Search
c. Depth & Breadth First Search
d. Binary Search
Q. In a binary search tree, which of the following traversals would print the numbers in the ascendingorder?
a. Level-order traversal
b. Pre-order traversal
c. Post-order traversal
d. In-order traversal
Q. The number of edges from the root to the node is called of the tree.
a. Height
b. Depth
c. Length
d. Width
Q. The number of edges from the node to the deepest leaf is called of the tree.
a. Height
b. Depth
c. Length
d. Width
Q. What is a full binary tree?
a. Each node has exactly zero or two children
b. Each node has exactly two children
c. All the leaves are at the same level
d. Each node has exactly one or two children