MCQ on Tree | Binary Tree | Binary Search Tree | AVL Tree

(Last Updated On: March 13, 2019)
1) A Binary Tree can have
  1. Can have 2 children
  2. Can have 1 children
  3. Can have 0 children
  4. All
View Answer
Answer: D
Explanation: Binary tree can have at most 2 children.

 

2) Height of Height of a binary tree is
  1. MAX( Height of left Subtree, Height of right subtree)+1
  2. MAX( Height of left Subtree, Height of right subtree)
  3. MAX( Height of left Subtree, Height of right subtree)-1
  4. None
View Answer
Answer: A

3) Postfix expression for (A+B) *(C+D) is
  1. A B C * + D +
  2. A B + C D + *
  3. ABCD++*
  4. None
View Answer
Answer: B
Explanation: In postfix form two operands come together then operator. For example, in A+B, A and B are two operands and + is one operator and A+B is in infix form. Hence, in postfix of A+B will be AB+.
Let’s consider the question above
(A+B) *(C+D)//this expression is in infix form
First get A and B operand together then operator +. Similarly, for C and D
(AB+) * (CD+)
now consider AB+ and CD+ as two operands. Take them together then * operator.
(AB+) (CD+) *
Remove brackets.
AB+CD+*
So, AB+CD+* is the postfix expression of (A+B) *(C+D) infix expression.


4) True statements about AVL tree are
  1. It is a binary search tree.
  2. Left node and right node differs in height by at most 1 unit
  3. Worst case time complexity is O(log2n)
  4. Worst case time complexity is O(n)
View Answer
Answer: A, B and C

5)Match the following for binary tree traversal
(1) Pre Order (A)Left Right Root
(2) In Order (B)Left Root Right
(2) Post Order (C)Root Left Right
  1. 1 → A, 2 → B,  3 → C
  2. 1 → C, 2 → B,  3 → A
  3. 1 → A, 2 → C,  3 → B
  4. 1 → B, 2 → A,  3 → C
View Answer
Answer:B