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.

Cartesian trees solve range minimum query problem in constant time.

  1. A. true
  2. B. false
Report Error

How many children does a binary tree have?

  1. A. 2
  2. B. any number of children
  3. C. 0 or 1 or 2
  4. D. 0 or 1
Report Error

Select the code snippet which performs post-order traversal.

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

A binary tree is a rooted tree but not an ordered tree.

  1. A. true
  2. B. false
Report Error

Given an empty AVL tree, how would you construct AVL tree when a set of numbers are given without performing any rotations?

  1. A. just build the tree with the given input
  2. B. find the median of the set of elements given, make it as root and construct the tree
  3. C. use trial and error
  4. D. use dynamic programming to build the tree
Report Error

What is the condition for a tree to be weight balanced. where a is factor and n is a node?

  1. A. weight[n.left] >= a*weight[n] and weight[n.right] >= a*weight[n].
  2. B. weight[n.left] >= a*weight[n.right] and weight[n.right] >= a*weight[n].
  3. C. weight[n.left] >= a*weight[n.left] and weight[n.right] >= a*weight[n].
  4. D. weight[n] is a non zero
Report Error

Which of the following options is an application of splay trees?

  1. A. cache Implementation
  2. B. networks
  3. C. send values
  4. D. receive values
Report Error

What is the longest length path for a node x in random binary search tree for the insertion process?

  1. A. log x
  2. B. x 2
  3. C. x!
  4. D. 4.311 log x
Report Error

What is the condition for priority of a node in a treap?

  1. A. a node's priority should be greater than its parent
  2. B. a node's priority should be at least as large as its parent
  3. C. the priority is randomly assigned and can have any value
  4. D. a node's priority is always given in decreasing order
Report Error

Which algorithm is used in the top tree data structure?

  1. A. Divide and Conquer
  2. B. Greedy
  3. C. Backtracking
  4. D. Branch
Report Error

AVL trees are more balanced than Red-black trees.

  1. A. True
  2. B. False
Report Error

Why is heap implemented using array representations than tree(linked list) representations though both tree representations and heaps have same complexities? for binary heap -insert: O(log n) -delete min: O(log n) for a tree -insert: O(log n) -delete: O(log n) Then why go with array representation when both are having same values ?

  1. A. arrays can store trees which are complete and heaps are not complete
  2. B. lists representation takes more memory hence memory efficiency is less and go with arrays and arrays have better caching
  3. C. lists have better caching
  4. D. In lists insertion and deletion is difficult
Report Error