Standard difficulty · 20 questions · 40 marks · Time: 41 minutes
Show your working for Sections B and C. Answers are on the last page — try every question first!
Searching · AW-12CS-SRC-2026-V1 · For parents — fold back or tear off before handing the sheet to your child.
| Q | Answer | Working |
|---|---|---|
| 1 | (d) each item in turn from the start | — |
| 2 | (c) 8 | 64 is item 8 from the left |
| 3 | (a) 7 | a missing key is compared with every item |
| 4 | (a) 3 | mid indices (from 0): 6, 9, 7 |
| 5 | (d) 53 | mid = (0 + 7) // 2 = 3; then mids 3, 5, 6, 7 |
| 6 | (c) 5 | 75 = 10 × 7 + 5 |
| 7 | (d) 9 | the list halves each time: 9 halvings reduce 500 items to 1 |
| 8 | (b) 6 3 | mid = (first + last) // 2; the search halves the range after each comparison |
| 9 | Finding whether a key is present in a collection of items and, if so, where. | — |
| 10 | 5, 8, 6, 7 | found at index 7 |
| 11 | 9 | 9 comparisons |
| 12 | (a) 1; (b) 1 | remainders: 21 → 1, 10 → 0, 67 → 7, 84 → 4 |
| 13 | 10 3 | pos stays None when the key is not found; count is the number of passes |
| 14 | (a) 15; (b) 4 | binary search mids: 7, 11, 13, 14 |
| 15 | [49, 29, None, 59, 74, None, 62] | 49 → 0, 74 → 4, 62 → 6, 59 → 3, 29 → 1, 76 → 6; 76 clashes |
| 16 | Yes | remainders: 3, 9, 9, 6 |
| 17 | def linearSearch(L, key): for i in range(len(L)): if L[i] == key: return i + 1; return None. Best case: the key is first, 1 comparison; worst case: the key is last or absent, n comparisons. | — |
| 18 | (a) 7, 11, 9; (b) 7, 11, 13, 12, not found; (c) 10 and 15 | mid = (first + last) // 2; move first or last past mid each time |
| 19 | (a) 89 → 5, 53 → 4, 68 → 5, 86 → 2, 39 → 4; (b) 1; (c) slot 3, which holds nothing, so 80 is not present | hashing finds a key with one calculation and one comparison |
| 20 | (a) None 3; (b) binary search throws away the half that cannot hold the key, which is only correct when the items are in order; (c) 4 | each pass halves the range |