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

int x = 10;
cout << ++x;

  • (A) 9
  • (B) 10
  • (C) 11
  • (D) Compilation error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 11
Explanation: '++x' is a pre-increment, so the value of 'x' is incremented first and then printed, resulting in 11.
Explanation by: Vijay Sangwan
'++x' is a pre-increment, so the value of 'x' is incremented first and then printed, resulting in 11.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
225
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Vijay Sangwan
Publisher
πŸ“ˆ
93%
Success Rate