Bird
0
0

Which statement best describes the behavior of a return inside a nested loop in C?

easy📝 Conceptual Q2 of 15
C - Loop Control Statements
Which statement best describes the behavior of a return inside a nested loop in C?
AIt exits only the inner loop and continues the outer loop.
BIt exits the entire function immediately, stopping all loops.
CIt exits the outer loop but continues the inner loop.
DIt pauses the loops and waits for a condition to resume.
Step-by-Step Solution
Solution:
  1. Step 1: Understand return in nested loops

    Return always exits the entire function immediately, regardless of how many loops are nested.
  2. Step 2: Confirm no partial loop exit

    Return does not just exit one loop; it stops the function and all loops inside it.
  3. Final Answer:

    It exits the entire function immediately, stopping all loops. -> Option B
  4. Quick Check:

    Return in nested loops = full function exit [OK]
Quick Trick: Return always exits whole function, not just one loop [OK]
Common Mistakes:
  • Thinking return exits only the current loop
  • Confusing return with break or continue
  • Assuming loops run after return

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes