Binary Tree Operations MCQs

Binary Tree Operations MCQs

 Q1. What is the traversal strategy used in the binary tree?. 
A. depth-first traversal. 
B. breadth-first traversal. 
C. random traversal. 
D. preorder traversal. 
Answer= breadth-first traversal

Q2. How many types of insertion are performed in a binary tree?. 
A. 1. 
B. 2. 
C. 3. 
D. 4. 
Answer= 2

Q3. General ordered tree can be encoded into binary trees.. 
A. TRUE. 
B. FALSE. 
C.  Nothing can be said. 
D.  None of the mentioned. 
Answer= TRUE

Q4. How many bits would a succinct binary tree occupy?. 
A. n+O(n). 
B. 2n+O(n). 
C. n/2. 
D. n. 
Answer= 2n+O(n)

Q5. The average depth of a binary tree is given as?. 
A. O(N). 
B. O(√N). 
C. O(N2). 
D. O(log N). 
Answer= O(log N)

Q6. How many orders of traversal can be applied to a binary tree?. 
A. 1. 
B. 4. 
C. 2. 
D. 3. 
Answer= 3

Q7. If binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i?. 
A. 2i+1. 
B. 2i+2. 
C. 2i. 
D. 4i. 
Answer= 2i+1

Q8. Using what formula can a parent node be located in an array?. 
A. (i+1)/2. 
B. (i-1)/2. 
C. i/2. 
D. 2i/2. 
Answer= (i-1)/2

Q9. What is the time complexity of pre-order traversal in the iterative fashion?. 
A. O(1). 
B. O(n). 
C. O(logn). 
D. O(nlogn). 
Answer= O(n)

Q10. What is the space complexity of the post-order traversal in the recursive fashion? (d is the tree depth and n is the number of nodes). 
A. O(1). 
B. O(nlogd). 
C. O(logd). 
D. O(d). 
Answer= O(d)

Q11. To obtain a prefix expression, which of the tree traversals is used?. 
A. Level-order traversal. 
B. Pre-order traversal. 
C. Post-order traversal. 
D. In-order traversal. 
Answer= Pre-order traversal

Q12. In postorder traversal of binary tree right subtree is traversed before visiting root.. 
A. TRUE. 
B. FALSE. 
C.  Nothing Can be said. 
D.  None of the mentioned. 
Answer= TRUE

Q13. What is the possible number of binary trees that can be created with 3 nodes, giving the sequence N, M, L when traversed in post-order.. 
A. 15. 
B. 3. 
C. 5. 
D. 8. 
Answer= 5

Q14. The post-order traversal of a binary tree is O P Q R S T. Then possible pre-order traversal will be ________. 
A. T Q R S O P. 
B. T O Q R P S. 
C. T Q O P S R. 
D. T Q O S P R. 
Answer= T Q O P S R

Q15. Which one of the following is a valid post-order sequence of the tree provided the pre-order sequence as 35, 13, 7, 8, 26, 70, 40 and 75?. 
A. 7, 8, 26, 13, 75, 40, 70, 35. 
B. 26, 13, 7, 8, 70, 75, 40, 35. 
C. 7, 8, 13, 26, 35, 40, 70, 75. 
D. 8, 7, 26, 13, 40, 75, 70, 35. 
Answer= 8, 7, 26, 13, 40, 75, 70, 35

Q16. Which of the following pair's traversals on a binary tree can build the tree uniquely?. 
A. post-order and pre-order. 
B. post-order and in-order. 
C. post-order and level order. 
D. level order and preorder. 
Answer= post-order and in-order

Q17. A full binary tree can be generated using ______. 
A. post-order and pre-order traversal. 
B. pre-order traversal. 
C. post-order traversal. 
D. in-order traversal. 
Answer= post-order and pre-order traversal

Q18. The maximum number of nodes in a tree for which post-order and pre-order traversals may be equal is ______. 
A. 3. 
B. 1. 
C. 2. 
D. any number. 
Answer= 1

Q19. The steps for finding post-order traversal are traverse the right subtree, traverse the left subtree or visit the current node.. 
A. TRUE. 
B. FALSE. 
C.  Nothing Can be said. 
D.  None of the mentioned. 
Answer= FALSE

Q20. The pre-order and in-order are traversals of a binary tree are T M L N P O Q and L M N T O P Q. Which of following is post-order traversal of the tree?. 
A. L N M O Q P T. 
B. N M O P O L T. 
C. L M N O P Q T. 
D. O P L M N Q T. 
Answer= L N M O Q P T

Q21. For a binary tree the first node visited in in-order and post-order traversal is same.. 
A. TRUE. 
B. FALSE. 
C.  Nothing Can be said. 
D.  None of the mentioned. 
Answer= FALSE

Q22. To implement a stack using queue(with only enqueue and dequeue operations), how many queues will you need?. 
A. 1. 
B. 2. 
C. 3. 
D. 4. 
Answer= 2

Q23. What is the space complexity of the in-order traversal in the recursive fashion? (d is the tree depth and n is the number of nodes). 
A. O(1). 
B. O(nlogd). 
C. O(logd). 
D. O(d). 
Answer= O(d)

Q24. What is the time complexity of level order traversal?. 
A. O(1). 
B. O(n). 
C. O(logn). 
D. O(nlogn). 
Answer= O(n)

Q25. Which of the following graph traversals closely imitates level order traversal of a binary tree?. 
A. Depth First Search. 
B. Breadth First Search. 
C. Depth & Breadth First Search. 
D. None of the mentioned. 
Answer= Breadth First Search

Q26. In a binary search tree, which of the following traversals would print the numbers in the ascending order?. 
A. Level-order traversal. 
B. Pre-order traversal. 
C. Post-order traversal. 
D. In-order traversal. 
Answer= In-order traversal

Q27. The number of edges from the root to the node is called __________ of the tree.. 
A. Height. 
B. Depth. 
C. Length. 
D. None of the mentioned. 
Answer= Depth

Q28. The number of edges from the node to the deepest leaf is called _________ of the tree.. 
A. Height. 
B. Depth. 
C. Length. 
D. None of the mentioned. 
Answer= Height

Q29. What is a full binary tree?. 
A. Each node has exactly zero or two children. 
B. Each node has exactly two children. 
C. All the leaves are at the same level. 
D. Each node has exactly one or two children. 
Answer= Each node has exactly zero or two children

Previous Post Next Post