Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int i, j;
6.
j = 10;
7.
i = (j++, j + 100, 999 + j);
8.
cout
Options:
A .  1000
B .  11
C .  1010
D .  1001
Answer: Option C

:j starts with the value 10. j is then incremented to 11. Next, j is added to 100. Finally, j 

(still containing 11) is added to 999 which yields the result 1010.
Output:
$ g++ op2.cpp
$ a.out
1010



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers