Tree MCQ Quiz - Objective Question with Answer for Tree - Download Free PDF

Last updated on Apr 11, 2025

Latest Tree MCQ Objective Questions

Tree Question 1:

Non leaf nodes of B+ tree structure form a : 

  1. Multilevel sparse indices 
  2. Multilevel dense indices
  3. Sparse indices
  4. Multilevel clustered indices

Answer (Detailed Solution Below)

Option 1 : Multilevel sparse indices 

Tree Question 1 Detailed Solution

B+ Tree Structure Explanation - guacandrollcantina.com

The correct answer is Multilevel sparse indices.

Key Points

  • Non-leaf nodes of a B+ tree structure form multilevel sparse indices, which are crucial for its efficiency and performance.
  • In a B+ tree, all the actual data records are stored in the leaf nodes, while the non-leaf nodes (or internal nodes) store the keys that act as pointers to guide the search process.
  • The non-leaf nodes do not store every key, only enough to direct the search to the appropriate leaf node, making the indices sparse.
  • This structure helps in reducing the height of the tree, thus speeding up the search, insert, and delete operations.
  • Multilevel indexing means that the tree is structured in multiple levels (root, intermediate levels, and leaf nodes), where each level helps narrow down the search space progressively.
  • The B+ tree is a balanced tree, meaning all the leaf nodes are at the same level, which ensures consistent and predictable performance.

Additional Information

  • B+ trees are widely used in database indexing and file systems due to their efficiency in handling large amounts of data.
  • They are an extension of B-trees, with the primary difference being that in B+ trees, all values are stored at the leaf level, and internal nodes only store keys.
  • This structure ensures that sequential traversal of the data can be done efficiently by following the linked leaf nodes.
  • Because of the multilevel sparse indexing, B+ trees are well-suited for range queries and ordered traversals.
  • B+ trees maintain balance by splitting and merging nodes as necessary during insertions and deletions, ensuring that the tree remains balanced with minimal height.

Tree Question 2:

Total number of nodes at the nth level of a full binary tree can be given as __________.

  1. 2n + 1
  2. 2n
  3. 2n
  4. 2n−1

Answer (Detailed Solution Below)

Option 3 : 2n

Tree Question 2 Detailed Solution

Explanation:
In a full binary tree, each level contains nodes that follow the pattern:

Level 0: 20 = 1 node

Level 1: 21 = 2 nodes

Level 2: 22 = 4 nodes

...

Level n: 2n nodes

So, the number of nodes at the nth level is given by 2n

Final Answer: Option 3) 2n

Tree Question 3:

Arrange the following steps of the Inorder Traversal of Binary Tree in the correct order.

A. Visit the Left subtree

B. Visit the Root node

C. Visit the Right subtree

D. Start traversing by visiting the nodes in rooted tree

E. Repeat the above three steps.

Choose the correct answer from the options given below:

  1. A, B, C, D, E
  2. E, A, B, C, D
  3. D, A, B, C, E
  4. D, A, E, B, C

Answer (Detailed Solution Below)

Option 3 : D, A, B, C, E

Tree Question 3 Detailed Solution

The correct answer is option 3: D, A, B, C, E

Key Points

Inorder traversal of a binary tree is a type of depth-first traversal where nodes are visited in the following order:

  • Step 1: Start traversing by visiting the nodes in the rooted tree.
  • Step 2: Visit the Left subtree.
  • Step 3: Visit the Root node.
  • Step 4: Visit the Right subtree.
  • Step 5: Repeat the above three steps for each subtree.

Tree Question 4:

Which of the following algorithms are based on the Breadth First Search (BFS)?

A. Prim's algorithms

B. Kruskal algorithms

C. Dijkstra algorithms

D. Greedy algorithms

E. Dynamic Programming

Choose the correct answer from the options given below:

  1. A & B only
  2. A, C & D only
  3. D & E only
  4. A & C only

Answer (Detailed Solution Below)

Option 4 : A & C only

Tree Question 4 Detailed Solution

The correct answer is Option 4.

key-point-imageKey Points

  • Prim's Algorithm:
    • Prim's Algorithm is used to find the Minimum Spanning Tree (MST) for a weighted undirected graph.
    • It starts from an arbitrary node and explores all the adjacent nodes using BFS to find the edge with the smallest weight that connects the tree to a new vertex.
    • It continues this process until all vertices are included in the MST.
  • Dijkstra's Algorithm:
    • Dijkstra's Algorithm is used for finding the shortest paths between nodes in a graph.
    • It starts from the source node and uses BFS to explore all possible paths to other nodes, selecting the path with the smallest cumulative weight.
    • It is particularly useful for graphs with non-negative weights.

additional-information-imageAdditional Information

  • Both Prim's and Dijkstra's algorithms rely on the BFS approach to explore nodes level by level, ensuring that the shortest path or smallest weight edge is chosen at each step.
  • Prim's Algorithm is specifically used for creating MSTs, whereas Dijkstra's is for shortest path problems.
  • While BFS is a fundamental concept, both algorithms incorporate additional logic, such as priority queues, to optimize their respective goals.

