Q. What will be the output of the following code?

int a = 5;
cout << ++a;

  • (A) 5
  • (B) 6
  • (C) Error
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (B) 6
Explanation: The '++a' is a pre-increment operator, which increments the value of 'a' before it is used, so the output is 6.
Explanation by: Vijay Sangwan
The '++a' is a pre-increment operator, which increments the value of 'a' before it is used, so the output is 6.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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