Bird
0
0

Identify the problem in this code:

medium📝 Debug Q7 of 15
C - onditional Statements
Identify the problem in this code:
int x = 10;
if (x > 5)
printf("Big");
printf("Done");
AMissing semicolon after if
BVariable x not initialized
CSyntax error due to missing braces
DBoth printf statements run regardless of condition
Step-by-Step Solution
Solution:
  1. Step 1: Understand if without braces

    Only the first statement after if runs conditionally.
  2. Step 2: Analyze printf statements

    Second printf runs always, so both print statements run regardless.
  3. Final Answer:

    Both printf statements run regardless of condition -> Option D
  4. Quick Check:

    If without braces affects only next statement [OK]
Quick Trick: Without braces, only one statement is conditional [OK]
Common Mistakes:
  • Assuming both statements are conditional
  • Missing semicolon errors
  • Confusing variable initialization

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes