C - LoopsWhich of the following correctly demonstrates a nested while loop structure in C?Awhile(i < 3) { while(j < 2) { /* code */ } }Bwhile(i < 3); while(j < 2) { /* code */ }Cwhile(i < 3) { j < 2; /* code */ }Dwhile(i < 3) { while(j < 2); /* code */ }Check Answer
Step-by-Step SolutionSolution:Step 1: Understand nested loopsA nested loop means one loop inside another, both properly structured.Step 2: Analyze optionswhile(i < 3) { while(j < 2) { /* code */ } } correctly nests one while loop inside another with braces.Step 3: Identify incorrect syntaxOptions B, C, and D misuse semicolons or lack proper braces, breaking the loop structure.Final Answer:while(i < 3) { while(j < 2) { /* code */ } } -> Option AQuick Check:Proper nesting requires braces and no stray semicolons [OK]Quick Trick: Nested loops need braces and no stray semicolons [OK]Common Mistakes:Using semicolon immediately after while conditionMissing braces for nested loopsIncorrect loop body placement
Master "Loops" in C9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More C Quizzes C Basics and Execution Environment - Why C is widely used - Quiz 14medium Conditional Statements - Why conditional logic is needed - Quiz 1easy Input and Output - Using scanf for input - Quiz 2easy Loop Control Statements - Return inside loops - Quiz 3easy Loop Control Statements - Continue statement - Quiz 13medium Loop Control Statements - Why loop control is required - Quiz 7medium Loop Control Statements - Continue statement - Quiz 3easy Loop Control Statements - Continue statement - Quiz 1easy Loops - Loop execution flow - Quiz 7medium Operators and Expressions - Arithmetic operators - Quiz 7medium