What is printed by the print statements in program P1, assuming…

GATE · 2001 · CS · Question 2 subparts

What is printed by the print statements in program P1, assuming call-by-reference parameter passing?

Program P1()
{
x = 10;
y = 3;
func1(y, x, x);
print x;
print y;
}

func1(x, y, z)
{
y = y + 4;
z = x + y + z;
}

  1. A.

    10, 3

  2. B.

    31, 3

  3. C.

    27, 7

  4. D.

    None of the above

Attempted by 31 students.

Show answer

Correct answer: B

The worked solution is available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…