Classical

Object Oriented Programming - Find Output

11:  

The following program
void abc (int &p)
{
cout  << p ;
}
void main (void)
{
float m = 1.23;
abc (m) ;
cout << m;
}        

A.

results in compilation error

B.

results in run time error

C.

prints 1. 23

D.

prints I

 
 

Option: A

Explanation :


12:  

What is the output of the following c++ program?
void abc (int x = 0, int y = 0)
{
cout << "Hi There";
}
void abc (int x)
{
cout  << "How are you doing today ? " ;
}
void main (void)
(
int m = 5;
abc (m) ;
}    

A.

Hi There

B.

How R U doing today?

C.

What gets printed depends on how the particular compiler is implemented

D.

It results in compilation error

 
 

Option: D

Explanation :

The call abc ( ) matches with the signatures - void abc (int x = 0, int y = 0) and void abc (int x). The compiler cannot unambiguously resolve this conflict. So it complains.




Suggest an improvement