Tree Question 5:

qImage67a7385614ec8507bc4a04d8

Considering above binary tree, what will be the inorder traversal

  1. B A D C E G F H
  2. G H F E D C B A
  3. B A C D E G F H
  4. G H F D E B C A

Answer (Detailed Solution Below)

Option 1 : B A D C E G F H

Tree Question 5 Detailed Solution

The correct answer is 1) B A D C E G F H.

Key Points

  • Inorder traversal of a binary tree visits nodes in the following order: left subtree, root node, right subtree.
  • The provided sequence B A D C E G F H follows this rule, visiting the leftmost nodes first, then the root, and finally the rightmost nodes.

Additional Information

  • Inorder traversal is used to get nodes of a binary search tree (BST) in non-decreasing order.
  • This traversal method is used in many tree-related algorithms and problems.
  • It is also useful in scenarios where the order of node processing matters, such as expression trees for arithmetic operations.

Top Tree MCQ Objective Questions

The pre-order traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19.

Which one of the following is the post order traversal of the tree?

  1. 10, 11, 12, 15, 16, 18, 19, 20
  2. 11, 12, 10, 16, 19, 18, 20, 15
  3. 20, 19, 18, 16, 15, 12, 11, 10
  4. 19, 16, 18, 20, 11, 120, 10, 15

Answer (Detailed Solution Below)

Option 2 : 11, 12, 10, 16, 19, 18, 20, 15

Tree Question 6 Detailed Solution

Download Solution PDF

Concept:

A binary tree can be traversed in three ways:

  1. Preorder = (Root, Left subtree, Right Subtree)
  2. Inorder = (Left subtree, Root, Right Subtree)
  3. Postorder = (Left Subtree, Right subtree, Root)

 

Explanation:

In case of Binary Search Trees (BST), inorder traversal always sorts the tree nodes into ascending order.

Inorder traversal is 10, 11, 12, 15, 16, 18, 19, 20

Pre-order traversal is 15, 10, 12, 11, 20, 18, 16, 19.

In preorder traversal, the first node would be tree root and values less than root would be part of left

subtree and values greater than root node would form right subtree. So the resultant BST is:

Required Binary Search Tree:

F1 R.S Madhu 14.04.20 D1

Post order traversal: 11, 12, 10, 16, 19, 18, 20, 15

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

  1. 63 and 6, respectively
  2. 64 and 5, respectively
  3. 32 and 6, respectively
  4. 31 and 5, respectively

Answer (Detailed Solution Below)

Option 1 : 63 and 6, respectively

Tree Question 7 Detailed Solution

Download Solution PDF

Maximum nodes in Graph with height 5:

F1 R.S D.K 24.07.2019 D 5

Maximum number of nodes = 1 + 2 + 4 + 8 + 16 + 32 = 6 

Minimum nodes in Graph with height 5:

Nodes in tree

Minimum number of nodes = 6 

Tips and Tricks:

If nmax is the maximum number of nodes and H height of in a binary search tree, then

nmax = 2H+1 – 1

put H = 5

nmax = 2H+1 – 1 = 26 - 1 = 63

If n is the minimum number of nodes and H is the height of in a binary search tree, then

nmin = H + 1

put H = 5

nmin = 5  + 1 = 6

Consider a complete binary tree with 7 nodes. Let A denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let B denote the set of first 3 elements obtained by performing Depth-First Search (DFS) starting from the root.

The value of |A - B| is _______

Answer (Detailed Solution Below) 1

Tree Question 8 Detailed Solution

Download Solution PDF

Answer: 1 to 1

Explanation

Consider the following Complete Binary Tree

F1 Shraddha Raju 17.03.2021 D11 

A - {A, B, C}

B - {A, B, D}

Set A contains the first 3 elements obtained while Performing BFS.

Set B contains the first 3 elements obtained while performing DFS.

B={A, B, D} ( with DFS multiple Sequences are possible you can select anyone Answer to this Question will be same for all those sequences).

| A - B | 

=|{ A, B, C } – { A, B, D }| 

=|{C}| = 1

Consider the expression tree shown. Each leaf represents a numerical value, which can either be 0 or 1. Over all possible choices of the values at the leaves, the maximum possible value of the

expression represented by the tree is ___.

F1 Raju Shraddha 01.07.2020 D3

Answer (Detailed Solution Below) 6

Tree Question 9 Detailed Solution

Download Solution PDF

Explanation:

F2 Raju Madhu 17.07.20 D2

D = h + I = 2, E = G – k = -1, F = l - m =1 and G = n + o = 2

B = 2-(-1) = 3 and C= 1 + 2 = 3

A= 3 + 3 = 6 

Final tree:

