Gate CS-2016-1 Question Paper With Solutions

Q. 46 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);}

(A) 6, 2

(B) 6, 6

(C) 4, 2

(D) 4, 4

Answer: (D)

Explanation:

Gate CS-2016-1 Question Paper With Solutions

Gate CS-2016-1 Question Paper With Solutions

Learn More:   Gate CS-2016-2 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here