Insertion MCQ Quiz - Objective Question with Answer for Insertion - Download Free PDF
Last updated on Jun 25, 2025
Latest Insertion MCQ Objective Questions
Insertion Question 1:
Suppose a binary search tree has been constructed from the following sequence of numbers in the order in which they arrive : 6, 2, 10, 1, 5, 7, 11, 3, 9, 4, 8. Consider the following piece of code :
Show(root) { if (root !=NULL)
{ printf(“% d”, root → key);
show (root → right);
show (root → left);
}
else
return ;
}
The sequence printed will be :
Answer (Detailed Solution Below)
Insertion Question 1 Detailed Solution
The correct answer is: Option 3
Key Points
- We are given a sequence of numbers to build a Binary Search Tree (BST): 6, 2, 10, 1, 5, 7, 11, 3, 9, 4, 8
- The function
Show(root)
performs a non-standard traversal:- Visit Root
- Traverse Right Subtree
- Traverse Left Subtree
Step-by-step construction of BST:
- Insert 6 → root
- 2 goes to left of 6
- 10 to right of 6
- 1 to left of 2
- 5 to right of 2
- 7 to left of 10
- 11 to right of 10
- 3 to left of 5
- 9 to right of 7
- 4 to right of 3
- 8 to left of 9
Traversal Output (Root → Right → Left):
6, 10, 11, 7, 9, 8, 2, 5, 3, 4, 1
Therefore, the correct option is: Option 3.
Top Insertion MCQ Objective Questions
Suppose a binary search tree has been constructed from the following sequence of numbers in the order in which they arrive : 6, 2, 10, 1, 5, 7, 11, 3, 9, 4, 8. Consider the following piece of code :
Show(root) { if (root !=NULL)
{ printf(“% d”, root → key);
show (root → right);
show (root → left);
}
else
return ;
}
The sequence printed will be :
Answer (Detailed Solution Below)
Insertion Question 2 Detailed Solution
Download Solution PDFThe correct answer is: Option 3
Key Points
- We are given a sequence of numbers to build a Binary Search Tree (BST): 6, 2, 10, 1, 5, 7, 11, 3, 9, 4, 8
- The function
Show(root)
performs a non-standard traversal:- Visit Root
- Traverse Right Subtree
- Traverse Left Subtree
Step-by-step construction of BST:
- Insert 6 → root
- 2 goes to left of 6
- 10 to right of 6
- 1 to left of 2
- 5 to right of 2
- 7 to left of 10
- 11 to right of 10
- 3 to left of 5
- 9 to right of 7
- 4 to right of 3
- 8 to left of 9
Traversal Output (Root → Right → Left):
6, 10, 11, 7, 9, 8, 2, 5, 3, 4, 1
Therefore, the correct option is: Option 3.
Insertion Question 3:
Suppose a binary search tree has been constructed from the following sequence of numbers in the order in which they arrive : 6, 2, 10, 1, 5, 7, 11, 3, 9, 4, 8. Consider the following piece of code :
Show(root) { if (root !=NULL)
{ printf(“% d”, root → key);
show (root → right);
show (root → left);
}
else
return ;
}
The sequence printed will be :
Answer (Detailed Solution Below)
Insertion Question 3 Detailed Solution
The correct answer is: Option 3
Key Points
- We are given a sequence of numbers to build a Binary Search Tree (BST): 6, 2, 10, 1, 5, 7, 11, 3, 9, 4, 8
- The function
Show(root)
performs a non-standard traversal:- Visit Root
- Traverse Right Subtree
- Traverse Left Subtree
Step-by-step construction of BST:
- Insert 6 → root
- 2 goes to left of 6
- 10 to right of 6
- 1 to left of 2
- 5 to right of 2
- 7 to left of 10
- 11 to right of 10
- 3 to left of 5
- 9 to right of 7
- 4 to right of 3
- 8 to left of 9
Traversal Output (Root → Right → Left):
6, 10, 11, 7, 9, 8, 2, 5, 3, 4, 1
Therefore, the correct option is: Option 3.