Difficulty: Medium
Correct Answer: 1 4 India
Explanation:
Introduction / Context:
This question tests understanding of params arrays, object boxing, ToString behavior, and loop bounds. The program prints selected elements of an object[] using a for loop that stops before the last element.
Given Data / Assumptions:
Concept / Approach:
For a double like 4.0, default ToString with the general format produces "4" rather than "4.0" in most cultures. Strings are written as they are. Because the loop excludes the final index, only the first three elements are output.
Step-by-Step Solution:
Verification / Alternative check:
Manually evaluate ToString outputs and loop bounds or run a quick console test.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming the loop reaches the last element or that 4.0 prints as "4.0".
Final Answer:
1 4 India
Discussion & Comments