πŸ“Š C++
Q. What will be the output of the following code?

int x = 5;
cout << (x << 1);
  • (A) 10
  • (B) 5
  • (C) 2
  • (D) Compilation Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) 10

Explanation: The left shift operator (<<) shifts bits to the left, effectively multiplying by 2. So, 5 << 1 results in 10.

Explanation by: Priyanka Tomar
The left shift operator (<<) shifts bits to the left, effectively multiplying by 2. So, 5 << 1 results in 10.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
94
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Priyanka Tomar
Publisher
πŸ“ˆ
93%
Success Rate