CommerceBinary Search TreesB Tree MCQs
Practice Binary Search TreesB Tree MCQs for competitive exams.
Binary Search TreesB Tree MCQs
Practice questions from this topic.
Why do we impose restrictions like . root property is black . every leaf is black . children of red node are black . all leaves have same black
- A. to get logarithm time complexity
- B. to get linear time complexity
- C. to get exponential time complexity
- D. to get constant time complexity
Correct Answer: A
What are null nodes filled with in a threaded binary tree?
- A. inorder predecessor for left node and inorder successor for right node information
- B. right node with inorder predecessor and left node with inorder successor information
- C. they remain null
- D. some other values randomly
Correct Answer: A
Self - balancing binary search trees have a much better average-case time complexity than hash tables.
- A. True
- B. False
Correct Answer: B
If the tree is not a complete binary tree then what changes can be made for easy access of children of a node in the array?
- A. every node stores data saying which of its children exist in the array
- B. no need of any changes continue with 2w and 2w+1, if node is at i
- C. keep a seperate table telling children of a node
- D. use another array parallel to the array with tree
Correct Answer: A
What is the time complexity of level order traversal?
- A. O(1)
- B. O(n)
- C. O(logn)
- D. O(nlogn)
Correct Answer: B
What is the time complexity for creating a new node and then performing concatenation in the rope data structure?
- A. O (log n)
- B. O (n!)
- C. O (n 2 )
- D. O (1)
Correct Answer: D
For the tree below, write the pre-order traversal.
- A. 2, 7, 2, 6, 5, 11, 5, 9, 4
- B. 2, 7, 5, 2, 6, 9, 5, 11, 4
- C. 2, 5, 11, 6, 7, 4, 9, 5, 2
- D. 2, 7, 5, 6, 11, 2, 5, 4, 9
Correct Answer: A
Is partitioning method used by Tango Tree.
- A. True
- B. False
Correct Answer: A
What is the maximum number of children that a binary tree node can have?
- A. 0
- B. 1
- C. 2
- D. 3
Correct Answer: C
What must be the missing logic below so as to print mirror of a tree as below as an example? if(rootnode): mirror(rootnode-->left) mirror(rootnode-->right) //missing end
- A. swapping of left and right nodes is missing
- B. swapping of left with root nodes is missing
- C. swapping of right with root nodes is missing
- D. nothing is missing
Correct Answer: A
Which of the following trees is similar to that of an AA-Tree?
- A. Splay Tree
- B. B+ Tree
- C. AVL Tree
- D. Red-Black Tree
Correct Answer: D
What does the following piece of code do? public void func(Tree root) { func(root.left()); func(root.right()); System.out.println(root.data()); }
- A. Preorder traversal
- B. Inorder traversal
- C. Postorder traversal
- D. Level order traversal
Correct Answer: C