PRACTICE • LEARN • GROW
Binary Tree MCQs
Solve topic-wise placement questions and improve your skills.
Binary Tree Progress
0 of 41 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
Which binary tree traversal visits the current node first, then the left subtree, and then the right subtree?
A.
Preorder Traversal
B.
Inorder Traversal
C.
Postorder Traversal
D.
Level Order Traversal
Explanation & Key
Correct Answer:
2
In a Binary Search Tree (BST), which traversal produces values in non-decreasing sorted order?
A.
Preorder Traversal
B.
Inorder Traversal
C.
Postorder Traversal
D.
Breadth-First Traversal
Explanation & Key
Correct Answer:
3
What is the maximum number of nodes at level L in a binary tree (where root is at level 0)?
A.
2^(L+1) - 1
B.
L^2
C.
2^L
D.
2 * L
Explanation & Key
Correct Answer:
4
What is the definition of Balance Factor for a node in an AVL Tree?
A.
Depth(Node) / 2
B.
Number of Left Children - Number of Right Children
C.
Total nodes in Left Subtree + Total nodes in Right Subtree
D.
Height(Left Subtree) - Height(Right Subtree)
Explanation & Key
Correct Answer:
5
Which rotation is performed in an AVL tree to fix an imbalance caused by an insertion into the Right subtree of the Left child (LR case)?
A.
Left-Right (Left rotation on left child, then Right rotation on root)
B.
Single Right rotation on root
C.
Single Left rotation on root
D.
Right-Left double rotation on right child
Explanation & Key
Correct Answer:
6
What is the worst-case time complexity of searching in an unbalanced, degenerate Binary Search Tree of N nodes?
A.
O(log N)
B.
O(N)
C.
O(1)
D.
O(N log N)
Explanation & Key
Correct Answer:
7
What is the minimum height of a binary tree containing N nodes?
A.
N / 2
B.
sqrt(N)
C.
ceil(log2(N + 1)) - 1
D.
log10(N)
Explanation & Key
Correct Answer:
8
How does Morris Inorder Traversal achieve O(N) time and O(1) auxiliary space without recursion or an explicit stack?
A.
By modifying node keys with XOR bitmasks
B.
By converting the tree into a circular doubly linked list
C.
By allocating memory on the heap dynamically
D.
By creating temporary threaded links from the rightmost node of the left subtree back to the current node
Explanation & Key
Correct Answer:
9
What is the Lowest Common Ancestor (LCA) of two nodes u and v in a Binary Search Tree?
A.
The first node visited from the root where u and v lie on opposite sides (or one equals the node)
B.
The root node always
C.
The deeper node between u and v
D.
The node with maximum balance factor
Explanation & Key
Correct Answer:
10
What is the Diameter of a Binary Tree?
A.
The number of leaf nodes
B.
The length of the longest path between any two nodes in the tree
C.
The height of the root node
D.
The maximum degree of any node
Explanation & Key
Correct Answer:
11
In a Red-Black Tree, what is the maximum possible height of a tree with N internal nodes?
A.
log2(N)
B.
N
C.
2 * log2(N + 1)
D.
1.44 * log2(N)
Explanation & Key
Correct Answer:
12
Which of the following properties is true for a Full Binary Tree?
A.
All leaf nodes are at the same depth
B.
Every non-leaf node has exactly 1 child
C.
The tree must be balanced
D.
Every node has either 0 or 2 children
Explanation & Key
Correct Answer:
13
In a Complete Binary Tree represented as an array (1-indexed), where are the children of node at index `i` located?
A.
Left child at `2*i`, Right child at `2*i + 1`
B.
Left child at `i + 1`, Right child at `i + 2`
C.
Left child at `i / 2`, Right child at `i / 2 + 1`
D.
Left child at `2*i - 1`, Right child at `2*i`
Explanation & Key
Correct Answer:
14
What is the time complexity of range sum query and point update in a Segment Tree of size N?
A.
Query: O(1), Update: O(N)
B.
Query: O(log N), Update: O(log N)
C.
Query: O(N), Update: O(log N)
D.
Query: O(log N), Update: O(1)
Explanation & Key
Correct Answer:
15
What is a Binary Indexed Tree (Fenwick Tree) primarily used for?
A.
String matching in O(N) time
B.
Topological sorting of DAGs
C.
Prefix sum queries and point updates in O(log N) time with O(N) array space
D.
Finding strongly connected components
Explanation & Key
Correct Answer:
16
How can you reconstruct a UNIQUE binary tree?
A.
Given Preorder and Postorder traversals alone
B.
Given Level Order traversal alone
C.
Given Inorder traversal alone
D.
Given Inorder traversal and either Preorder or Postorder traversal
Explanation & Key
Correct Answer:
17
What is the maximum number of leaf nodes in a binary tree of height H (root at height 0)?
A.
2^H
B.
2^(H+1)
C.
H^2
D.
2 * H
Explanation & Key
Correct Answer:
18
In a B-Tree of order M, what is the maximum number of children an internal node can have?
A.
M - 1
B.
M
C.
2 * M
D.
ceil(M / 2)
Explanation & Key
Correct Answer:
19
What is the time complexity to find the Inorder Successor of a node in a BST of height H?
A.
O(N log N)
B.
O(1) in all cases
C.
O(H)
D.
O(H^2)
Explanation & Key
Correct Answer:
20
What is the relationship between the number of leaves (L) and the number of internal nodes with 2 children (I_2) in any binary tree?
A.
L = 2 * I_2
B.
L = I_2 - 1
C.
L = I_2 + 2
D.
L = I_2 + 1
Explanation & Key
Correct Answer:
21
What is a Treap data structure?
A.
A hybrid of a Binary Search Tree on keys and a Heap on randomly assigned priorities
B.
A tree that stores graph edges
C.
A ternary search tree for strings
D.
A persistent suffix tree
Explanation & Key
Correct Answer:
22
What is the time complexity of checking if two binary trees are identical (same structure and values)?
A.
O(N * M)
B.
O(min(N, M))
C.
O(log N)
D.
O(1)
Explanation & Key
Correct Answer:
23
How is Zigzag (Spiral) Level Order Traversal implemented efficiently?
A.
By reversing the tree links on odd levels
B.
Using standard binary search
C.
Using two stacks (or a deque) and alternating insertion order per level
D.
Using depth-first search with depth limit 3
Explanation & Key
Correct Answer:
24
What is the space complexity of Postorder Traversal of a balanced binary tree of N nodes using recursion?
A.
O(N)
B.
O(1)
C.
O(N log N)
D.
O(log N)
Explanation & Key
Correct Answer:
25
What does the `find` operation do in a Disjoint Set Union (DSU) tree when Path Compression is enabled?
A.
Makes every traversed node point directly to the root representative
B.
Doubles the tree height
C.
Reverses the parent pointers
D.
Deletes disconnected components
Explanation & Key
Correct Answer:
26
What is the sum of degrees of all nodes in a tree with N vertices?
A.
N * (N - 1) / 2
B.
2 * (N - 1)
C.
N - 1
D.
2 * N
Explanation & Key
Correct Answer:
27
What distinguishes a Splay Tree from an AVL tree?
A.
Splay trees guarantee O(1) worst-case search time
B.
Splay trees only work on static data
C.
Splay trees perform tree rotations (splaying) to move accessed elements to the root without storing balance factors
D.
Splay trees cannot insert duplicate keys
Explanation & Key
Correct Answer:
28
How many structurally distinct Binary Search Trees can be formed with N unique keys?
A.
N!
B.
2^N - N
C.
N^2
D.
The N-th Catalan Number: C_N = (1 / (N + 1)) * (2N choose N)
Explanation & Key
Correct Answer:
29
In a Min-Heap, where is the second smallest element guaranteed to be located?
A.
At index 1 or index 2 (either the left child or the right child of the root)
B.
At the rightmost leaf
C.
At the root
D.
Anywhere in the array with equal probability
Explanation & Key
Correct Answer:
30
What is the time complexity to calculate the Maximum Path Sum between any two nodes in a binary tree?
A.
O(N^2)
B.
O(N)
C.
O(N log N)
D.
O(log N)
Explanation & Key
Correct Answer:
31
What is the height of a balanced Binary Search Tree containing n nodes?
A.
O(log n)
B.
O(n)
C.
O(n^2)
D.
O(1)
Explanation & Key
Correct Answer:
32
What is the minimum and maximum number of nodes in a complete binary tree of height h (where a tree with only the root has height 0)?
A.
Min: 2^h, Max: 2^(h+1) - 1
B.
Min: h, Max: 2^h
C.
Min: 2^(h-1), Max: 2^h
D.
Min: h + 1, Max: h^2
Explanation & Key
Correct Answer:
33
Which tree traversal yields the elements of a Binary Search Tree in strictly descending (reverse-sorted) order?
A.
Right -> Root -> Left (Reverse In-Order)
B.
Pre-order
C.
Post-order
D.
Level-order
Explanation & Key
Correct Answer:
34
What is the Lowest Common Ancestor (LCA) of nodes p and q in a Binary Search Tree?
A.
The first node whose value lies between p->val and q->val (inclusive)
B.
The root node always
C.
The node with maximum value in the BST
D.
The leaf node closest to p
Explanation & Key
Correct Answer:
35
What is Morris In-Order Traversal and what makes it unique?
A.
It achieves In-Order traversal in O(n) time and O(1) auxiliary space without using recursion or an explicit stack by creating threaded links to in-order predecessors
B.
It traverses trees using 4 pointers
C.
It balances the tree during traversal
D.
It converts the tree to a binary heap
Explanation & Key
Correct Answer:
36
What is the definition of a Full Binary Tree (Strict Binary Tree)?
A.
Every node has either exactly 0 or exactly 2 children
B.
All leaf nodes are at the same level
C.
Every node has at most 1 child
D.
All left subtrees are empty
Explanation & Key
Correct Answer:
37
How do you calculate the Diameter of a Binary Tree (longest path between any two nodes)?
A.
Count nodes in left subtree + right subtree
B.
During bottom-up postorder traversal, at each node compute left_height + right_height; the maximum sum seen across all nodes is the diameter
C.
Height of root multiplied by 2
D.
Run BFS from the root
Explanation & Key
Correct Answer:
38
What is the maximum number of leaf nodes in a binary tree of height h?
A.
2^h
B.
2^(h+1)
C.
h^2
D.
h + 1
Explanation & Key
Correct Answer:
39
In a Red-Black Tree, what is the constraint on the number of black nodes along any path from the root to a leaf (null node)?
A.
Every path from root to leaf must contain the exact same number of black nodes (Black-Height invariant)
B.
Black nodes must always alternate with red nodes
C.
There can be at most 2 black nodes per path
D.
Leaf nodes must always be black
Explanation & Key
Correct Answer:
40
How can you serialize and deserialize a binary tree to and from a string?
A.
Use Pre-order traversal, recording null pointers explicitly as sentinel tokens (e.g. "#")
B.
Store only the in-order traversal string
C.
Store only the post-order traversal string
D.
Save memory addresses in hexadecimal
Explanation & Key
Correct Answer:
41
What is a B-Tree and where is it primarily used in software systems?
A.
A self-balancing search tree optimized for systems that read and write large blocks of memory, widely used in Databases (MySQL/PostgreSQL) and Filesystems
B.
A binary tree that only stores bytes
C.
A tree used exclusively for sorting strings
D.
A heap with B children
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong