Earlier computing lessons usually ask you to follow and use a tool. Form 4 Computer Science also asks you to plan a short algorithm and explain why its result is right.
This page puts the two kinds of task side by side. It belongs to the students section, and the full route is on the Form 4 Computer Science page.
What is a tracing task?
Tracing means you follow a given program by hand and record the value of each variable at every step. The answer is a number or a list that has only one correct value.
Take this loop. Start with total = 0. For n from 1 to 4, set total = total + n × 2. Then output total.
| n | total before | n × 2 | total after |
|---|---|---|---|
| 1 | 0 | 2 | 2 |
| 2 | 2 | 4 | 6 |
| 3 | 6 | 6 | 12 |
| 4 | 12 | 8 | 20 |
The output is 20. A second check: the loop adds 2 × (1 + 2 + 3 + 4) = 2 × 10 = 20, so the table agrees.
What is a design-and-explain task?
Designing starts from a goal and asks you to write the steps, then justify them. The answer is not one number, so you also show that your steps work on sample data.
The goal is original practice: read five marks and output the highest. One working design is: set highest to the first mark; for each of the other four marks, if the mark is greater than highest, set highest to that mark; after the loop, output highest.
Test it on 62, 48, 75, 75, 60. Highest starts at 62, becomes 75 at the third mark, stays 75, and the output is 75.
What is the plausible mistake?
A pupil sets highest to 100 at the start “to be safe”. Then no mark is ever greater, so the algorithm outputs 100 every time.
The start value must come from the data, here the first mark, or the comparison tells you nothing about the marks. This is why the explanation matters: a pupil who can say why highest starts as the first mark has understood, not copied.
Where do you start?
| Your background | A sensible first step |
|---|---|
| Earlier lessons covered loops and variables | Move quickly to designing: write the highest-mark steps from memory, then test them |
| Earlier lessons used software only | Begin with tracing on paper using the tracing pseudocode lesson |
| No earlier computing at all | Start with variables and the loop boundary idea, in writing loops with correct boundaries |
Your school’s scheme of work sets the actual order, so check it before you plan.
Try one alone
Design an algorithm that reads four temperature readings and outputs the lowest. Test it on 31, 29, 33, 28.
Answer
Set lowest to the first reading. For each of the other three readings, if the reading is less than lowest, set lowest to that reading. After the loop, output lowest.
On 31, 29, 33, 28: lowest starts at 31, becomes 29, stays 29 for 33, becomes 28, so the output is 28. Check by scanning the list: the smallest value is 28.
When paid one-to-one tuition may be worth considering
If you can trace a program but freeze when asked to write your own, a teacher can give you short design tasks and ask “why does that step work?” until the explanation comes easily. Lessons follow your school’s order or the topics you choose.
See the Computer Science tuition page. The paid one-hour trial starts from RM50, and the fee is agreed before the trial.