S5 ICT: Programming Arrays and Functions – Practice Paper 2 (Intermediate, 10 Questions)
- 2026-11-05
S5 ICT: Programming Arrays and Functions – Practice Paper 2 (Intermediate, 10 Questions)
Paper two covers loop totals, comparison counts for linear and binary search, nested loop execution counts, the first bubble pass, and an averaging function – ten items with answers.
Quick answer Intermediate items demand careful comparison counting: linear search steps one at a time while binary search halves the range each time.
01 Paper details (check answers afterwards)
| Item | Detail |
|---|---|
| Questions | 10 questions |
| Suggested time | 25 minutes |
| Difficulty mix | Intermediate 3 · Error redo 2 · Challenge 3 · Foundation 2 |
| Chapter | Chapter: S5 ICT | Programming: Arrays and Functions |
| Level | Intermediate |
02 Questions (10 items)
- IntermediateArray B = [4, 9, 15, 22, 30, 41]. Using a loop, what is the total of all elements?
- IntermediateA linear search starts at B[0] and looks for 30. How many comparisons are needed?
- Error redoA binary search looks for 30 in B. Which half survives the first comparison, and how many comparisons in total?
- ChallengeA binary search looks for 41 in B. How many comparisons in total?
- FoundationIn a nested loop i runs from 1 to 3 and j from 1 to 2. How many times does the inner body run?
- FoundationHow many even numbers are there in B?
- IntermediateA bubble sort runs on an array of 6 elements. How many comparisons does the first pass make?
- ChallengeA function average(arr) returns the total divided by the number of elements. What is average(B) to two decimal places?
- ChallengeWhat precondition does a binary search require?
- Error redoWhat goes wrong if a binary search is used on an unsorted array?
03 Answers and one-line notes
| # | Answer | One-line note |
|---|---|---|
| 1 | 121 | 4+9+15+22+30+41 = 121, and the loop adds one element per pass. |
| 2 | Five. | 30 sits at index 4, so B[0] to B[4] must be compared, five in total. |
| 3 | B[2]=15 sends the search right; two comparisons in total. | The first mid is (0+5)//2=2, and 15 is below 30 so the lower bound moves to 3; the second mid is 4 and hits, so two comparisons suffice. |
| 4 | Three. | The mids are 2 (value 15), 4 (value 30) and finally 5 (value 41). |
| 5 | Six times. | 3 times 2 equals 6, because the inner loop runs twice for each outer pass. |
| 6 | Three. | 4, 22 and 30 are even, while 9, 15 and 41 are odd. |
| 7 | Five. | The first pass compares five adjacent pairs and pushes the largest value to the end. |
| 8 | 20.17 | 121 divided by 6 gives 20.1666…, which rounds to 20.17. |
| 9 | The data must already be sorted on the search key. | Unsorted data cannot be halved reliably by comparing the middle value, so the result is unreliable. |
| 10 | It may fail to find an element that is present. | Half the data is discarded after each comparison, and that half may contain the target when the data is unsorted. |
04 What to do after marking
- After marking, redo only the wrong items and write down which step went wrong (formula, unit, or misread number).
- Repeat the same item two days later; move to the next paper only when both attempts are correct.
- Parents only need the answer and note columns; there is no need to explain every item.
Find a tutor freeTutor Registration →
Questions and answers are written originally by the TutorZone team and are not taken from any school, publisher or examination authority paper. Every value is checked by computer.


