Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 2 of 3.
Write the steps in words, in order:
Open Support_List.txt in APPEND mode (and close it at the end) [1]
Prompt for and input a student name and mark [1]
If the mark is 20 or more, skip to the repeat step [1]
If the mark is less than 20, write only the name to the file [1]
Repeat for all 35 students [1]
The data in a file is saved permanently, even after the computer is switched off, so it does not need to be typed in again when the program is re-run. [1]
WRITE mode would overwrite the existing data in the file, so the names from the other group tests would be lost. [1]
Follow the arrows from each state. From S1, Input-A gives Output-X and goes to S2. At S2, Input-A loops back to S2 with no output. S2 with Input-B gives Output-W and goes to S3. S3 with Input-A gives Output-W and goes to S4.
| Input | Output | Next state |
|---|---|---|
| S1 | ||
| Input-A | Output-X | S2 |
| Input-A | (none) | S2 |
| Input-B | Output-W | S3 |
| Input-A | Output-W | S4 |
Row 2 correct [1]
Row 3 correct [1]
Row 4 correct [1]
Row 5 correct [1]
▶ Whole paper
Video solution of the whole paper · by Audere Prep. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.