/en-tutor-prep-s3-term2-ict-debugging/
/en-tutor-prep-s3-term2-ict-debugging/
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 2 | ICT: Debugging – Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers

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

  • 2026-11-30

Lesson prep guide · S3 Term 2 ICT

Students edit at random when a program fails, until the working parts break too. Debugging has an order: reproduce, locate, then fix and retest, with three kinds of test data.

Lesson objectives Students can (1) tell syntax, logic and runtime errors apart; (2) debug in three steps; (3) design normal, boundary and invalid test data.

01 Prior knowledge check (first 3 minutes)

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

Skill Quick check Pass standard
Error messages First thing to do when a program errors Read the message and find the line
Averages The mean of 12, 18, 25, 30 and 15 20, from 100 over 5
Boundaries The largest index of a length-5 array 4

02 Lesson flow (45 minutes)

Time Stage Tutor does Student does
0–5 min Opening: a faulty program Show a mean calculation returning the wrong answer Say where it goes wrong
5–14 min Three error types Syntax, logic and runtime, with examples Classify three examples
14–23 min Three steps Model reproduce, locate, fix and retest Walk through once
23–32 min Trace Record variables step by step to find the first wrong one Trace one themselves
32–40 min Three test types Normal, boundary and invalid, noting the boundary most often missed Design three tests
40–45 min Exit check Collect three answers and sort type, step and test errors Work without notes

03 Teaching script (read it aloud)

Act one: three error types, three responses

Program errors come in three kinds. A syntax error is something the machine cannot read, such as a missing bracket or a misspelled keyword, and it is caught at translation with a line number. A logic error is readable but wrong, such as averaging with a sum or starting indices at 1, so the program runs and only tests catch it. A runtime error happens partway, such as dividing by zero or indexing past the end. The responses differ: read the message, test the logic, inspect the input.

Most common misconception: that a running program is a correct one. Logic errors are the most common and never announce themselves.

Students restate: syntax is caught by the machine, logic by tests, runtime by input.

Act two: reproduce, locate, then fix and retest

Debugging has three steps. First reproduce with the smallest input that fails every time, for example the five numbers 12, 18, 25, 30 and 15, which total 100, so the mean should be 20; if the program prints 100 it only added. Second locate with a trace table or line-by-line output to find the first wrong step, changing one thing at a time. Third fix and retest on the same input to confirm 20, then add a boundary case such as a single value, whose mean is itself.

Second misconception: changing several places at once. If three edits fix it, you still do not know which mattered.

Students restate: reproduce, locate, fix and retest, one change at a time.

Act three: three kinds of test data

Test data comes in three kinds. Normal values are everyday input, such as five marks; boundary values are the extremes where errors hide, such as an empty array, a single element or the last index 4; invalid values break format or range, such as a negative number or text where a number is expected. Boundaries are the most often skipped because they rarely occur, yet they break first: a length-5 array with a loop to less than or equal to 5 fails at once. So every feature gets at least three tests, normal, boundary and invalid.

Students restate: normal, boundary and invalid, with boundary the easiest to forget.

04 Question types and steps

Type Example Steps Answer
Classification A missing closing bracket The machine cannot read it Syntax error
Classification Averaging by summing Readable but wrong Logic error
Step Smallest input that fails Step one Reproduce
Testing Empty array or the last index Extreme cases Boundary test
Three debugging steps: reproduce, locate, then retestreproducelocatefix and retestnormalfive marksboundary0 or the last indexinvalida negative or empty

Debugging is not random editing. First reproduce with the smallest input that fails every time; second locate with a trace table or line-by-line output to find the first wrong step; third fix and retest with the same input plus a boundary case. Test data comes in three kinds, normal, boundary such as 0 or the last index, and invalid such as a negative number or an empty string. Syntax errors are caught by the machine, logic errors only by tests.

Sanity check (must teach):Test results check by arithmetic: 12, 18, 25, 30 and 15 total 100 over 5 for 20, so 100 means the division is missing and 25 means only the middle value was taken. Boundaries check by number, since a length-5 array ends at index 4 and a loop to 5 runs past it. Error types match their symptoms: a message means syntax, a wrong answer with a running program means logic, and a halt partway means runtime. One change at a time, retested on the same input, is what proves a fix.

05 Three independent practice questions

Question Answer What to observe
A program is missing a closing bracket: which error type? Syntax, the machine cannot read it Logic confuses the categories
A program runs but averages by summing: which type? Logic, caught only by tests Syntax would have been reported
A length-5 array: which index most needs testing? Index 4, and the out-of-range index 5 Index 0 alone misses the boundary

06 Common errors and correction lines

Error Student usually writes Tutor says
Running means correct “It did not crash, so it must be right” “Logic errors never crash, so compare output against a known answer.”
Many edits at once “I changed three places, one will work” “Change one at a time, or you cannot tell which mattered.”
Normal tests only “One set of marks is enough” “Add boundary and invalid tests; boundaries break first.”
Ignoring messages “I see red text and rewrite” “The message gives the line and the cause, so read before editing.”

07 Homework (paper and question numbers)

08 Exit check (last 3 minutes)

Question Answer Verdict
Name the three error types Syntax, logic and runtime One type is incomplete; reteach act one
Name the three debugging steps Reproduce, locate, fix and retest “Edit until it works” is not a method; reteach act two
Name the three test data types Normal, boundary and invalid Normal alone misses the boundaries; reteach act three

09 Tutor FAQ

Which year is this page for?

S3 Term 2, the programming and debugging unit in local secondary ICT; later years add unit tests and version control.

Is 45 minutes enough for error types and testing?

Yes. Nine minutes on the types, nine on the steps, eight on tracing and nine on test data, with the rest for practice and the exit check.

Is there a matching worksheet?

Yes. The homework links to questions 4 and 10 of set 1 and question 10 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 →