Object Oriented Programming

1:

 

int a =1 , b=2;

a=chg(b) ;

cout << a << b ;

If the function chg is coded as


int chg(int &x)
{

x = 10;

return ();

}

then   Functions

A.

it results in compile-time error

B.

it results in run time error

C.

it prints 112

D.

it prints 111 0

 

Answer : D

Explanation :

Here the parameter passing mechanism is pass by reference. Any change done to the parameter will be reflected outside the function. So, the value of b, after the exit of the function will be 10.

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.