Recall & Review
beginner
What is the main purpose of a loop in C programming?
A loop repeats a block of code multiple times until a condition is no longer true.
Click to reveal answer
beginner
Describe the flow of a
for loop in C.A
for loop starts by initializing a variable, then checks a condition before each iteration, executes the loop body if true, and updates the variable after each iteration.Click to reveal answer
beginner
What happens if the loop condition is false at the start of a
while loop?The loop body does not execute even once, and the program continues after the loop.
Click to reveal answer
intermediate
How does a
do-while loop differ in execution flow from a while loop?A
do-while loop executes the loop body first, then checks the condition, so it always runs at least once.Click to reveal answer
intermediate
What is the role of the
break statement inside a loop?The
break statement immediately stops the loop and transfers control to the code after the loop.Click to reveal answer
What part of a
for loop runs only once at the beginning?✗ Incorrect
The initialization runs once before the loop starts.
When does the condition in a
while loop get checked?✗ Incorrect
The
while loop checks the condition before running the loop body each time.Which loop guarantees the body runs at least once?
✗ Incorrect
The
do-while loop runs the body first, then checks the condition.What happens if the loop condition is false at the start of a
for loop?✗ Incorrect
If the condition is false initially, the loop body does not execute.
What does the
break statement do inside a loop?✗ Incorrect
The
break statement stops the loop right away.Explain the execution flow of a
for loop in C.Think about what happens first, then what repeats.
You got /5 concepts.
Describe the difference in execution flow between a
while loop and a do-while loop.One checks condition before running, the other after.
You got /3 concepts.