Skip to main content

Data Structures MCQs with Answers

Practice important Data Structures MCQs with answers and explanations.

Multiple Choice Questions

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
View Answer
A

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
View Answer
C

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
View Answer
B

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
View Answer
C

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
View Answer
B

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
View Answer
A

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
View Answer
A

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
View Answer
A

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
View Answer
C

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
View Answer
B

Test Your Knowledge

Take a timed quiz on Data Structures

🚀 Start Quiz Now