Object Oriented Programming

1:

 

int a =1 , b=2;

a=chg(b) ;

cout << a << b ;

If the function chg is coded as


int chg(const 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 : A

Explanation :

Here the function chg tries to change the parameter x, which is not allowed as it is declared to be a constant integer. So, the compiler gives an error.

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.