Similar questions 4 more →
Functions & Parameter Passing



Answer & solution
Answer: 2 (no official key was published)
At entry the actual expression a+b is evaluated to 5. Call by value creates three independent local cells x=5, y=2 and z=2. The first assignment changes only local y from 2 to 3. The second computes local z=x+x=10. Neither assignment writes caller a; the local cells disappear when P returns. Hence caller a remains 2 and print(a) outputs 2. The two occurrences of actual a do not create aliases in call by value.