/en-tutor-prep-s5-ict-programming-loops-practice-4/
/en-tutor-prep-s5-ict-programming-loops-practice-4/
英文版
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 4: squares, odd sums and debugging

S5 ICT Programming Loops, Paper 4: squares, odd sums and debugging

  • 2026-11-03

S5 ICT Programming Loops, Paper 4: squares, odd sums and debugging

Paper 4 works through squares to 25, an odd sum of 25, six characters from repeated letters, six nested iterations that grow with the outer loop, seven doublings to 128, the largest digit of 5071, an even sum of 110, nine products from a 3 by 3 nest, a final square of 100 and a range upper-bound slip.

Reminders The upper bound of range is excluded, inner counts may depend on the outer loop, and a while body must change the tested variable.

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. FoundationWhat does the last line of `for i in range(1, 6): print(i * i)` show?
  2. Foundation`s = 0; for i in range(1, 11): if i % 2 == 1: s += i`. What is s?
  3. FoundationHow many characters does `for c in “abc”: print(c * 2)` print?
  4. Foundation`count = 0; for i in range(4): for j in range(i): count += 1`. What is count?
  5. Intermediate`i = 1` then `while i <= 64: i *= 2`. How many rounds run and what is the final i?
  6. IntermediateWhat is the largest digit in the integer 5071?
  7. Intermediate`total = sum(range(2, 21, 2))`. What is total?
  8. ChallengeHow many numbers does `for i in range(1, 4): for j in range(1, 4): print(i * j, end=” “)` print?
  9. Challenge`sq = [i * i for i in range(1, 11)]`. What is the last element of sq?
  10. Error redoError repair: to add 1 to 5 a student wrote `for i in range(1, 5): s += i` and got 10. What is correct?

03 Answers and one-line notes

# Answer One-line note
1 25 Squaring 1 to 5 gives 25 as the last value, since 5 times 5 is 25.
2 25 Only the odd numbers 1, 3, 5, 7 and 9 are added, giving 25.
3 6 characters Each letter is printed twice, so aabbcc holds six characters.
4 6 The inner loop runs 0, 1, 2 and 3 times, which adds up to 6.
5 7 rounds, final i is 128 Doubling from 1 gives 2, 4, 8, 16, 32, 64 and 128, so the seventh round ends with 128 above 64.
6 7 The four digits are 5, 0, 7 and 1, and the largest is 7.
7 110 The even numbers from 2 to 20 are ten values averaging 11, so the total is 110.
8 9 numbers Three outer rounds times three inner rounds give nine numbers, and the last one is 9.
9 100 The list collects the squares of 1 to 10, so the last element is 10 squared, which is 100.
10 15, using range(1, 6) The upper bound of range is excluded, so range(1, 5) stops at 4; range(1, 6) is needed to include 5.

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 →