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.

In a full binary tree if number of internal nodes is I, then number of leaves L are?

  1. A. L = 2*I
  2. B. L = I + 1
  3. C. L = I - 1
  4. D. L = 2*I - 1
Report Error

Find the postorder traversal of the binary tree shown below.

  1. A. P Q R S T U V W X
  2. B. W R S Q P V T U X
  3. C. S W T Q X U V R P
  4. D. S T W U X V Q R P
Report Error

What is the special property of red-black trees and what root should always be?

  1. A. a color which is either red or black and root should always be black color only
  2. B. height of the tree
  3. C. pointer to next node
  4. D. a color which is either green or black
Report Error

To obtain a prefix expression, which of the tree traversals is used?

  1. A. Level-order traversal
  2. B. Pre-order traversal
  3. C. Post-order traversal
  4. D. In-order traversal
Report Error

What is a Cartesian tree?

  1. A. a skip list in the form of tree
  2. B. a tree which obeys cartesian product
  3. C. a tree which obeys heap property and whose inorder traversal yields the given sequence
  4. D. a tree which obeys heap property only
Report Error

What output does the below pseudo code produces? Tree_node function(Tree_node x) { Tree_node y = x.left; x.left = y.right; y.right = x; return y; }

  1. A. right rotation of subtree
  2. B. left rotation of subtree
  3. C. zig-zag operation
  4. D. zig-zig operation
Report Error

A self - balancing binary search tree can be used to implement . . . . . . . .

  1. A. Priority queue
  2. B. Hash table
  3. C. Heap sort
  4. D. Priority queue and Heap sort
Report Error

Why to prefer red-black trees over AVL trees?

  1. A. Because red-black is more rigidly balanced
  2. B. AVL tree store balance factor in every node which costs space
  3. C. AVL tree fails at scale
  4. D. Red black is more efficient
Report Error

What is the priority of a null node?

  1. A. 1
  2. B. 0
  3. C. random number
  4. D. infinity
Report Error

Select the code snippet which performs in-order traversal.

  1. A. public void inorder(Tree root) { System.out.println(root.data); inorder(root.left); inorder(root.right); }
  2. B. public void inorder(Tree root) { inorder(root.left); System.out.println(root.data); inorder(root.right); }
  3. C. public void inorder(Tree root) { System.out.println(root.data); inorder(root.right); inorder(root.left); }
  4. D. public void inorder(Tree root) { inorder(root.right); inorder(root.left); System.out.println(root.data); }
Report Error

What is the worst case analysis of an AA-Tree?

  1. A. O(N)
  2. B. O(log N)
  3. C. O( N log N)
  4. D. O(N 2 )
Report Error

Which of the following is an application of Red-black trees and why?

  1. A. used to store strings efficiently
  2. B. used to store integers efficiently
  3. C. can be used in process schedulers, maps, sets
  4. D. for efficient sorting
Report Error