Find Output Q.4

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

  • Option : 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.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *