CommerceBinary Search TreesB Tree MCQs
Practice Binary Search TreesB Tree MCQs for competitive exams.
Binary Search TreesB Tree MCQs
Practice questions from this topic.
What is the result of a successful search operation in a BST when the searched element is not present?
- A. The search will return the node containing the element.
- B. The search will return the parent node of the searched element.
- C. The search will return a null pointer.
- D. The search will return the root node.
Correct Answer: C
In a BST, how do you find the minimum value node?
- A. Traverse to the leftmost node from the root.
- B. Traverse to the rightmost node from the root.
- C. Find the node with the maximum value.
- D. Find the node with the second highest value.
Correct Answer: A
What is the primary characteristic of a node in a Binary Search Tree (BST)?
- A. It has a value greater than all values in its left subtree and less than all values in its right subtree.
- B. It is the root of the tree.
- C. It has at least one child.
- D. It is the only node in the tree.
Correct Answer: A
In a Binary Search Tree, what is the term for the node that has no children?
- A. Root
- B. Leaf
- C. Parent
- D. Internal node
Correct Answer: B
What is the purpose of rotations in a Binary Search Tree?
- A. To maintain balance and ensure logarithmic height in self-balancing trees.
- B. To optimize search operations.
- C. To sort elements in the tree.
- D. To update node values.
Correct Answer: A
What happens when you delete a node with two children from a BST?
- A. The node is replaced by its predecessor or successor, and then the predecessor or successor is removed.
- B. The node is simply removed.
- C. The node's right child replaces it.
- D. The node is moved to the root.
Correct Answer: A
Which of the following operations can be performed in O(log n) time on a balanced Binary Search Tree?
- A. Insertion
- B. Deletion
- C. Search
- D. All of the above
Correct Answer: D
How can you determine if a Binary Tree is a Binary Search Tree (BST)?
- A. Verify if all nodes in the left subtree are less than the root and all nodes in the right subtree are greater than the root.
- B. Check if the tree is balanced.
- C. Ensure all nodes have exactly two children.
- D. Verify the height of the tree.
Correct Answer: A
What is the maximum number of children a node in a Binary Search Tree (BST) can have?
- A. 1
- B. 2
- C. 3
- D. Any number
Correct Answer: B
Which traversal method of a BST will produce a sorted sequence of node values?
- A. Inorder
- B. Preorder
- C. Postorder
- D. Level-order
Correct Answer: A
What is the time complexity of searching for an element in a Binary Search Tree (BST) in the worst case?
- A. O(1)
- B. O(log n)
- C. O(n)
- D. O(n log n)
Correct Answer: C