Question 33Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

What will be printed by the following code? int main() {

What will be printed by the following code? #include<stdio.h> int main() { int marks = 75; char grade = (marks >= 90) ? 'A' : (marks >= 70) ? 'B' : 'C'; printf("%c", grade); return 0; }
  1. AB
  2. BCompile time error
  3. CA
  4. DC
Show answerHide answer

Correct answer: (A) B

Explanation

75 >= 90 is false, so the second condition is checked: 75 >= 70 is true, so grade is 'B'.

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

This is question 33 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 2 (1:00 PM). 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.