Gate CS-2001 Question Paper With Solutions

Q. 42 What is printed by the print statements in the 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;
}

(A) 10, 3

(B) 31, 3

(C) 27, 7

(D) None of the above

Answer: (B)

Explanation:

Gate CS-2001 Question Paper With Solutions

Learn More:   Gate CS-2015-1 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here