Worked solution from the Processor Fundamentals Paper 1 Theory Fundamentals booklet, Part 2 of 3.
Name the group each opcode belongs to:
IN: input and output of data [1]
ADD: arithmetic operations [1]
JPE: unconditional and conditional instructions [1]
CMI: compare instructions [1]
The input '1' has ASCII value 49. Trace line by line, writing a value only when it changes. The first pass fails the compare (51 against 0). The loop then stores 65 in 100, so the second pass finds 65 equal and jumps to OUT.
| Instruction address | ACC | IX | 100 | 101 | 110 | 111 | Output |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 51 | 65 | ||||
| 10 | 0 | ||||||
| 11 | 49 | ||||||
| 12 | 49 | ||||||
| 13 | 51 | ||||||
| 14 | |||||||
| 15 | |||||||
| 16 | 49 | ||||||
| 17 | 65 | ||||||
| 18 | 1 | ||||||
| 19 | 65 | ||||||
| 20 | |||||||
| 13 | 65 | ||||||
| 14 | |||||||
| 15 | |||||||
| 21 | A | ||||||
| 22 |
Rows 10 to 12 correct [1]
Rows 13 to 16 correct [1]
Rows 17 to 20 correct [1]
Second pass rows 13, 14, 15, 21 and 22 correct, with output A [1]
▶ Starts at Q9 (1:39:53)
Starts at Q9 (1:39:53) · by Pseudocode Pro. 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.