Compare two passing modes

Each table row represents a fresh, independent run of this pseudocode with caller variable x initially equal to 4. The symbol := means assignment. Use the passing mode stated in that row. Complete the final caller value and the parameter value immediately before the procedure returns. Enter exact integers.


pseudocode
procedure transform(p):
    p := p + 2
    p := 3 * p

transform(x)
Passing modeFinal caller xFinal parameter p
By value
By reference

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Parameter Passing Questions: