Data Structures MCQs with Answers
Practice important Data Structures MCQs with answers and explanations.
Multiple Choice Questions
Q451: In a threaded binary tree, what modification is made to identify leaf nodes differently?
- A: Adding additional nodes
- B: Replacing NULL pointers with threads
- C: Doubling the number of nodes
- D: Changing node data
View Answer
B
Q452: What is the purpose of the nextInorder routine in a threaded binary tree?
- A: To find the inorder successor
- B: To find the inorder predecessor
- C: To find the postorder successor
- D: To find the preorder predecessor
View Answer
A
Q453: What is the role of the dummy node in the fastInorder routine?
- A: To simplify the traversal logic
- B: To store extra data
- C: To represent a null pointer
- D: To store tree structure
View Answer
A
Q454: What does the nextInorder function return when the right pointer is a thread?
- A: The right child of the node
- B: The left child of the node
- C: The inorder successor
- D: The root node
View Answer
C
Q455: In a complete binary tree, how is the position of a node's left child determined in an array?
- A: 2 * i
- B: i + 1
- C: 2 * i + 1
- D: i * 2 + 1
View Answer
A
Q456: How do you find the parent of a node in a complete binary tree stored in an array?
- A: floor(i / 2)
- B: 2 * i
- C: i / 2
- D: 2 * (i + 1)
View Answer
A
Q457: What is the characteristic of a complete binary tree?
- A: All levels are fully filled except possibly the last
- B: All levels are completely filled including the last
- C: Only the last level is filled from left to right
- D: The tree is balanced
View Answer
A
Q458: How many nodes can a complete binary tree of height h have at most?
- A: 2^h + 1 - 1
- B: 2^(h+1) - 1
- C: 2^h
- D: 2^(h+1)
View Answer
B
Q459: What is the traversal order when using the fastInorder routine?
- A: Inorder
- B: Preorder
- C: Postorder
- D: Level-order
View Answer
A
Q460: Why does the fastInorder routine use a dummy node?
- A: To manage the traversal at the root node
- B: To handle nodes with no children
- C: To ensure correct inorder traversal without recursion
- D: To optimize memory usage
View Answer
C