Commerce

Binary Search TreesB Tree MCQs

Practice Binary Search TreesB Tree MCQs for competitive exams.

Binary Search TreesB Tree MCQs

Practice questions from this topic.

Consider a situation of writing a binary tree into a file with memory storage efficiency in mind, is array representation of tree is good?

  1. A. yes because we are overcoming the need of pointers and so space efficiency
  2. B. yes because array values are indexable
  3. C. No it is not efficient in case of sparse trees and remaning cases it is fine
  4. D. No linked list representation of tree is only fine
Report Error

What is the space complexity of the in-order traversal in the recursive fashion? (d is the tree depth and n is the number of nodes)

  1. A. O(1)
  2. B. O(nlogd)
  3. C. O(logd)
  4. D. O(d)
Report Error

In a Binary Search Tree (BST), what does the term "node height" refer to?

  1. A. The number of edges from the node to its deepest descendant.
  2. B. The number of nodes in the subtree.
  3. C. The number of edges from the node to its parent.
  4. D. The total number of nodes in the tree.
Report Error

How do you handle duplicate values in a Binary Search Tree (BST) if duplicates are allowed?

  1. A. Insert duplicates into the right subtree or use a counter at each node.
  2. B. Insert duplicates into the left subtree.
  3. C. Store duplicates in a separate data structure.
  4. D. Ignore duplicate values.
Report Error

What is the result of an inorder traversal of a Binary Search Tree (BST)?

  1. A. Nodes are visited in ascending order.
  2. B. Nodes are visited in descending order.
  3. C. Nodes are visited in the order of their depth.
  4. D. Nodes are visited in the order they are inserted.
Report Error

What is the typical use case for a Binary Search Tree (BST) in computing?

  1. A. To implement dynamic sets and lookup tables.
  2. B. To perform sorting operations.
  3. C. To manage hierarchical data.
  4. D. To implement priority queues.
Report Error

In a Binary Search Tree (BST), how can you find the depth of a particular node?

  1. A. By counting the number of edges from the root to the node.
  2. B. By counting the number of nodes in the subtree.
  3. C. By finding the height of the tree.
  4. D. By counting the number of children of the node.
Report Error

Which property is true for a Binary Search Tree (BST) that is also a perfect binary tree?

  1. A. All levels are fully filled, and all leaves are at the same level.
  2. B. The height of the tree is minimal.
  3. C. The tree contains only leaf nodes.
  4. D. All nodes have exactly two children.
Report Error

What happens if a Binary Search Tree (BST) becomes unbalanced due to insertions or deletions?

  1. A. Search, insertion, and deletion operations may degrade to O(n) time complexity.
  2. B. The tree automatically rebalances itself.
  3. C. The tree converts into a binary heap.
  4. D. The tree becomes a complete binary tree.
Report Error

In a BST, how do you identify the maximum value node?

  1. A. By traversing to the rightmost node from the root.
  2. B. By traversing to the leftmost node from the root.
  3. C. By finding the root node.
  4. D. By searching the entire tree.
Report Error

What is the minimum number of nodes required to form a Binary Search Tree (BST) of height h?

  1. A. 2 h - 1
  2. B. 2 (h+1) - 1
  3. C. 2 (h)
  4. D. 2 h
Report Error

In a Binary Search Tree (BST), which of the following is true for any node's left subtree?

  1. A. All nodes in the left subtree are smaller than the node itself.
  2. B. All nodes in the left subtree are larger than the node itself.
  3. C. The left subtree contains nodes with equal values.
  4. D. The left subtree is always empty.
Report Error