C++ output type question
Q. C++: Trace the output
void execute (int x, int y = 200)
{
Int temp = x + y;
x +=temp;
if (y!= 200)
cout << temp << ” ” << x << ” ” << y << ” ” << endl;
}
void main ( )
{
int a = 50, b = 20;
execute (b);
cout << a << ” ” << b << ” ” << endl;
execute (a, b);
}
- Published on 19 Oct 15a.
2202050
50 20
b.
50 20
70 120 20
c. 20 200
d. None of the above.
ANSWER:
50 20
70 120 20