We have the best collection of Weight Balanced Tree MCQs and answer with FREE PDF. These Weight Balanced Tree MCQs will help you to prepare for any competitive exams like: BCA, MCA, GATE, GRE, IES, PSC, UGC NET, DOEACC Exams at all levels – you just have to practice regularly.
Weight Balanced Tree MCQs
1. The size value of various nodes in a weight balanced tree are
leaf – zero
internal node – size of it’s two children
is this true?
a) true
b) false
Answer: true
2. What does the below definations convey?
i. A binary tree is balanced if for every node it is gonna hold that the number of inner nodes in the left subtree and the number of inner nodes in the right subtree differ by at most 1.
ii. A binary tree is balanced if for any two leaves the difference of the depth is at most 1.
a) weight balanced and height balanced tree definations
b) height balanced and weight balanced tree definations
c) definations of weight balanced tree
d) definations of height balanced tree
Answer: weight balanced and height balanced tree definations
3. Elements in a tree can be indexed by its position under the ordering of the keys and the ordinal position of an element can be determined, both with good efficiency.
a) true
b) false
Answer: true
4. Why the below pseudo code where x is a value, wt is weight factor and t is root node can’t insert?
WeightBalanceTreeNode insert(int x, int wt, WeightBalanceTreeNode k) :
if (k == null)
k = new WeightBalanceTreeNode(x, wt, null, null)
else if (x < t.element) :
k.left = insert (x, wt, k.left)
if (k.left.weight < k.weight)
k = rotateWithRightChild (k)
else if (x > t.element) :
k.right = insert (x, wt, k.right)
if (k.right.weight < k.weight)
k = rotateWithLeftChild (k)
a) when x>t. element Rotate-with-left-child should take place and vice versa
b) the logic is incorrect
c) the condition for rotating children is wrong
d) insertion cannot be performed in weight balanced trees
Answer: when x>t. element Rotate-with-left-child should take place and vice versa
5. What is the condition for a tree to be weight balanced. where a is factor and n is a node?
a) weight[n.left] >= a*weight[n] and weight[n.right] >= a*weight[n].
b) weight[n.left] >= a*weight[n.right] and weight[n.right] >= a*weight[n].
c) weight[n.left] >= a*weight[n.left] and weight[n.right] >= a*weight[n].
d) weight[n] is a non zero
Answer: weight[n.left] >= a*weight[n] and weight[n.right] >= a*weight[n].
6. What are the operations that can be performed on weight balanced tree?
a) all basic operations and set intersection, set union and subset test
b) all basic operations
c) set intersection, set union and subset test
d) only insertion and deletion
Answer: all basic operations and set intersection, set union and subset test
7. What is a weight balanced tree?
a) A binary tree that stores the sizes of subtrees in nodes
b) A binary tree with an additional attribute of weight
c) A height balanced binary tree
d) A normal binary tree
Answer: A binary tree that stores the sizes of subtrees in nodes
8. What are the applications of weight balanced tree?
a) dynamic sets, dictionaries, sequences, maps
b) heaps
c) sorting
d) storing strings
Answer: dynamic sets, dictionaries, sequences, maps
9. A node of the weight balanced tree has
a) key, left and right pointers, size
b) key, value
c) key, size
d) key
Answer: key, left and right pointers, size
10. Consider a weight balanced tree such that, the number of nodes in the left sub tree is at least half and at most twice the number of nodes in the right sub tree. The maximum possible height (number of nodes on the path from the root to the farthest leaf) of such a tree on k nodes can be described as
a) log2 n
b) log4/3 n
c) log3 n
d) log3/2 n
Answer: log3/2 n