ProgrammingModerateTCS NQT · Infosys
int a = 7; printf("%d", a++ > 7); What is printed?
- A. 0
- B. 1
- C. 7
- D. 8
Correct answer: A. 0
a++ yields the old value 7, and 7 > 7 is false, so the program prints 0. The increment takes effect after the comparison operand is read.
More C Programming questions
- For an int, what is the value of ~5 + 1?
- int x = 12; x = x ^ (x >> 2); What is x?
- Six people stand in a circle numbered 1 to 6; starting from 1, every second person is removed until one remains. Which number survives?…
- Seven people stand in a circle numbered 1 to 7. Starting from person 1, every third person is removed until one remains. Which number…
- unsigned char a = 200, b = 100; unsigned char c = a + b; printf("%d", c); What is printed?
- In C99 and later, what are the values of (-7) / 2 and (-7) % 2?