F2 Raju Madhu 17.07.20 D3

Hence 6 is the correct answer.

What is the in-order successor of 15 in the given binary search tree?

F1 R.S Deepak 17.02.20 D4 1

  1. 18
  2. 6
  3. 17
  4. 20

Answer (Detailed Solution Below)

Option 3 : 17

Tree Question 10 Detailed Solution

Download Solution PDF

Concept –

The in-order sequence can be found following the chronology of Left-> Root-> Right.

Finding the in-order traversal sequence, we get 2, 3, 4, 6, 7, 9, 13, 15, 17, 18, 20.

The element that comes after 15 is its successor. It can be seen that 15’s successor is 17.

Explanation –

  • In-order successor of a node is the minimum element in right subtree of the node in consideration.
  • Here, in the right subtree of 15, 17 is the element with minimum value. Hence, 17 is 15’s in-order successor.
  • Similarly, for finding the in-order predecessor of a node, the element with maximum value in left sub-tree is the answer. Here, 13 is 15’s in-order predecessor.


portant Point:

Tricks works only when the tree is Binary Search Tree.

Let T be a binary search tree with 15 nodes. The minimum and maximum possible heights of T are:

Note: The height of a tree with a single node is 0.

  1. 4 and 15 respectively
  2. 3 and 14 respectively
  3. 4 and 14 respectively
  4. 3 and 15 respectively

Answer (Detailed Solution Below)

Option 2 : 3 and 14 respectively

Tree Question 11 Detailed Solution

Download Solution PDF

Concepts:

Minimum height of the tree is when all the levels of BST are completely filled.

Maximum height of the binary search tree (BST) is the worst case when nodes are in skewed manner.

Formula:

Minimum height of the BST with n nodes is ⌈log2 (n + 1)⌉ - 1

Maximum height of the BST with n nodes is n - 1.

Calculation:

Maximum height of the BST with 15 nodes 15 - 1 = 14

Diagram:

F1 R.S Madhu 2.12.19 D1

Minimum height of the BST with n nodes is ⌈log2 (15 + 1)⌉ - 1 = 3

Diagram: 

F1 R.S Madhu 2.12.19 D2

What is the sequence of nodes when applying in-order traversal on the binary tree given below?

F1 R.S Madhu 28.05.20 D2

  1. A, B, C, D, E, F, I, H, G
  2. A, C, D, E, B, F, G, H, I
  3. A, B, C, D, E, F, G, H, I
  4. I, H, G, F, E, D, C, B, A

Answer (Detailed Solution Below)

Option 3 : A, B, C, D, E, F, G, H, I

Tree Question 12 Detailed Solution

Download Solution PDF

Concept:

  • In-order Traversal:  Left -> Root -> Right
  • Pre-order Traversal:  Root -> Left -> Right
  • Post-order Traversal :  Left -> Right -> Root


Binary tree:

GATE CS MIX 6 7Q Raju D1

Inorder Traversal: A, B, C, D, E, F, G, H, I 

The maximum height of a binary tree with ‘n’ nodes is _______.

  1. n
  2. (n − 1)
  3. (n + 1)
  4. (n + n)

Answer (Detailed Solution Below)

Option 2 : (n − 1)

Tree Question 13 Detailed Solution

Download Solution PDF

Concept:

In a binary tree, a node can have maximum two children. If there are n nodes in binary tree, maximum height of the binary tree is n-1.

Tree with maximum height: n = 6

CIL 2 Pending 2020 10Q raju D1

Height = 6 – 1 = 5

The postorder traversal of a binary tree is 8,9,6,7,4,5,2,3,1. The inorder traversal of the same tree is 8,6,9,4,7,2,5,1,3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is ______.

Answer (Detailed Solution Below) 4

Tree Question 14 Detailed Solution

Download Solution PDF

A binary search tree in which every non-leaf node has non-empty left and right subtrees is called a strictly binary tree. Such a tree with 19 leaves:

  1. cannot have more than 37 nodes
  2. has exactly 37 nodes
  3. has exactly 35 nodes
  4. cannot have more than 35 nodes

Answer (Detailed Solution Below)

Option 2 : has exactly 37 nodes

Tree Question 15 Detailed Solution

Download Solution PDF

Formula:

L = I (n - 1) + 1

where, L = number of leaf nodes

I = number of internal nodes

n = n - ary tree

Explanation:

L = 19

n = 2 (as given tree is strictly binary tree)

19 = I (2 - 1) + 1

I = 18

Number of internal nodes = 18

Number of leaf nodes = 19

Total number of nodes = 18 + 19 = 37

Tips and Trick:

Number of internal node in a binary tree = number leaves - 1 = 19 - 1

Total nodes = number of leaf nodes + internal node = 19 + 18 = 37

Important Point:

Root node is also a internal node.
Get Free Access Now
Hot Links: teen patti master gold teen patti - 3patti cards game teen patti joy mod apk teen patti download