Skip to main content

Data Structures MCQs with Answers

Practice important Data Structures MCQs with answers and explanations.

Multiple Choice Questions

Q351: After an insertion operation, if an AVL tree node has a balance factor of -2 and its right child has a balance factor of 1, which rotation is performed?
  • A: Left rotation
  • B: Right rotation
  • C: Left-Right rotation
  • D: Right-Left rotation
View Answer
D

Q352: When inserting node 3 into a tree where node 1 is the root and node 2 is its right child, what will be the new root if rotations are needed?
  • A: Node 1
  • B: Node 2
  • C: Node 3
  • D: Node 2 becomes root
View Answer
B

Q353: What does the AVL tree balance condition ensure after any insertion or deletion?
  • A: Nodes are always sorted
  • B: The tree remains balanced
  • C: All nodes have the same height
  • D: The tree is completely balanced
View Answer
B

Q354: In AVL trees, which node rearrangement is necessary when inserting a new node causes imbalance?
  • A: No rearrangement is needed
  • B: Only swapping node values
  • C: Rotation of nodes
  • D: Deletion of nodes
View Answer
C

Q355: What is the height of the right subtree of node 5 in the given AVL tree example if node 7 is the deepest node?
  • A: 2
  • B: 3
  • C: 1
  • D: 4
View Answer
A

Q356: What is the primary goal of balancing an AVL tree?
  • A: To ensure faster searching
  • B: To minimize memory usage
  • C: To maintain a balanced height
  • D: To reduce tree depth
View Answer
C

Q357: After inserting the number 4 in the AVL tree shown in Fig 21.3, which node requires rotation?
  • A: Node 1
  • B: Node 3
  • C: Node 2
  • D: Node 4
View Answer
C

Q358: In Fig 21.5, what is the new root node after performing the rotation?
  • A: Node 2
  • B: Node 3
  • C: Node 4
  • D: Node 5
View Answer
C

Q359: What is the result of the inorder traversal of the AVL tree after inserting nodes 1 to 7?
  • A: 1 2 3 4 5 6 7
  • B: 1 2 3 4 5 6
  • C: 1 3 2 4 5 6 7
  • D: 1 2 4 3 5 6 7
View Answer
A

Q360: Which node's insertion leads to case 1 rotation?
  • A: Insertion in the right subtree of the left child of α
  • B: Insertion in the left subtree of the right child of α
  • C: Insertion in the right subtree of the right child of α
  • D: Insertion in the left subtree of the left child of α
View Answer
D

Test Your Knowledge

Take a timed quiz on Data Structures

🚀 Start Quiz Now