Skip to main content

Data Structures MCQs with Answers

Practice important Data Structures MCQs with answers and explanations.

Chapter: 27
Q441:
What is the primary goal of using a threaded binary tree?
A. To make traversal faster
B. To reduce memory usage
C. To simplify tree construction
D. To increase recursion depth
Correct Answer: A
Chapter: 27
Q442:
In a threaded binary tree, what is the replacement for NULL pointers?
A. Pointers to child nodes
B. Pointers to sibling nodes
C. Pointers to inorder successor
D. Pointers to parent nodes
Correct Answer: C
Chapter: 27
Q443:
Which data structure helps in speeding up inorder traversal without using recursion?
A. Binary tree
B. Threaded binary tree
C. Linked list
D. Stack
Correct Answer: B
Chapter: 27
Q444:
How do threaded binary trees improve traversal performance?
A. By using a stack
B. By using recursion
C. By replacing NULL pointers with threads
D. By doubling the tree's size
Correct Answer: C
Chapter: 27
Q445:
When inserting a node into a threaded binary tree, what does the code t->L = p->L accomplish?
A. Copies the thread
B. Copies the left pointer from node p
C. Attaches the new node to the right
D. Sets the left thread flag
Correct Answer: B
Chapter: 27
Q446:
What does the t->RTH = thread line of code do when adding a new node to a threaded binary tree?
A. Sets the right thread flag
B. Sets the right pointer to NULL
C. Copies the thread from node p
D. Sets the left pointer to child
Correct Answer: A
Chapter: 27
Q447:
In the code snippet for inserting a new node, what does p->LTH = child indicate?
A. The left pointer is a child node
B. The left pointer is a thread
C. The right pointer is a child node
D. The right pointer is a thread
Correct Answer: A
Chapter: 27
Q448:
How is the inorder successor found in a threaded binary tree if the RTH flag is not set?
A. By following the right pointer
B. By using the left pointer
C. By traversing to the rightmost node
D. By traversing to the leftmost node
Correct Answer: A
Chapter: 27
Q449:
What is a primary advantage of threaded binary trees compared to normal binary trees?
A. They are simpler to construct
B. They use more memory
C. They provide faster traversal
D. They have fewer nodes
Correct Answer: C
Chapter: 27
Q450:
What problem occurs when the nextInorder routine is called with the root node?
A. It fails to find any node
B. It goes to the right subtree
C. It does not reach the leftmost node
D. It leads to an infinite loop
Correct Answer: B
Chapter: 27
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
Correct Answer: B
Chapter: 28
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
Correct Answer: A
Chapter: 28
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
Correct Answer: A
Chapter: 28
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
Correct Answer: C
Chapter: 28
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
Correct Answer: A
Chapter: 28
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)
Correct Answer: A
Chapter: 28
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
Correct Answer: A
Chapter: 28
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)
Correct Answer: B
Chapter: 28
Q459:
What is the traversal order when using the fastInorder routine?
A. Inorder
B. Preorder
C. Postorder
D. Level-order
Correct Answer: A
Chapter: 28
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
Correct Answer: C

Test Your Knowledge

Take a timed quiz on Data Structures

🚀 Start Quiz Now