Data Structures MCQs with Answers
Practice important Data Structures MCQs with answers and explanations.
Multiple Choice Questions
Q361: What type of rotation is used to fix case 4?
- A: Single right rotation
- B: Single left rotation
- C: Double right rotation
- D: Double left rotation
View Answer
B
Q362: What does an AVL tree ensure about its balance factor?
- A: It must be exactly zero for all nodes
- B: It must be between 0 and 1 for all nodes
- C: It must be between -1 and 1 for all nodes
- D: It must be exactly -1 for all nodes
View Answer
C
Q363: How does AVL tree balance differ from Binary Search Tree (BST) balance?
- A: AVL tree maintains balance through rotations, BST does not
- B: AVL tree requires all nodes to be balanced, BST does not
- C: AVL tree can become unbalanced, BST always remains balanced
- D: AVL tree ensures root remains the same, BST does not
View Answer
A
Q364: Which case requires a double rotation to balance the AVL tree?
- A: Case 1
- B: Case 2
- C: Case 3
- D: Case 4
View Answer
B
Q365: What is the result of inserting node 7 into the AVL tree shown in Fig 21.8?
- A: Tree becomes unbalanced
- B: Tree becomes perfectly balanced
- C: Tree requires no rotations
- D: Tree requires a single right rotation
View Answer
B
Q366: Which node will become the new root after rotating the AVL tree in Fig 21.7?
- A: Node 2
- B: Node 3
- C: Node 4
- D: Node 5
View Answer
C
Q367: How many levels can a node be searched in an AVL tree of height n?
- A: 1.44 log₂n levels
- B: 2 log₂n levels
- C: 1 log₂n levels
- D: log₂n levels
View Answer
A
Q368: What happens to the inorder traversal of an AVL tree after performing rotations?
- A: It changes
- B: It becomes more balanced
- C: It remains the same
- D: It becomes less balanced
View Answer
C
Q369: In case 3 of rotation, where is the insertion made?
- A: Right subtree of the right child of α
- B: Left subtree of the right child of α
- C: Right subtree of the left child of α
- D: Left subtree of the left child of α
View Answer
B
Q370: What type of insertion requires double rotation in AVL trees?
- A: Outside insertion
- B: Inside insertion
- C: Both types of insertions
- D: None of the above
View Answer
B