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


1) A Binary Tree can have
  1. Can have 2 children
  2. Can have 1 children
  3. Can have 0 children
  4. All

Answer: 4
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

Answer: 1


 
3) Postfix expression for (A+B) *(C+D) is
  1. A B C * + D +
  2. A B + C D + *
  3. ABCD++*
  4. None

Answer: 2

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)

Answer: 1, 2 and 3

A side note: AVL tree is a self balancing binary tree and named after inventors Adelson-Velsky and Landis …wikipedia..


5)Match the following for binary tree traversal
(1) Pre Order(A)Left Right Root
(2) In Order(B)Left Root Right
(3) 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

Answer:2


MCQ on Tree | Binary Tree | Binary Search Tree | AVL Tree
Scroll to top