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    

A.

it results in compile-time error

B.

it results in run time error

C.

it prints 112

D.

it prints 111 

 

Answer : C

Explanation :

Here the default parameter passing mechanism of pass by value will be used. Any change done to the parameter will not be reflected outside the function. So, b retains its value 2.

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.