MCQ Bank
If there are N internal nodes in a binary tree then what will be the no. of external nodes in this binary tree?
- A) N+2
- B) N-1
- C) N
- D) N+1
In Huffman character codes, letters with higher frequencies have _______ code(s).
- A) Shorter
- B) Not less than 4 bits
- C) Not more than 1 bit
- D) Larger
Which of the following is a property of binary tree?
- A) A binary tree of N external nodes has N+ 1 internal node.
- B) A binary tree of N internal nodes has N- 1 external node.
- C) A binary tree of N internal nodes has N+ 1 external node.
- D) A binary tree of N external nodes has N internal node.
Consider a max heap, represented by the following array:
40,30,20,10,15,16,17,8,4
After inserting a node with value 35.Which of the following is the updated max heap?
- A) 40,35,20,10,15,16,17,8,4,30
- B) 40,30,20,10,15,16,17,8,4,35
- C) 40,30,20,10,35,16,17,8,4,15
- D) 40,35,20,10,30,16,17,8,4,15
In threaded binary tree, the NULL pointers are replaced by the
- A) NULL pointers are not replaced
- B) postorder successor or predecessor
- C) inorder successor or predecessor
- D) preorder successor or predecessor
By using __________we avoid the recursive method of traversing a Tree, which makes use of stacks and consumes a lot of memory and time.
- A) Heap data structure
- B) Binary tree only
- C) Threaded binary tree
- D) Huffman encoding
Consider a min heap, represented by the following array:
10,30,20,60,40,50,80,70
After inserting a node with value 31.Which of the following is the updated min heap?
- A) 10,30,20,31,40,50,80,70,60
- B) 10,30,20,31,40,50,80,60,70
- C) 31,10,30,20,70,40,50,80,60
- D) 10,30,20,70,40,50,80,60,31
Consider a max heap, represented by the following array:
40,30,20,10,15,16,17,8,4
Which of the following is the index of the parent of node 15?
- A) 1
- B) 2
- C) 3
- D) 0
When a complete binary tree represented by an array then if right child is at position 5 then left child will be at position _____
- A) 3
- B) 4
- C) 2
- D) 6
Which of the following statement is true about dummy node of threaded binary tree?
- A) The left pointer of dummy node points to the itself while the right pointer points to the root of tree.
- B) The left pointer of dummy node points to the root node of the tree while the right pointer points itself i.e. to dummy node.
- C) The right pointer of dummy node points to the itself while the left pointer is always NULL.
- D) The left pointer of dummy node points to the root node of the tree while the right pointer is always NULL.
Which one of the following is TRUE about iteration?
- A) Recursion is more efficient than iteration
- B) Iteration extensively uses stack memory
- C) Threaded Binary Trees use the concept of iteration
- D) Iterative function calls consumes a lot of memory
For the inorder traversal of threaded binary tree, we introduced a dummy node. The left pointer of the dummy node is pointing to the ________ node of the tree.
- A) root
- B) right most
- C) any of the given node
- D) left most
Consider a max heap, represented by the following array:
40,30,20,10,15,16,17,8,4
Which of the following is the parent of node 17?
- A) 20
- B) 40
- C) 30
- D) 16
A complete binary tree is a tree that is _________ filled, with the possible exception of the bottom level.
- A) completely
- B) partially
- C) partly
- D) incompletely
If an expression tree is correct then its root should have,
- A) (
- B) an operand
- C) an operator
- D) )
Consider a min heap, represented by the following array:
3,4,6,7,5,10
After inserting a node with value 1. Which of the following is the updated min heap?
- A) 3,4,6,7,5,1,10
- B) 1,4,3,7,5,10,6
- C) 1,4,6,7,5,10,3
- D) 3,4,6,7,5,10,1
To develop a character encoding scheme in Huffman tree, _______ will be assigned to left branch.
- A) 1
- B) -1
- C) 1 and 0
- D) 0
If there are 56 internal nodes in a binary tree then how many external nodes this binary tree will have?
- A) 56
- B) 55
- C) 57
- D) 54
Which of the following heap method increase the value of key at position ‘p’ by the amount ‘delta’?
- A) decreaseKey(p,delta)
- B) increaseKey(p,delta)
- C) percolateDown(p,delta)
- D) remove(p,delta)
See the below code and fill the appropriate answer for ? sign.
void fastInorder(TreeNode* p)
{
while((p=nexInorder(p)) != ? )
cout << p->getInfo();
}
- A) RTH
- B) LTH
- C) dummy
- D) rootNode