Top 80+ Solved Non Linear Data Structures - Trees MCQ Questions Answer
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
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