Binary Search Trees (BST) MCQs

By: Prof. Dr. Fazal Rehman Shamil | Last updated: September 20, 2024

What is a Binary Search Tree (BST)?

a) A tree where each node has exactly one child
b) A tree where each node has at most two children
c) A tree where the left subtree is greater than the root and the right subtree is less than the root
d) A tree where the left subtree is less than the root and the right subtree is greater than the root
Answer: d) A tree where the left subtree is less than the root and the right subtree is greater than the root
Which property of Binary Search Trees allows for efficient searching, insertion, and deletion operations?

a) Complete binary structure
b) Balanced height
c) Symmetric nodes
d) Binary search property
Answer: d) Binary search property
What is the time complexity of searching for an element in a Binary Search Tree (BST) with
𝑛
n nodes, assuming the tree is balanced?

a) O(1)
b) O(log n)
c) O(n)
d) O(n log n)
Answer: b) O(log n)
Which traversal of a Binary Search Tree (BST) visits nodes in non-decreasing order?

a) Preorder
b) Inorder
c) Postorder
d) Level order
Answer: b) Inorder
In a Binary Search Tree (BST), which operation is used to find the minimum element?

a) minElement()
b) findMin()
c) getMinimum()
d) minimum()
Answer: b) findMin()
What is the worst-case time complexity of inserting an element into a Binary Search Tree (BST) of height
β„Ž
h?

a) O(1)
b) O(h)
c) O(log h)
d) O(n)
Answer: c) O(log h)
Which traversal of a Binary Search Tree (BST) starts from the root, visits the left subtree, and then visits the right subtree?

a) Preorder
b) Inorder
c) Postorder
d) Level order
Answer: a) Preorder
Which of the following statements is true about all Binary Search Trees (BST)?

a) They are complete binary trees
b) They have symmetric nodes
c) They have a unique binary search property
d) They have nodes arranged in a specific order
Answer: c) They have a unique binary search property
Which operation of a Binary Search Tree (BST) deletes a node with two children?

a) deleteNode()
b) remove()
c) erase()
d) delete()
Answer: a) deleteNode()
In a Binary Search Tree (BST), which operation is used to find the successor of a given node?

a) findSuccessor()
b) successor()
c) next()
d) nextNode()
Answer: b) successor()
Which of the following operations requires the worst-case time complexity in a Binary Search Tree (BST)?

a) Searching
b) Insertion
c) Deletion
d) Traversal
Answer: c) Deletion
Which traversal of a Binary Search Tree (BST) visits nodes in descending order of their values?

a) Preorder
b) Inorder
c) Postorder
d) Reverse Inorder
Answer: d) Reverse Inorder
In a Binary Search Tree (BST), what is the height of a tree with
𝑛
n nodes in the worst case?

a)
log
⁑
𝑛
logn
b)
𝑛
n
c)
𝑛
n
​

d)
𝑛
log
⁑
𝑛
nlogn
Answer: b)
𝑛
n
Which traversal of a Binary Search Tree (BST) can be used to print the elements in sorted order?

a) Preorder
b) Inorder
c) Postorder
d) Level order
Answer: b) Inorder
In a Binary Search Tree (BST), what is the maximum number of edges in a path from the root to a leaf node?

a)
log
⁑
𝑛
logn
b)
𝑛
n
c)
𝑛
n
​

d)
𝑛
βˆ’
1
nβˆ’1
Answer: d)
𝑛
βˆ’
1
nβˆ’1
Which operation of a Binary Search Tree (BST) returns the maximum element?

a) maxElement()
b) findMax()
c) getMaximum()
d) maximum()
Answer: b) findMax()
Which of the following is NOT a valid property of Binary Search Trees (BST)?

a) All nodes in the left subtree are less than the root
b) All nodes in the right subtree are greater than the root
c) There can be duplicate nodes
d) Inorder traversal visits nodes in non-decreasing order
Answer: c) There can be duplicate nodes
Which traversal of a Binary Search Tree (BST) visits nodes level by level?

a) Preorder
b) Inorder
c) Postorder
d) Level order
Answer: d) Level order
Which of the following statements is true about Binary Search Trees (BST)?

a) They can have nodes with only one child
b) They have nodes arranged in a specific order
c) They require nodes to be symmetric
d) They support only recursive operations
Answer: b) They have nodes arranged in a specific order

 

Data Structures MCQs

Basic Concepts

  1. Introduction to Data Structures
  2. Complexity Analysis MCQs

Linear Data Structures MCQs

  1. Arrays MCQs
  2. Linked Lists MCQs
  3. Stacks MCQs
  4. Queues MCQs

Non-Linear Data Structures MCQs

  1. Trees MCQs
  2. Heaps MCQs
  3. Graphs MCQs

Hashing MCQs MCQs

  1. Hash Tables

Sorting and Searching Algorithms MCQsΒ 

  1. Sorting Algorithms MCQs
  2. Searching Algorithms MCQs

Miscellaneous

  1. Memory Management in data structures MCQs
  2. String Manipulation Algorithms MCQs
  1. Data Structures MCQs 1
  2. Data Structures MCQs 2
  3. Data Structures MCQs 3
  4. Data Structures MCQs 4
  5. Data Structures MCQs 5
  6. Stacks Solved MCQs
  7. Queues MCQs
  8. pointer mcqs
  9. Array MCQs