Object Oriented Programming

1:

The statements
int a = 5;
cout << "FIRST" << (a <<2) << "SECOND";
outputs 

A.

FIRST52SECOND

B.

FIRST20SECOND

C.

SECOND25FIRST

D.

an error message

 

Answer : B

Explanation :

The symbol <<  has a context sensitive meaning. The <<  in (a << 2) means shifting a by 2 bits to the left, which is nothing but multiplying it by 4. So, a < <2 will be 5 x 4 = 20 and hence the output will be FIRST20SECOND.

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.