Difficulty: Easy
Correct Answer: 25, 4
Explanation:
Introduction / Context:
This tests basic C pointer usage with pass-by-address. When you pass addresses and dereference inside the callee, you can modify the caller’s variables directly.
Given Data / Assumptions:
Concept / Approach:
Since the function parameters are pointers, *i and *j refer to the original variables. Reassigning them updates the caller’s variables.
Step-by-Step Solution:
Before call: i = 5, j = 2.Inside fun: *i = *i * *i → 25 and *j = *j * *j → 4.After fun returns, i is 25 and j is 4.Printed output: “25, 4”.
Verification / Alternative check:
Replacing pointer parameters with return values would require returning two values (e.g., via a struct). Pointers allow both updates in one call.
Why Other Options Are Wrong:
“5, 2” reflects no change. “10, 4” incorrectly squares only one operand. “2, 5” swaps and changes meaning. “25, 2” squares only i.
Common Pitfalls:
Forgetting to pass addresses; confusing *i * *i with dereferencing precedence (it is simply the product of the dereferenced value with itself).
Final Answer:
25, 4
Discussion & Comments