Similar questions 4 more →
Functions & Parameter Passing



Answer & solution
Answer: point 1: 5 5; point 2: 10 10; point 3: 10. (no official key was published)
A reference parameter is another name for the caller's variable, not a private copy of its value. Here the actual parameter is the global b, so a and b designate the same storage throughout test1. Initially that cell contains 3. Executing a:=5 updates the cell itself, which means both a and b now read as 5. Consequently the first output is point 1: 5 5.
Next test2 executes b:=10. It refers to the global b by the displayed lexical scope; this is the same cell already aliased by a. Therefore both reads at the second output produce 10, giving point 2: 10 10. Returning from test1 requires no copy-back for a reference parameter. The global value remains 10, and the final output is point 3: 10.
The important reasoning is storage identity: a:=5 changes b immediately, and test2's assignment to b changes what a observes immediately. The procedure nesting does not create a second b or hide the global declaration. Spaces and line breaks may depend on Pascal's output formatting; the value sequences, in order, are (5,5), (10,10), and (10).