Advanced programming practice has four skills: storing data in arrays, tracing searching and sorting, debugging, and testing with a table of expected outputs. Learn them in that order, because each one builds on the one before.
It is part of the SPM Computer Science guide. Confirm the current syllabus scope with your school and the Lembaga Peperiksaan website.
What does this area cover?
Each page trains one habit: work out what the program does step by step, instead of guessing.
| Order | Skill | What you will be able to do |
|---|---|---|
| 1 | Working with arrays and structured data | Store, read and update a list of values or records |
| 2 | Tracing searching and sorting algorithms | Follow linear search, binary search and a simple sort by hand |
| 3 | Debugging syntax, logic and runtime errors | Name the kind of error and fix the right line |
| 4 | Creating a test table with expected outputs | Choose test data and predict results before running |
Test all four together in the practice set.
One small example
An array holds five quiz marks: 6, 9, 4, 9, 7. A program is meant to print the highest mark, but it starts with the variable high set to 0 and only updates it when a mark is greater than high.
The sample run prints 9, which looks right. A test table asks a harder question: what if every mark is negative, say −3, −1, −8? The program would print 0, a value that is not in the array at all.
The sample run hides the bug and the table shows it. That is why arrays, tracing and testing go together.
Who should start where?
If you are unsure how to read an array, begin with the first lesson. If you can follow an algorithm but lose the values halfway, begin with tracing and use a trace table.
If your code gives an error message, begin with debugging. If it runs but gives the wrong output, read my code runs but gives the wrong result first.
What should I do next?
Work through the lessons in order, then try the practice set. To trace a new algorithm with a teacher, see online one-to-one Computer Science tuition.