Data Structures (DS) (Chapter - Non Linear Data Structures - Trees) Solved MCQs (Set-2)
Data Structures (DS) (Chapter - Non Linear Data Structures - Trees) Solved MCQs (Set-2)
26. 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
Answer: C
q M
28. For the tree below, write thec
level-order traversal.
M
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
Answer: B
29. What is the space complexity of the in-order traversal in the recursive fashion?
(d is the tree depth and n is the number of nodes)
A. O(1)
B. O(nlogd)
C. O(logd)
D. O(d)
Answer: D
31. 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
Answer: B
32. In a binary search tree, which of the following traversals would print the
numbers in the ascending order?
A. Level-order traversal
B. Pre-order traversal
C. Post-order traversal
D. In-order traversal
Answer: D
33. The number of edges from the root to the node is called of the tree.
A. Height
B. Depth
C. Length
D. Width
Answer: B
34. The number of edges from the node to the deepest leaf is called of the tree.
A. Height
B. Depth
C. Length
D. Width
Answer: A
37. What is the average case time complexity for finding the height of the binary
tree?
A. h = O(loglogn)
B. h = O(nlogn)
C. h = O(n)
D. h = O(log n)
Answer: D
39. In a full binary tree if number of internal nodes is I, then number of leaves L
are?
A. L = 2*I
B. L = I + 1
C. L = I – 1
D. L = 2*I – 1
Answer: B
41. In a full binary tree if there are L leaves, then total number of nodes N are?
A. N = 2*L
B. N = L + 1
C. N = L – 1
D. N = 2*L – 1
Answer: D
44. What is the speciality about the inorder traversal of a binary search tree?
A. It traverses in a non increasing order
B. It traverses in an increasing order
C. It traverses in a random fashion
D. It traverses based on priority of the node
Answer: B
45. What are the worst case and average case complexities of a binary search tree?
46. What are the conditions for an optimal binary search tree and what is its
advantage?
A. The tree should not be modified and you should know how often the keys are accessed, it
improves the lookup cost
B. You should know the frequency of access of the keys, improves the lookup time
C. The tree can be modified and you should know the number of elements in the tree before
hand, it improves the deletion time
D. The tree should be just modified and improves the lookup time
Answer: A
47. Which of the following is not the self balancing binary search tree?
A. AVL Tree
B. 2-3-4 Tree
C. Red – Black Tree
D. Splay Tree
Answer: B
48. The binary tree sort implemented using a self – balancing binary search tree
takes time is worst case.
A. O(n log n)
B. O(n)
C. O(n2)
D. O(log n)
Answer: A
49. An AVL tree is a self – balancing binary search tree, in which the heights of the
two child sub trees of any node differ by
A. At least one
B. At most one
C. Two
D. At most two