Data Structures MCQs with Answers
Practice important Data Structures MCQs with answers and explanations.
Multiple Choice Questions
Q381: What is the main purpose of single right rotation in an AVL tree?
- A: Increase the height of the tree
- B: Balance the tree after deletion
- C: Rebalance the tree after insertion
- D: Improve tree traversal efficiency
View Answer
C
Q382: What is the first step in the single right rotation process?
- A: Set the new root node
- B: Set the left child of k2 to k1's right
- C: Set the right child of k1 to k2
- D: Set k2 as right child of k1
View Answer
B
Q383: After a single right rotation, which node becomes the new root?
- A: k1
- B: k2
- C: k3
- D: k4
View Answer
B
Q384: In single left rotation, which node becomes the new root?
- A: k1
- B: k2
- C: k3
- D: k4
View Answer
B
Q385: What is the purpose of the height function in AVL tree rotations?
- A: Calculate tree depth
- B: Set node height based on subtrees
- C: Update node height after rotation
- D: Rebalance the tree
View Answer
C
Q386: Which rotation is performed first in a double right-left rotation?
- A: Single right rotation
- B: Single left rotation
- C: Double right rotation
- D: Double left rotation
View Answer
A
Q387: In a double left-right rotation, which rotation is applied first?
- A: Single left rotation
- B: Single right rotation
- C: Double left-right rotation
- D: Double right-left rotation
View Answer
A
Q388: When deleting a node from an AVL tree, how many rotations might be needed in the worst case?
- A: 1
- B: log2 N
- C: N
- D: 2
View Answer
B
Q389: What is the primary reason for needing multiple rotations during deletion in an AVL tree?
- A: To improve search efficiency
- B: To rebalance the tree
- C: To increase the tree height
- D: To reduce tree nodes
View Answer
B
Q390: In the deletion process of an AVL tree, what is the maximum number of rotations needed?
- A: log2 N
- B: 1
- C: 2
- D: 3
View Answer
A