This module is about three jobs a program does with stored data: finding a value, putting values in order, and reading and writing files. Exam questions rarely ask you to invent a clever method. They ask you to follow a given algorithm exactly, say what it outputs, and spot where it breaks.
For the exact scope and the notation expected in your exam year, read the Cambridge IGCSE Computer Science syllabus page. The wider picture is in the Computer Science learning guide, and the 2029 changes page explains how later exam years may differ.
What should I already know?
You need variables, selection and loops. The module on repetition and arrays covers the loop and array skills used here, and validation, verification and testing introduces the test-data thinking that the last lesson builds on.
Orienting example: one trace, three ideas
Here is a tiny search over a fictional list. The array Items holds "pen", "ruler", "glue" in positions 1 to 3, and the target is "glue".
Found ← FALSE
Index ← 1
WHILE Index <= 3 AND Found = FALSE
IF Items[Index] = Target THEN
Found ← TRUE
ELSE
Index ← Index + 1
ENDIF
ENDWHILE
| Check | Index | Items[Index] | Found |
|---|---|---|---|
| Before loop | 1 | FALSE | |
| 1st pass | 1 | pen | FALSE, so Index becomes 2 |
| 2nd pass | 2 | ruler | FALSE, so Index becomes 3 |
| 3rd pass | 3 | glue | TRUE |
The loop stops with Index = 3, so the answer is position 3 after three comparisons. Notice what the table shows: the data, a variable that moves, and a stop condition. Every lesson in this module uses those three parts.
What order should I study the lessons in?
- Trace a linear search on original data: the clearest way to learn trace tables, including what happens when the target is missing.
- Explain a sorting pass where in scope: follow one pass of neighbour comparisons and swaps.
- Read a record without losing field boundaries: split a line of stored data into its fields correctly.
- Handle end-of-file in a restricted example: read a whole file with a loop that stops at the right moment.
- Check an algorithm against empty and duplicate data: test your own algorithm on the awkward cases.
Then attempt the mixed practice set. Two tools help: the restricted pseudocode trace trainer for stepping variables, and the safe Python reasoning sandbox for checking a short Python version.
Which traps catch students most often?
- Changing the index after the match. A search that keeps counting after it finds the target reports the wrong position.
- Losing a value in a swap. Without a temporary variable, one value overwrites the other.
- Treating a number in a file as text. The characters 9 and 72 compare differently as text than as numbers.
- Testing only the friendly case. An empty list or repeated values can break an algorithm that works on tidy data.
How do I use the practice set?
Draw the trace table on paper before you open any answer. Write each variable in its own column and update it one line at a time. Record every slip in the mistake log and retest queue and retry that question a few days later.
If you follow each step in class but your own traces drift off course, that is something our teachers can work on in online one-to-one Computer Science tuition.