UGC NET CS 2016Theory of Computation and Compilers › Run Time SystemVerified
UGC NET CS 2016 PYQ: Assume that the program $‘P’$ is implementing parameter passing with ‘call by reference’. What will be…
Assume that the program $‘P’$ is implementing parameter passing with ‘call by reference’. What will be printed by following print statements in $P$?
Program P
{
x=10;
y=3;
funb(y,x,x)
print x;
print y;
}
funb (x,y,z)
{
y=y+4;
z=x+y+z;
}- A10, 7
- B31, 3Correct answer
- C10, 3
- D31, 7
Answer
(B) 31, 3
Approach
Trace aliasing under call by reference.
Reviewed by UGC IQ Editorial Team.