Runtime Environments & Parameter Passing


Select all that apply
Answer & solution
Answer: B: 0 (no official key was published)
The actual n*1 is evaluated to zero and copied into value parameter x. Parameter y is a reference to n. The assignment computes y+1=1 but writes only the local copy x; it never assigns to y. Thus n remains zero and the caller prints zero. Calling with an expression as the first actual is valid precisely because that parameter has value semantics; a reference formal would require a suitable variable location instead.