/en-tutor-prep-s5-ict-programming-arrays-functions-practice-3/
/en-tutor-prep-s5-ict-programming-arrays-functions-practice-3/
英文版
3
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

S5 ICT: Programming Arrays and Functions – Practice Paper 3 (Challenge, 10 Questions)

S5 ICT: Programming Arrays and Functions – Practice Paper 3 (Challenge, 10 Questions)

  • 2026-11-05

S5 ICT: Programming Arrays and Functions – Practice Paper 3 (Challenge, 10 Questions)

Paper three tackles recursion and call counts, two-dimensional indices, selection sort comparisons, the binary search upper bound, off-by-one loop bounds and variable scope.

Quick answer Challenge items test boundaries and call counts: recursion needs a base case, loops need correct first and last indices, and one step off ruins everything.

01 Paper details (check answers afterwards)

Item Detail
Questions 10 questions
Suggested time 25 minutes
Difficulty mix Foundation 1 · Intermediate 2 · Challenge 3 · Error redo 4
Chapter Chapter: S5 ICT | Programming: Arrays and Functions
Level Challenge

02 Questions (10 items)

  1. FoundationA recursive function factorial(n) returns 1 when n is 1, otherwise n times factorial(n-1). What is factorial(5)?
  2. IntermediateGiven fib(1)=1 and fib(2)=1, and fib(n)=fib(n-1)+fib(n-2) otherwise, what is fib(6)?
  3. IntermediateA two-dimensional array is declared with 3 rows and 4 columns. How many elements are there, and what is the index of the last one?
  4. ChallengeA selection sort runs on an array of 6 elements. How many comparisons does it make in total?
  5. ChallengeA binary search runs on the sorted values 1 to 100. What is the maximum number of comparisons?
  6. ChallengeWhile factorial(5) runs, how many times is the function called in total, including the first call?
  7. Error redoA loop is written FOR i = 1 TO 5 but should be FOR i = 0 TO 4. Which element is missed when summing A, and by how much is the total short?
  8. Error redoA local variable x inside a function changes from 5 to 9 while a variable of the same name outside stays 5. What is this called?
  9. Error redoAn array of length 6 is reversed. Which element is swapped with A[0]?
  10. Error redoAmong 100 elements, how many comparisons do linear search and binary search need in the worst case?

03 Answers and one-line notes

# Answer One-line note
1 120 5 times 4 times 3 times 2 times 1 equals 120.
2 8 The sequence is 1, 1, 2, 3, 5, 8, so the sixth term is 8.
3 12 elements, at index [2][3]. 3 times 4 equals 12, with row indices 0 to 2 and column indices 0 to 3.
4 Fifteen. 6 times 5 divided by 2 equals 15, as each pass selects the smallest remaining value.
5 Seven. 2 to the power 6 is 64 and 2 to the power 7 is 128, so at most 7 comparisons are needed.
6 Five times. The calls step down from factorial(5) to factorial(1), so there are 5 in total.
7 A[0]=12 is missed, so the total becomes 53 instead of 65. An off-by-one boundary drops the first element, the most common shift error in tracing.
8 The scope of a local variable is limited to the function. The local variable disappears when the function ends, so the outside variable is unaffected.
9 A[5]. Symmetric positions add up to the length minus 1, so index 0 pairs with index 5.
10 Linear 100; binary 7. Binary search halves the range each time, so 7 comparisons cover 100 elements.

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.

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →