← IGCSE Computer Science Paper 2

Flowchart for a FOR loop

Set Counter ← 1 in a process box, test Counter <= 10 in a decision, run the body on Yes, then do Counter ← Counter + 1 and flow back to the test. No leaves the loop.

Understanding Flowchart for a FOR loop in IGCSE Computer Science Paper 2

What it does: The update step replaces NEXT in the flowchart. It comes after the body and before the line back to the decision. Counter ← 1 is an assignment, so it goes in a process box. It happens once, before the test. A test with Yes and No exits needs a decision diamond. A process rectangle only does a step. Pseudocode and flowcharts use ← for assignment. A single = is for comparison. Going back to Counter ← 1 would reset the counter every time and the loop would never end. The flow must return to the test. The No exit leaves the loop and carries on with the rest of the flowchart. The body only runs on Yes.

Common mistakes: The loop body runs on the Yes branch, when the test Counter <= 10 is true. The No branch leaves the loop. The line should be Yes: OUTPUT Counter. Counter starts at 1, so Counter >= 5 is false straight away and the body never runs. The decision must be Counter <= 5.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 188–213) and word search (Modules 188–231).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Where is the counter first set in a FOR loop flowchart?
Inside the decision diamondIn a process box before the decision
Matches
Counter ← 1 placed inside the loop, after the body and just before the flow line back to the test
↓
The counter is reset to 1 on every pass, so it never reaches 10 and the loop never ends. The start value must be set once before the test.
Applying
Meanings
Term
FOR loop flowchart
Meaning
Set Counter ← 1 in a process box, test Counter <= 10 in a decision, run the body on Yes, then do Counter ← Counter + 1 and flow back to the test. No leaves the loop.
Practice
Counter ← 1
Testing
Gaps
Process box: Counter ←
Check Answer
Spots
2Decision: Counter <= 10
3No: OUTPUT Counter

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Dumbo Octopus' badge — Module Maker, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Where is the counter first set in a FOR loop flowchart?
A. In a process box before the decision ✓
B. Inside the decision diamond
Counter ← 1 is an assignment, so it goes in a process box. It happens once, before the test.
2. Which shape holds the test Counter <= 10?
A. Decision diamond ✓
B. Process rectangle
A test with Yes and No exits needs a decision diamond. A process rectangle only does a step.
3. Which is the correct order for a FOR loop flowchart?
A. Set counter, body, test, add 1, back to body
B. Set counter, test, body, add 1, back to test ✓
The counter is tested before the body runs. After the body, add 1 and flow back to the test.
4. Which flowchart statement increases the counter?
A. Counter = Counter + 1
B. Counter ← Counter + 1 ✓
Pseudocode and flowcharts use ← for assignment. A single = is for comparison.
5. Where does the flow line from Counter ← Counter + 1 go?
A. Back to the decision ✓
B. Back to Counter ← 1
Going back to Counter ← 1 would reset the counter every time and the loop would never end. The flow must return to the test.

Match the Pairs

Counter ← 1 → Process box before the test: sets the loop counter to its starting value once, before the loop begins
Counter <= 10 → Decision diamond: tests whether the loop should run again, Yes goes to the body and No leaves the loop
After the loop body, the counter is increased by 1 in a process box, then a flow line returns to the test → Counter ← Counter + 1
The test comes before the body, so a FOR loop flowchart sets the counter first and checks it before running any body statements → Counter ← 1 then Counter <= 10 ?
Counter ← 1 placed inside the loop, after the body and just before the flow line back to the test → The counter is reset to 1 on every pass, so it never reaches 10 and the loop never ends. The start value must be set once before the test.
Body, then flow line straight back to the test with no Counter ← Counter + 1 box → The counter is never increased, so Counter <= 10 stays true forever and the loop runs endlessly. A process box adding 1 is missing.

Key Term

FOR loop flowchart
Set Counter ← 1 in a process box, test Counter <= 10 in a decision, run the body on Yes, then do Counter ← Counter + 1 and flow back to the test. No leaves the loop.

Fill in the Blanks

1. Process box: Counter ← 1
Hint: Type the starting value the counter is given before the test.
2. Decision box: Counter <= 10
Hint: Type the relational operator that keeps the loop going while the counter is at most the limit.
3. After body: Counter ← Counter + 1
Hint: Type the arithmetic operator that increases the counter before returning to the test.
4. Decision: Counter <= 10? Yes runs the body
Hint: Type the label on the exit from the decision that goes into the loop body.
5. Decision: Counter <= 10? No leaves the loop
Hint: Type the label on the exit from the decision that ends the loop.

Spot the Error

Question 1
A Process: Counter ← 1
B Decision: Counter <= 10
C No: OUTPUT Counter
D Process: Counter ← Counter + 1
E Flow: back to the decision
Line C — The loop body runs on the Yes branch, when the test Counter <= 10 is true. The No branch leaves the loop. The line should be Yes: OUTPUT Counter.
Question 2
A Process: Counter ← 1
B Decision: Counter >= 5
C Yes: OUTPUT Counter
D Process: Counter ← Counter + 1
E Flow: back to the decision
Line B — Counter starts at 1, so Counter >= 5 is false straight away and the body never runs. The decision must be Counter <= 5.
Question 3
A Process: Counter ← 1
B Decision: Counter < 20
C Yes: OUTPUT Counter
D Process: Counter ← Counter + 1
E Flow: back to the decision
Line B — Counter < 20 stops the loop before 20 is output, so it runs only 19 times. To include 20 the decision must be Counter <= 20.
Question 4
A Process: Counter = 1
B Decision: Counter <= 10
C Yes: OUTPUT Counter
D Process: Counter ← Counter + 1
E Flow: back to the decision
Line A — Setting the counter is an assignment, so it needs the assignment arrow. The = sign is used for comparing. It should be Counter ← 1.
Question 5
A Process: Counter ← 1
B Process: Counter <= 10
C Yes: OUTPUT Counter * 2
D Process: Counter ← Counter + 1
E Flow: back to the decision
Line B — A test must be drawn in a decision (diamond) with Yes and No exits, not in a process box. It should be Decision: Counter <= 10.

Student with a class code? Join your class →