MCQs On DS
MCQs On DS
If the post-order traversal gives ab-cd*+ then the label of the nodes 1, 2, 3,…..will be:
(a) +, -, *, a, b, c, d (b) a, -, b, +, c, *, d
(c) a, b, c, d, -, *, + (d) -, a, b, +, *, c, d
If the depth is 1, the root maybe one of the 3 nodes A, B, C. Corresponding to a root, say A, 2 trees are
possible as this.
Q 4. A binary tree in which every non-leaf node has non-empty left and right subtrees is called a strictly
binary tree. Such a tree with 10 leaves.
(a) maximum 19 nodes
(b) has exactly 19 nodes
(c) has exactly 17 nodes
(d) cannot have more than 17 nodes
Solution: Option (b)
Explanation:
The configuration of 10 leaves can only be of the following way:
Any tree with n-leaves, for strict binary tree has (2n-1) nodes.
Q5. What is the depth of a Complete Binary Tree with ‘n’ nodes is (log is to the base 2) ?
(a) log (n+1) -1
(b) In-order
(c) Pre-order
= 6C3 (3+1)
= 6C3 = 5
*+ab – cd
Q11. If a binary tree has n leaf nodes. The no. of nodes of degree 2 in this tree is:
(a) log2n (b) n-1
(c) n (d) 2n
Q12. The number of Binary Trees with 3 nodes which when traversed by post-order gives the sequence A,
B, C is
(a) 3 (b) 9
(c) 7 (d) 5
(c) 17 (d) 13
L= (n-1) I +1
Q16. The Inorder and Preorder traversal of a binary tree is d b e a f c g and a b d e c f g respectively.
Which among the following is the correct Post Order Traversal Sequence for this tree ?
(a) d e b f g c a (b) e d b g f c a
(c) e d b f g c a (d) d e f g b c a
Q17. Modes of a binary search tree have the values —1, 2, 3, 4, 5, 6, 7 and 8. Which among the following
will be the preorder traversal sequence of this binary search tree ?
(a) 5 3 1 2 4 7 8 6 (b) 5 3 1 2 6 4 8 7
(c) 5 3 2 4 1 6 7 8 (d) 5 3 1 2 4 7 6 8