Bird
0
0

What will be the output of the following C code?

medium📝 Predict Output Q13 of 15
C - Operators and Expressions
What will be the output of the following C code?
int a = 5, b = 10;
if (a > b) {
    printf("True\n");
} else {
    printf("False\n");
}
ATrue
B5
CFalse
D10
Step-by-Step Solution
Solution:
  1. Step 1: Evaluate the relational expression a > b

    Variable a is 5 and b is 10. Since 5 is not greater than 10, the expression a > b is false.
  2. Step 2: Determine which branch executes

    Because the condition is false, the else block runs, printing "False".
  3. Final Answer:

    False -> Option C
  4. Quick Check:

    5 > 10 = false [OK]
Quick Trick: Compare values carefully; 5 > 10 is false [OK]
Common Mistakes:
  • Assuming 5 > 10 is true
  • Confusing else and if blocks
  • Ignoring relational operator meaning

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes