Q. What will be the output of the following code?
int x = 5;
cout << (x << 1);
int x = 5;
cout << (x << 1);
β
Correct Answer: (A)
10
Explanation: The left shift operator (<<) shifts bits to the left, effectively multiplying by 2. So, 5 << 1 results in 10.