Note: For sub-questions 7.1 to 7.3, refer to the PASCAL program shown below.…
PYQ GATE 1993Modified — slightly modified from the official paper; see the solution
Note: For sub-questions 7.1 to 7.3, refer to the PASCAL program shown below.
Program PARAM (input, output);
var m, n : integer;
procedure P (var x, y : integer);
var m : integer;
begin
m := 1;
x := y + 1
end;
procedure Q (x:integer; var y : integer);
begin
x:=y+1;
end;
begin
m:=0; P(m,m); write (m);
n:=0; Q(n*1,n); write (n)
end
The value of m, output by the program PARAM is:
- A.
1, because m is a local variable in P
- B.
0, because m is the actual parameter that corresponds to the formal parameter in P
- C.
0, because both x and y are just reference to m, and y has the value 0
- D.
1, because both x and y are just references to m which gets modified in procedure P
- E.
none of the above
Attempted by 38 students.
Sign up free to check your answer
Sign up freeLoading lesson…

