What will be the output of the following? int a = 5;
What will be the output of the following?
int a = 5;
cout << "FIRST" << (a<<2) << "SECOND";
Show answerHide answer
Correct answer: (B) FIRST 20 SECOND
Explanation
a << 2 shifts 5 (101) left by two bits, giving 10100 = 20, which is the same as 5 × 4. The output is FIRST20SECOND.