ProgrammingHardTCS NQT · Infosys
printf("%d %d", 1 < 2 < 3, 3 > 2 > 1); What is printed?
- A. 1 0
- B. 1 1
- C. 0 1
- D. 0 0
Correct answer: A. 1 0
Relational operators associate left to right: (1 < 2) < 3 is 1 < 3, which is 1, and (3 > 2) > 1 is 1 > 1, which is 0.
More C Programming questions
- What does printf("%d", -5 % 3) print?
- double x = 7 / 2 2.0; printf("%g", x); What is printed?
- unsigned char c = 0x0F; printf("%d", (unsigned char)~c); What is printed?
- int i = 0; if (0 && i++) ; if (1 || i++) ; printf("%d", i); What is printed?
- unsigned char a = 255; printf("%d", a == -1); What is printed?
- long long x = 1000000LL 1000000; What is x?