Question 37Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 1 (9:00 AM)

What will be the output of the following code? int main() {

What will be the output of the following code? #include <stdio.h> int main() { int a = 10, b = 20; int max = (a > b) ? a : b; printf("%d", max); return 0; }
  1. A30
  2. Bcompile time error
  3. C10
  4. D20
Show answerHide answer

Correct answer: (D) 20

Explanation

a > b (10 > 20) is false, so the conditional operator returns b, and 20 is printed.

From DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 1 (9:00 AM)

This is question 37 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 1 (9:00 AM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.