Discrete Mathematics | Binary Search Trees MCQs

Discrete Mathematics | Binary Search Trees MCQs: This section contains multiple-choice questions and answers on Binary Search Trees in Discrete Mathematics.
Submitted by Anushree Goswami, on October 23, 2022

1. Unlike binary search trees, binary search trees contain ____ values at the left and smaller values at the right?

  1. Larger
  2. Smaller
  3. Equal
  4. None

Answer: A) Larger

Explanation:

Unlike binary search trees, binary search trees contain larger values at the left and smaller values at the right.


2. Binary search trees do not have to refer to nodes whose value immediately ____ and follows it?

  1. Exceeds
  2. Precedes
  3. Changes
  4. Adds

Answer: B) Precedes

Explanation:

Binary search trees do not have to refer to nodes whose value immediately precedes and follows it.


3. Which of the following statement is TRUE to insert into a Binary Search Tree?

  1. Identify the root node by comparing the ITEM with it.
  2. In the event that ITEM>ROOT NODE, move to the right child, which becomes the root node for the right subtree.
  3. If ITEM<ROOT NODE is present, proceed to the left child.
  4. All of the above

Answer: D) All of the above

Explanation:

The following statements are TRUE to insert into a bInary Search Tree -

  1. Identify the root node by comparing the ITEM with it.
  2. In the event that ITEM>ROOT NODE, move to the right child, which becomes the root node for the right subtree.
  3. If ITEM<ROOT NODE is present, proceed to the left child.

4. The ITEM is inserted as the ____ child of the node if its value is greater than the node, and as the ____ child if its value is less than the node?

  1. Right, Left
  2. Left, Right
  3. Right, Root
  4. Root, Left

Answer: A) Right, Left

Explanation:

The ITEM is inserted as the right child of the node if its value is greater than the node, and as the left child if its value is less than the node.


5. Depending on the number of children of the deleted node, there are ____ ways to delete an ITEM from a binary search tree?

  1. Two
  2. Three
  3. Four
  4. Multiple

Answer: B) Three

Explanation:

Depending on the number of children of the deleted node, there are three ways to delete an ITEM from a binary search tree.


6. Which is the correct way to delete an ITEM from a binary search tree?

  1. Deleted Node has no children
  2. Deleted Node has Only one child
  3. Deletion node has only two children
  4. All of the above

Answer: D) All of the above

Explanation:

The correct way to delete an ITEM from a binary search tree is-

  1. Deleted Node has no children
  2. Deleted Node has Only one child
  3. Deletion node has only two children

7. Nodes with no children can be deleted by replacing them with ___, which is very simple to do?

  1. Nodes
  2. Null
  3. Endpoints
  4. Edges

Answer: B) Null

Explanation:

Nodes with no children can be deleted by replacing them with null, which is very simple to do.


8. Replace the deleted node with the node whose value is ____to that of the deleted node if the deletion node only has two children?

  1. Farthest
  2. Behind
  3. Closest
  4. Infinite

Answer: C) Closest

Explanation:

Replace the deleted node with the node whose value is closest to that of the deleted node if the deletion node only has two children.


9. Our goal is to find the nearest value, so we move left first, then right as far as possible. The node nearest to us is called the ____?

  1. Farthest Predecessor
  2. Nearest Predecessor
  3. Closest Predecessor
  4. Immediate Predecessor

Answer: D) Immediate Predecessor

Explanation:

Our goal is to find the nearest value, so we move left first, then right as far as possible. The node nearest to us is called the immediate predecessor.


10. The ____element of the root node should be replaced with the root node to delete it?

  1. Farthest
  2. Infinite
  3. Closest
  4. None

Answer: C) Closest

Explanation:

The closest element of the root node should be replaced with the root node to delete it.





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.