Worked solution from the Computational thinking and Problem-solving Paper 3 Advanced Theory booklet, Part 2 of 2.
Run Delete(1, 15) one call at a time. Nothing changes until Numbers[Index] >= 15. At Index 5, Numbers[5] takes the value of Numbers[6], and each later cell copies the one after it. At Index 8 the value 0 is copied, and at Index 9 the cell is 0, so the calls stop.
| Index | Target | [1] | [2] | [3] | [4] | [5] | [6] | [7] | [8] | [9] | [10] |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | 3 | 7 | 11 | 15 | 17 | 19 | 23 | 0 | 0 | ||
| 1 | 15 | ||||||||||
| 2 | |||||||||||
| 3 | |||||||||||
| 4 | |||||||||||
| 5 | 17 | ||||||||||
| 6 | 19 | ||||||||||
| 7 | 23 | ||||||||||
| 8 | 0 | ||||||||||
| 9 |
Index (1 to 9) and Target (15) columns correct [1]
Numbers[5] column correct (17) [1]
Numbers[6] and Numbers[7] columns correct (19, 23) [1]
Numbers[8] column correct (0), with no other data added to the other columns [1]
▶ Topic lesson
A lesson on this topic · by Craig'n'Dave. 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.