Note: For sub-questions 7.1 to 7.3, refer to the PASCAL program shown below.…

GATE · 1993 · CS · Question 7 subpartsModified — 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 n, output by the program PARAM is:

  1. A.

    0, because n is the actual parameter corresponding to x in procedure Q.

  2. B.

    0, because n is the actual parameter to y in procedure Q.

  3. C.

    1, because n is the actual parameter corresponding to x in procedure Q.

  4. D.

    1, because n is the actual parameter corresponding to y in procedure Q.

  5. E.

    none of the above

Attempted by 4 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…