/en-tutor-prep-s5-ict-programming-loops-practice-3/
/en-tutor-prep-s5-ict-programming-loops-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 Loops, Paper 3: accumulators, digits and patterns

S5 ICT Programming Loops, Paper 3: accumulators, digits and patterns

  • 2026-11-03

S5 ICT Programming Loops, Paper 3: accumulators, digits and patterns

Paper 3 works through a decrementing while loop of five rounds, the sum 1 to 100 as 5050, five factorial as 120, ten multiples of 3 up to 30, a star pattern of four lines and ten stars, a digit sum of 22 from 4729, ten doublings to reach 1024, a reversed string and fifteen nested dashes.

Reminders A while test must move towards failing, an accumulator starts at 0, and nested iterations multiply.

01 Paper details (check answers afterwards)

Item Detail
Questions 10
Suggested time 25
Difficulty mix Foundation 4 · Intermediate 3 · Challenge 2 · Error redo 1
Chapter Chapter: S5 ICT: Programming Loops in Python
Level S5

02 Questions (10 items)

  1. FoundationAfter `n = 5`, how many times does `while n > 0: n -= 1` run?
  2. Foundation`total = 0` then `for i in range(1, 101): total += i`. What is total?
  3. Foundation`f = 1` then `for i in range(1, 6): f *= i`. What is f?
  4. FoundationHow many numbers does `for i in range(3, 31, 3)` print?
  5. Intermediate`for i in range(1, 5): print(“*” * i)` prints how many lines and how many stars in total?
  6. Intermediate`s = 0; n = 4729` then `while n > 0: s += n % 10; n //= 10`. What is s?
  7. Intermediate`x = 1; c = 0` then `while x < 1000: x *= 2; c += 1`. What is c?
  8. ChallengeTo print PYTHON reversed as NOHTYP, what is the shortest statement?
  9. Challenge`for i in range(3): for j in range(5): print(“-“, end=””)` prints how many dashes in total?
  10. Error redoError repair: a student wrote `i = 10` then `while i > 0: print(i)` and it never stops. What is missing?

03 Answers and one-line notes

# Answer One-line note
1 5 times Starting at 5 and subtracting 1 each round, the loop runs for 5, 4, 3, 2 and 1, then n reaches 0 and the test fails.
2 5050 Adding 1 to 100 is 100 times 101 divided by 2, which gives 5050.
3 120 This multiplies 1 to 5, which is five factorial, equal to 120.
4 10 numbers Starting at 3 and adding 3 each step gives 3, 6, 9 up to 30, ten numbers in all.
5 4 lines, 10 stars There are 4 lines with 1, 2, 3 and 4 stars, which add up to 10.
6 22 Each round takes the last digit and drops it, giving 9, 2, 7 and 4, which add to 22.
7 10 (x becomes 1024) Doubling from 1 reaches 1024 after 10 multiplications, and 1024 is no longer below 1000.
8 print(“PYTHON”[::-1]) A slice step of minus 1 walks the string backwards in one line, with no loop needed.
9 15 The outer loop runs 3 times and the inner loop prints 5 dashes each time, so 3 times 5 is 15.
10 Decreasing i inside the loop (i -= 1) A condition that never fails loops forever, so the body must change something that moves the test towards failing.

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.

Book an S5 ICT tutorTutor 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 →