/en-tutor-prep-s3-term1-ict-loops/
/en-tutor-prep-s3-term1-ict-loops/
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

S3 Term 1 | ICT: Loops – Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers

S3 Term 1 | ICT: Loops – Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers

  • 2026-11-30

Lesson prep guide · S3 Term 1 ICT

Students memorise the syntax of for and while but cannot say how many times a loop runs or what the accumulator ends at, and they do not know why a program hangs. This lesson writes the count and the total out on a trace table, line by line.

Lesson objectives Students can (1) explain the difference between for and while and when each fits; (2) use a trace table to get the number of passes and the accumulated total; (3) multiply nested loop counts and explain what causes an infinite loop.

01 Prior knowledge check (first 3 minutes)

If any item below fails, fix it first, or this lesson stalls:

Skill Quick check Pass standard
Arithmetic series What is 1 plus 2 up to 10 55, from 10 times 11 over 2
Compare and update x starts at 1, doubled each pass: after three passes 8
Multiplication 3 outer passes and 4 inner passes 12 times

02 Lesson flow (45 minutes)

Time Stage Tutor does Student does
0–5 min Opening: copying a name 100 times Ask whether there is a way without 100 copies Say repetition
5–14 min for and while Compare known counts with unknown counts, one example each Pick the right loop for two situations
14–24 min Counting with a trace Model sum from 0 adding 1 to 10, recording 1, 3, 6 on to 55 Trace 1 to 20 themselves
24–33 min When the condition stops Model x from 1 doubling to 128, the first value over 100, seven passes Get seven passes and write the trace
33–41 min Nesting and hanging Model 3 times 4 for 12 passes, then forget to update the counter Give the nested count and the cause of the hang
41–45 min Exit check Collect three answers and sort count, total and nesting errors Work without notes

03 Teaching script (read it aloud)

Act one: for counts passes, while waits for a condition

There are only two loops. Use for when the count is known: to copy a name 100 times, write for i from 1 to 100 and it runs exactly 100 times. Use while when the count is unknown and only the stopping condition is known, such as doubling until the value passes 100. So the first question is whether the count is known. for i from 1 to 5 runs five times, because 5 minus 1 plus 1 is 5, and 1 to 10 runs ten times rather than nine.

Most common misconception: that for always starts at 0. The start is whatever you write: 1 to 10 is ten passes and 0 to 9 is also ten, because the count depends on the bounds, not the start.

Students restate: known count means for, only a stopping condition means while.

Act two: accumulators and trace tables

An accumulator starts at 0 and each pass adds the new value. Set sum to 0, run i from 1 to 10 adding i: the first pass gives 1, the second 3, the third 6, then 10, 15, 21, 28, 36, 45 and 55. That matches the formula 10 times 11 over 2, so the two methods check each other. A trace table has three columns: pass number, i, and sum; students who write only the answer cannot find the pass where it went wrong. One to 20 gives 210 and one to 100 gives 5050 by the same formula.

Second misconception: initialising the accumulator inside the loop. sum equals 0 belongs before the loop; inside, it resets every pass and ends as the last i alone.

Students restate: set the accumulator to 0 before the loop, add each pass, and trace pass, i and total.

Act three: conditions, nesting and hanging

The while condition must be exact. With x at 1 and while x is less than 100, doubling each pass gives 1, 2, 4, 8, 16, 32, 64 and 128, so the seventh pass is the one that ends it: seven passes. Writing less than or equal to 100 still gives seven, since 128 is already beyond. Another case: x at 10, while x is greater than 0 subtracting 3, runs 10, 7, 4, 1 and minus 2, four passes, ending at minus 2, which shows the condition is tested before each pass. Nested loops multiply: 3 outer and 4 inner is 12 passes. Forget to update the counter and the condition never fails, which is the infinite loop.

Students restate: the condition is tested before each pass, nesting multiplies, and a counter left unupdated hangs the program.

04 Question types and steps

Type Example Steps Answer
Choosing Copying a name 100 times The count is known A for loop
Count for i from 1 to 5 5 minus 1 plus 1 Five passes
Accumulate sum from 0, i from 1 to 10, add i Accumulate pass by pass 55
Nesting 3 outer, 4 inner 3 times 4 12 passes
Two loop traces: seven doublings to 128, ten additions to 55102142831643256461287doublingsstops once x passes 100, after seven passes112341556789551055running total55 is also 10 times 11 over 2

On the left, while x is at most 100: each pass doubles it, 1 to 2, 4, 8, 16, 32, 64, 128, so seven multiplications before it first passes 100. On the right, a for loop adding 1 to 10 records 1, 3, 6, 10, 15, 21, 28, 36, 45 and 55, which is also 10 times 11 over 2. A nested loop of 4 outer passes and 5 inner passes prints 20 times.

Sanity check (must teach):Counts and totals check two ways: the trace gives 55 and 10 times 11 over 2 also gives 55, while 1 to 20 traces to 210 and 20 times 21 over 2 agrees. A while count must include the pass that ends it: doubling 1 seven times reaches 128 and the eighth test fails, so seven passes. With x at 10 subtracting 3 the values are 10, 7, 4, 1 and minus 2, four passes, ending at minus 2, proving the condition is tested before the update. Nested 3 times 4 is 12, matching a pass-by-pass count.

05 Three independent practice questions

Question Answer What to observe
sum starts at 0, for i from 1 to 20 adding i: what is sum? 20 times 21 over 2, which is 210 190 means it stopped at 19; 210 is right
x is 1 and while x is less than 100 doubles it: how many passes? 1, 2, 4, 8, 16, 32, 64, 128, so seven passes Six misses the pass that reaches 128
Outer for i from 1 to 3, inner for j from 1 to 4: how many inner passes? 3 times 4, which is 12 Seven adds the bounds instead of multiplying

06 Common errors and correction lines

Error Student usually writes Tutor says
Loops confused “Unknown count means for, either works” “Unknown count needs while, because for requires bounds; use for only when the count is known.”
Accumulator reset inside “sum equals 0 goes inside the loop” “sum equals 0 goes before the loop, or it resets each pass and ends as the last i.”
One pass short “Doubling reaches 64, so six passes” “The seventh pass takes 64 to 128 and fails the test, and that pass counts.”
Nesting added “3 outer and 4 inner is seven passes” “Nesting multiplies, 3 times 4 is 12, because the inner loop completes on every outer pass.”

07 Homework (paper and question numbers)

08 Exit check (last 3 minutes)

Question Answer Verdict
How do for and while differ? for for a known count, while for a known stopping condition “Different syntax” misses the purpose; reteach act one
What is the sum from 1 to 10? 55 45 means one pass short; reteach act two
Why does a loop hang? The counter is never updated, so the condition never fails “The computer is slow” misses the condition; reteach act three

09 Tutor FAQ

Which year is this page for?

S3 Term 1, the loops unit in local secondary ICT; later years use loops for arrays and reading files line by line.

Is 45 minutes enough for two loops and nesting?

Yes. Nine minutes on for and while, ten on the accumulator trace, nine on stopping conditions and seven on nesting and hanging, with the rest for practice and the exit check.

Is there a matching worksheet?

Yes. The homework links to question 7 of set 1 and questions 5 and 9 of set 2 of the S3 ICT algorithms paper, all with answers.

Find a tutor freeTutor sign-up →

©2026 TutorZone · www.tutorzone.com.hk · Terms of use · All rights reserved. Original TutorZone material for personal study and teaching only; not for resale or republication.

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →