31
In a Binary Search Tree (BST), what is the time complexity of searching for an element in the average case?
A)
O(1)
B)
O(log n)
C)
O(n)
D)
O(n log n)
Answer & Solution
Answer: Option
B
32
What is the main reason for implementing a Binary Search Tree (BST) as a self-balancing tree?
A)
To maintain O(log n) time complexity for insertions, deletions, and searches.
B)
To ensure the tree is always a complete binary tree.
C)
To allow nodes to be stored in any order.
D)
To minimize memory usage.
Answer & Solution
Answer: Option
A
33
Which traversal method is used to obtain the nodes of a BST in the reverse order of their sorted values?
A)
Reverse Inorder
B)
Preorder
C)
Postorder
D)
Level-order
Answer & Solution
Answer: Option
A
34
When deleting a node from a BST, what should you do if the node to be deleted has two children?
A)
Replace it with its inorder successor or predecessor, then remove the successor or predecessor.
B)
Directly remove the node and replace it with its left child.
C)
Directly remove the node and replace it with its right child.
D)
Replace it with its left child.
Answer & Solution
Answer: Option
A
35
What is the purpose of the "left rotation" operation in a Binary Search Tree (BST)?
A)
To maintain balance and keep the tree balanced.
B)
To move a node to the right subtree.
C)
To convert a BST into a binary heap.
D)
To find the maximum value node.
Answer & Solution
Answer: Option
A
36
In a Binary Search Tree (BST), which of the following is true for any node's left subtree?
A)
All nodes in the left subtree are smaller than the node itself.
B)
All nodes in the left subtree are larger than the node itself.
C)
The left subtree contains nodes with equal values.
D)
The left subtree is always empty.
Answer & Solution
Answer: Option
A
37
What is the minimum number of nodes required to form a Binary Search Tree (BST) of height h?
A)
2h - 1
B)
2(h+1) - 1
C)
2(h)
D)
2h
Answer & Solution
Answer: Option
B
38
In a BST, how do you identify the maximum value node?
A)
By traversing to the rightmost node from the root.
B)
By traversing to the leftmost node from the root.
C)
By finding the root node.
D)
By searching the entire tree.
Answer & Solution
Answer: Option
A
39
What happens if a Binary Search Tree (BST) becomes unbalanced due to insertions or deletions?
A)
Search, insertion, and deletion operations may degrade to O(n) time complexity.
B)
The tree automatically rebalances itself.
C)
The tree converts into a binary heap.
D)
The tree becomes a complete binary tree.
Answer & Solution
Answer: Option
A
40
Which property is true for a Binary Search Tree (BST) that is also a perfect binary tree?
A)
All levels are fully filled, and all leaves are at the same level.
B)
The height of the tree is minimal.
C)
The tree contains only leaf nodes.
D)
All nodes have exactly two children.
Answer & Solution
Answer: Option
A