Question: program MAIN; var i : integer; var a : array[1, 2, 3, 4] of integer; subprogram SUBPROG(x : integer); {a[i]++; x++; i++; a[i] := 3;
program MAIN; var i : integer; var a : array[1, 2, 3, 4] of integer;
subprogram SUBPROG(x : integer); {a[i]++; x++; i++; a[i] := 3; i++; a[i] := a[i+1] + x; i++; x++;} (endSUBPROG)
{a[1] := 2; a[2] := 1; a[3] := 2; a[4] := 1; i := 1; call SUBPROG(a[i]); print(a[1..4]);} (endMAIN)
NOTE: Assume that all uninitialized variables have the value zero. Assume that addresses for pass by result parameters are bound at the time of call.
What is the program output assuming that the parameters are passed by value?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
