• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Binary Trees Data Structure with Answers

Question 11

A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0. the root is stored at X[1]. For a node stored at X[i], the left child, if any, is stored in X[2i] and the right child, if any, in X[2i+1]. To be able to store any binary tree on n vertices the minimum size of X should be. (GATE CS 2006)
  • log2n
  • n
  • 2n + 1
  • 2^n — 1

Question 12

Postorder traversal of a given binary search tree, T produces the following sequence of keys 10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29 Which one of the following sequences of keys can be the result of an in-order traversal of the tree T? (GATE CS 2005)
  • 9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95
  • 9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29
  • 29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95
  • 95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29

Question 13

Consider the following nested representation of binary trees: (X Y Z) indicates Y and Z are the left and right sub stress, respectively, of node X. Note that Y and Z may be NULL, or further nested. Which of the following represents a valid binary tree?
  • (1 2 (4 5 6 7))
  • (1 (2 3 4) 5 6) 7)
  • (1 (2 3 4)(5 6 7))
  • (1 (2 3 NULL) (4 5))

Question 14

Consider a node X in a Binary Tree. Given that X has two children, let Y be Inorder successor of X. Which of the following is true about Y?
  • Y has no right child
  • Y has no left child
  • Y has both children
  • None of the above

Question 15

In a binary tree with n nodes, every node has an odd number of descendants. Every node is considered to be its own descendant. What is the number of nodes in the tree that have exactly one child?
  • 0
  • 1
  • (n-1)/2
  • n-1

Question 16

The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height h is:
  • 2h−1
  • 2h−1 -1
  • 2h+1-1
  • 2h+1

Question 17

The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum number of nodes in a binary tree of height 5 are
  • 63 and 6, respectively
  • 64 and 5, respectively
  • 32 and 6, respectively
  • 31 and 5, respectively

Question 18

A binary tree T has 20 leaves. The number of nodes in T having two children is

  • 18

  • 19

  • 17

  • Any number between 10 and 20

Question 19

An array of integers of size n can be converted into a heap by adjusting the heaps rooted at each internal node of the complete binary tree starting at the node ⌊(n - 1) /2⌋, and doing this adjustment up to the root node (root node is at index 0) in the order ⌊(n - 1)/2⌋, ⌊(n - 3)/ 2⌋, ....., 0. The time required to construct a heap in this manner is

  • O(log n)

  • O(n)

  • O (n log log n)

  • O(n log n)

Question 20

In a binary tree, for every node the difference between the number of nodes in the left and right subtrees is at most 2. If the height of the tree is h > 0, then the minimum number of nodes in the tree is:
  • 2h - 1
  • 2h - 1 + 1
  • 2h - 1
  • 2h

There are 52 questions to complete.

Last Updated :
Take a part in the ongoing discussion