Recall & Review
beginner
What is a loop in programming?
A loop is a way to repeat a set of instructions multiple times until a condition is met, like doing the same chore over and over until it's done.
Click to reveal answer
beginner
Name two common types of loops.
Two common loops are:<br>1. For loop: repeats a set number of times.<br>2. While loop: repeats while a condition is true.
Click to reveal answer
intermediate
What happens if a loop's condition never becomes false?
The loop runs forever, called an infinite loop. It's like a chore that never ends and can freeze a program.
Click to reveal answer
beginner
Explain a real-life example of a loop.
Imagine washing dishes: you wash one dish, then the next, and keep going until no dishes are left. This is like a loop repeating an action until a condition (no dishes) is met.
Click to reveal answer
beginner
What is the purpose of a loop counter?
A loop counter keeps track of how many times the loop has run, helping to stop the loop after a set number of repeats.
Click to reveal answer
Which loop repeats a fixed number of times?
✗ Incorrect
A for loop repeats a set number of times, like counting from 1 to 5.
What is an infinite loop?
✗ Incorrect
An infinite loop keeps running because its stop condition is never met.
Which part of a loop decides when to stop?
✗ Incorrect
The condition is checked each time to decide if the loop should continue or stop.
What does a loop counter do?
✗ Incorrect
The counter tracks the number of repetitions to help control the loop.
Which loop type repeats while a condition is true?
✗ Incorrect
A while loop continues as long as its condition remains true.
Describe how a loop works using a real-life example.
Think about doing the same task repeatedly until something changes.
You got /3 concepts.
Explain the difference between a for loop and a while loop.
One counts repeats, the other checks a condition each time.
You got /3 concepts.