/en-tutor-prep-s2-ict-programming-basics-python-variables-loops-practice-4/
/en-tutor-prep-s2-ict-programming-basics-python-variables-loops-practice-4/
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

Paper 4: Common mistakes corrected

Paper 4: Common mistakes corrected

  • 2026-11-21

Paper 4: Common mistakes corrected

Chapter practice with ten items, answers and a one-line note for each, about 25 minutes.

Paper 4 Ten items on this chapter with answers for immediate marking.

01 Paper details (check answers afterwards)

Item Detail
Questions 10
Suggested time 25
Difficulty mix Foundation 4 · Intermediate 2 · Challenge 2 · Error redo 2
Chapter Chapter: Programming basics: variables and loops
Level Retry

02 Questions (10 items)

  1. FoundationWhy does print(“3” + 4) fail?
  2. FoundationA beginner expects range(5) to give 1 to 5. What does it give?
  3. FoundationA print inside a while loop loses its indentation. What happens?
  4. FoundationTo get the whole number 3 from 7 and 2, which operator is used?
  5. IntermediateNaming a variable 2total raises which error?
  6. IntermediateWhat happens when if x = 5: is run?
  7. ChallengeAn accumulator total is never set to 0 before the loop. What happens?
  8. ChallengeAfter for i in range(3) finishes, what is i?
  9. Error redoint(“12.5”) fails. Which conversion works?
  10. Error redoOne block mixes two-space and four-space indents. Which error appears?

03 Answers and one-line notes

# Answer One-line note
1 Text cannot be added to an integer; use str(4) Convert one side so both types match, with str or int.
2 It starts at 0 and gives 0 to 4 range counts from 0, so start from 1 by writing range(1, 6).
3 The print runs once, after the loop finishes Indentation decides whether a statement belongs to the loop.
4 7 // 2 A single slash gives 3.5 while a double slash returns the whole quotient.
5 A syntax error, as a name cannot start with a digit Use total_2 or total2 instead.
6 A syntax error, because comparison needs two equals signs One equals sign assigns a value rather than comparing it.
7 A NameError on the first pass The name is read before it exists, so the program stops.
8 2 i keeps its last value, which is 2.
9 Use float(“12.5”) int accepts whole-number text only, so text with a decimal point needs float.
10 IndentationError Indentation must be consistent or Python cannot tell where a block ends.

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.

Want the whole chapter? See all four difficulty papers on the chapter page.Tutor 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 →