Data Structure MCQ - Tree
This section focuses on the "Tree" of the Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. The no of external nodes in a full binary tree with n internal nodes is?
A. n
B. n+1
C. 2n
D. 2n + 1
View Answer
Ans : B
Explanation: The no of external nodes in a full binary tree with n internal nodes is n+1.
2. Which of the following is a true about Binary Trees?
A. Every binary tree is either complete or full.
B. Every complete binary tree is also a full binary tree.
C. Every full binary tree is also a complete binary tree.
D. No binary tree is both complete and full.
E. None of the above
View Answer
Ans : E
Explanation: A full binary tree (sometimes proper binary tree or 2-tree or strictly binary tree) is a tree in which every node other than the leaves has two children. A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible. A) is incorrect.
3. A Binary Tree can have
A. Can have 2 children
B. Can have 1 children
C. Can have 0 children
D. All of the above
View Answer
Ans : D
Explanation: A Binary Tree can have 0, 1, 2 children
4.Which of the following is not an advantage of trees?
A. Hierarchical structure
B. Faster search
C. Router algorithms
D. Undo/Redo operations in a notepad
View Answer
Ans : D
Explanation: This is an application of stack.
5.The difference between the external path length and the internal path length of a binary tree with n internal nodes is?
A. 1
B. n
C. n + 1
D. 2n
View Answer
Ans : D
Explanation:The difference between the external path length and the internal path length of a binary tree with n internal nodes is 2n.
6. In a complete k-ary tree, every internal node has exactly k children or no child. The number of leaves in such a tree with n internal nodes is:
A. nk
B. (n – 1) k+ 1
C. n( k – 1) + 1
D. n(k – 1)
View Answer
Ans : C
Explanation: For an k-ary tree where each node has k children or no children, following relation holds L = (k-1)*n + 1 Where L is the number of leaf nodes and n is the number of internal nodes.
7.Height of Height of a binary tree is
A. MAX( Height of left Subtree, Height of right subtree)+1
B. MAX( Height of left Subtree, Height of right subtree)
C. MAX( Height of left Subtree, Height of right subtree)-1
D. None of the above
View Answer
Ans : A
Explanation: Height of Height of a binary tree is MAX( Height of left Subtree, Height of right subtree)+1.
8. Which of the following options is an application of splay trees ?
A. cache Implementation
B. networks
C. send values
D. receive values
View Answer
Ans : A
Explanation: Splay trees can be used for faster access to recently accessed items and hence used for cache implementations.
9. Suppose a complete binary tree has height h>0. The minimum no of leaf nodes possible in term of h is?
A. 2h -1
B. 2h -1 + 1
C. 2h -1
D. 2h +1
View Answer
Ans : C
Explanation: Suppose a complete binary tree has height h>0. The minimum no of leaf nodes possible in term of h is 2h -1.
10. A weight-balanced tree is a binary tree in which for each node. 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 n nodes is best described by which of the following?
A. log2 n
B. log4/3 n
C. log3 n
D. log3/2 n
View Answer
Ans : D
Explanation:No Explanation.
Also Check :
Discussion