A

Admin • 833K Points
Coach

Q. What is the output of the following C++ code?

int a = 7;
cout << a >> 1;

  • (A) 14
  • (B) 3
  • (C) 7
  • (D) 1
  • Correct Answer - Option(B)
  • Views: 20
  • Filed under category C++
  • Hashtags:

Explanation by: Admin

The '>>' operator is the right shift operator. Shifting 7 by 1 bit results in 3.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.