Bird
0
0

Which of the following is the correct syntax for a do-while loop in C?

easy📝 Syntax Q3 of 15
C - Loops
Which of the following is the correct syntax for a do-while loop in C?
Ado while (condition) { /* code */ };
Bdo { /* code */ } while (condition);
Cdo { /* code */ } until (condition);
Ddo ( /* code */ ) while condition;
Step-by-Step Solution
Solution:
  1. Step 1: Recall do-while syntax

    The correct syntax uses do { ... } while (condition); with braces and semicolon.
  2. Step 2: Check each option

    Only do { /* code */ } while (condition); matches the correct syntax exactly.
  3. Final Answer:

    do { /* code */ } while (condition); -> Option B
  4. Quick Check:

    Do-while syntax = do { } while (condition); [OK]
Quick Trick: Do-while ends with semicolon after condition [OK]
Common Mistakes:
  • Missing semicolon after while condition
  • Using parentheses instead of braces
  • Wrong keywords like 'until'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes