What will be the output of the following pseudo-code when parameters are…

GATE · 2016 · CS · Set 1 · Computer Science & IT

What will be the output of the following pseudo-code when parameters are passed by reference and dynamic scoping is assumed?

a = 3;
void n(x) { x = x * a; print(x); }
void m(y) { a = 1; a = y - a; n(a); print(a); }
void main() { m(a); }
  1. A.

    6, 2

  2. B.

    6, 6

  3. C.

    4, 2

  4. D.

    4, 4

Attempted by 178 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…