MCQ On Tree Data Structures
MCQ On Tree Data Structures
lOMoARcPSD|3768221
1. The height of a BST is given as h. Consider the height of the tree as the no. of
edges in the longest path from root to the leaf. The maximum no. of nodes possible
in the tree is?
a) 2h-1 -1
b) 2h+1 -1
c) 2h +1
d) 2h-1 +1
ANSWER: b) 2h+1 -1
2. 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
ANSWER: b) n+1
3. 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
ANSWER: d) 2n
4. Suppose a binary tree is constructed with n nodes, such that each node has
exactly either zero or two children. The maximum height of the tree will be?
a) (n+1)/2
b) (n-1)/2
c) n/2 -1
d) (n+1)/2 -1
ANSWER: b) (n-1)/2
6. Suppose we have numbers between 1 and 1000 in a binary search tree and want
to search for the number 363. Which of the following sequence could not be the
sequence of the node examined?
7. In full binary search tree every internal node has exactly two children. If there
are 100 leaf nodes in the tree, how many internal nodes are there in the tree?
a) 25
b) 49
c) 99
d) 101
ANSWER: c) 99
8. Which type of traversal of binary search tree outputs the value in sorted order?
a) Pre-order
b) In-order
c) Post-order
d) None
ANSWER: b) In-order
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
ANSWER: c) 2h -1
10. If a node having two children is to be deleted from binary search tree, it is
replaced by its
lOMoARcPSD|3768221
a) In-order predecessor
b) In-order successor
c) Pre-order predecessor
d) None
11. A binary search tree is formed from the sequence 6, 9, 1, 2, 7, 14, 12, 3, 8, 18. The
minimum number of nodes required to be added in to this tree to form an
extended binary tree is?
a) 3
b) 6
c) 8
d) 11
ANSWER: d) 11
12. In a full binary tree, every internal node has exactly two children. A full binary
tree with 2n+1 nodes contains
a) n leaf node
b) n internal nodes
c) n-1 leaf nodes
d) n-1 internal nodes
13. the run time for traversing all the nodes of a binary search tree with n nodes
and printing them in an order is
a) O(nlg(n))
b) O(n)
c) O(√n)
d) O(log(n))
ANSWER: b) O(n)
14. When a binary tree is converted in to an extended binary tree, all the nodes of
a binary tree in the external node becomes
a) Internal nodes
b) External nodes
c) Root nodes
d) None
a) Binary tree
b) Binary search tree
c) Max-heap
d) Min-heap
ANSWER: d) Min-heap
16. If n elements are sorted in a binary search tree. What would be the
asymptotic complexity to search a key in the tree?
a) O(1)
b) O(logn)
c) O(n)
d) O(nlogn)
ANSWER: c) O(n)
17. If n elements are sorted in a balanced binary search tree. What would be
the asymptotic complexity to search a key in the tree?
a) O(1)
b) O(logn)
c) O(n)
d) O(nlogn)
ANSWER: b) O(logn)
18. A threaded binary tree is a binary tree in which every node that does not have right
child has a thread to its
a) Pre-order successor
b) In-order successor
c) In-order predecessor
d) Post-order successor
19. In which of the following tree, parent node has a key value greater than or equal
to the key value of both of its children?
ANSWER: d) Max-heap
20. A binary tree T has n leaf nodes. The number of nodes of degree 2 in T is
a) log2n
b) n-1
c) n
d) 2n
ANSWER: b) n-1
21. A binary search tree is generated by inserting in order the following integers:
50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24
The number of the node in the left sub-tree and right sub-tree of the root, respectively, is
a) (4, 7)
b) (7, 4)
c) (8, 3)
d) (3, 8)
ANSWER: b) (7, 4)
22. The post order traversal of binary tree is DEBFCA. Find out the pre
order traversal.
A. ABFCDE
B. ADBFEC
C. ABDECF
D. ABDCEF
Answer: C. ABDECF
23. While converting binary tree into extended binary tree, all the original nodes
in binary tree are .......
24. The in-order traversal of tree will yield a sorted listing of elements of tree in ........
A. binary trees
C. heaps
D. binary heaps
25. In a binary tree, certain null entries are replaced by special pointers which point
to nodes higher in the tree for efficiency. These special pointers are called .........
A. Leaf
B. Branch
C. Path
D. Thread
Answer: D. Thread
27. A binary tree whose every node has either zero or two children is called .........
D. E2 tree
28. If every node u in G is adjacent to every other node v in G,A graph is said
to be ........
A. isolated
B. complete
C. finite
D. strongly connected.
Answer: B. complete
A. endpoints of e
B. adjacent nodes
C. neighbours
A. FAEKCDBHG
B. FAEKCDHGB
C. EAFKHDCBG
D. FEAKDCHBG
Answer: B. FAEKCDHGB
A. a tree graph
lOMoARcPSD|3768221
B. free tree
C. a tree
D. All of above
32. In linked representation of Binary trees LEFT[k] contains the.........of at the node
N, where k is the location.
A. Data
D. Null value
Answer: A. Data
A. isolated
B. complete
C. finite
D. strongly connected
Answer: B. complete
34. Three standards ways of traversing a binary tree T with root R .......
A. Info
B. Root
lOMoARcPSD|3768221
C. Threads
D. Child
Answer: C. Threads
A. Tagged
B. Marked
C. Lebeled
D. Sticked
Answer: C. Lebeled
38. What is the maximum height of any AVL-tree with 7 nodes? Assume that the
height of a tree with a single node is 0.
A. 2
B. 3
C. 4
D. 5
Answer: 3
Answer: a
i. ii.
a) only i
b) only i and ii
c) only ii
d) none of the mentioned
Answer: b) AVL tree store balance factor in every node which costs space
Answer: All
A. ABC*+D+
B. AB+CD+*
C. ABCD++*
D. None
Answer: B) A B + C D + *
Answer: B) 1 → C, 2 → B, 3 →
47. The operation of processing each element in the list is known as ......
A. sorting
B. merging
C. inserting
D. traversal
Answer: D. traversal
A. Direct graph
B. Digraph
C. Dir-graph
D. Digraph
Answer: B. Digraph
A. Threaded trees
B. Pointer trees
C. Special trees
50. Graph G is...............if for any pair u, v of nodes in G there is a path from u to v or path
from v to u.
A. Leterally connected
B. Widely Connected
C. Unliterally connected
D. Literally connected
A. End nodes
B. Terminal nodes
C. Final nodes
D. Last nodes
A. free graph
B. no cycle graph
D. circular graph
53. Trees are said...........if they are similar and have same contents at corresponding nodes.
A. Duplicate
B. Carbon copy
lOMoARcPSD|3768221
C. Replica
D. Copies
Answer: D. Copies
A. A tree graph
B. Free tree
C. A tree d
55. Every node N in a binary tree T except the root has a unique parent called the..........of
N.
A. Antecedents
B. Predecessor
C. Forerunner
D. Precursor
Answer: B. Predecessor
D. both b and c
A. Overflow
B. Underflow
C. Empty
D. Full
Answer: C. Empty
59. A binary tree whose every node has either zero or two children is called .......
D. data structure
A. 4
B. 2
C. 3
D. 5
Answer: C. 3
A. Dn = n log2n
B. Dn= n log2n+1
C. Dn = log2n
D. Dn = log2n+1
Answer: D. Dn = log2n+1
A. Interior node
B. Domestic node
C. Internal node
D. Inner node
A. Root
B. Leaf
C. Child
D. Branch
Answer: B. Leaf
complexity
All the above formations are incorrect for it to be a redblack tree. then what may be the
correct order?
a) 50-black root, 18-red left subtree, 100-red right subtree
b) 50-red root, 18-red left subtree, 100-red right subtree
c) 50-black root, 18-black left subtree, 100-red right subtree
d) 50-black root, 18-red left subtree, 100-black right subtree
67. What are the operations that could be performed in O(logn) time complexity by
red- black tree?
a) insertion, deletion, finding predecessor, successor
b) only insertion
c) only finding predecessor, successor
d) for sorting
68. When it would be optimal to prefer Red-black trees over AVL trees?
a) when there are more insertions or deletions
b) when more search is needed
c) when tree must be balanced
d) when log(nodes) time complexity is needed
lOMoARcPSD|3768221
69. Why Red-black trees are preferred over hash tables though hash tables have
constant time complexity?
a) no they are not preferred
b) because of resizing issues of hash table and better ordering in redblack trees
c) because they can be implemented using trees
d) because they are balanced
Answer: b) because of resizing issues of hash table and better ordering in redblack trees
70. When to choose Red-Black tree, AVL tree and B-trees?
a) many inserts, many searches and when managing more items respectively
b) many searches, when managing more items respectively and many inserts respectively
c) sorting, sorting and retrieval respectively
d) retrieval, sorting and retrieval respectively
Answer: a) many inserts, many searches and when managing more items respectively