Difficulty: Medium
Correct Answer: 10 10
Explanation:
Introduction / Context: This exercise tests understanding of default arguments, pass-by-value, and chained assignments with compound operators. It asks you to follow exact state changes inside Apply and then print two members using Display.
Given Data / Assumptions:
Concept / Approach: Carefully evaluate compound assignments which both change the left-hand operand and yield a value. Keep track of x and y after each statement to determine what Display prints.
Step-by-Step Solution:
Entry to Apply: xx = 12, yy = 0, zz = 20.x = xx → x = 12.y = yy += 10 → yy becomes 10 (locally) and y receives 10.z = x -= 2 → x becomes 10 and z receives 10.Display prints x and y → "10 10".Verification / Alternative check: Rewriting as yy = yy + 10; y = yy; x = x - 2; z = x; confirms the same final member values.
Why Other Options Are Wrong:
Common Pitfalls: Thinking yy += 10 returns the old value, or assuming parameters are references; both lead to incorrect y values.
Final Answer: 10 10
Discussion & Comments