Worked solution from the Processor Fundamentals Paper 1 Theory Fundamentals booklet, Part 2 of 3.
First input is A (65). It is not equal to the value at 100 (68) but equals the value at 101 (65), so the program jumps to 76 and adds 1 to the value in 102. Second input is D (68). It equals the value at 100, so the program jumps to 80 and subtracts 1 from 102. Blank cells mean no change.
| Instruction address | ACC | 100 | 101 | 102 |
|---|---|---|---|---|
| 68 | 65 | 100 | ||
| 70 | 65 | |||
| 71 | ||||
| 72 | ||||
| 73 | ||||
| 74 | ||||
| 76 | 100 | |||
| 77 | 101 | |||
| 78 | 101 | |||
| 79 | ||||
| 70 | 68 | |||
| 71 | ||||
| 72 | ||||
| 80 | 101 | |||
| 81 | 100 | |||
| 82 | 100 | |||
| 83 | ||||
| (70) |
Input 65 into ACC (rows 70 to 74) [1]
Load 100, increment to 101 and store in 102 (rows 76 to 79) [1]
Input 68 into ACC (rows 70 to 72) [1]
Load 101 into ACC, decrement to 100 and store in 102 (rows 80 to 83) [1]
Bit values: 64 + 32 + 4 + 2 = 102.
102 [1]
AND with a mask that has only bit 2 set (#4 = 00000100). The result is non-zero only if bit 2 is 1.
AND [1]
AND with 00001111, which is 15. Bits 4 to 7 become 0 and bits 0 to 3 stay the same.
Opcode AND [1]
Operand #15 [1]
▶ Whole paper
Video solution of the whole paper · by O/Alevel CS by Wasiq. 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.