Difficulty: Easy
Correct Answer: The program will print the output 100 100.
Explanation:
Introduction / Context:
This question demonstrates aliasing of reference parameters: both a and b reference the same caller variable, so writing through one reference affects the value seen through the other in the same call.
Given Data / Assumptions:
Concept / Approach:
Because a and b alias the same object, after a = 100, both a and b read back as 100. The object stores those copies into x and y and then prints them.
Step-by-Step Solution:
Verification / Alternative check:
If b were a distinct variable, the second value would reflect the original b instead.
Why Other Options Are Wrong:
"100 10" would require b to remain 10, but b aliases the mutated variable.
Common Pitfalls:
Assuming parameters are evaluated independently when they are the same lvalue bound via references.
Final Answer:
The program will print the output 100 100.
Discussion & Comments