/en-tutor-prep-s5-ict-file-handling-exceptions-practice-3/
/en-tutor-prep-s5-ict-file-handling-exceptions-practice-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

Paper 3: Exceptions in depth

Paper 3: Exceptions in depth

  • 2026-11-21

Paper 3: Exceptions in depth

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

Paper 3 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: File handling and exceptions
Level Challenge

02 Questions (10 items)

  1. FoundationOf 100 data lines, 7 are malformed and skipped by except; how many succeed?
  2. FoundationFrom the previous item, what percentage succeeds?
  3. Foundation2500 lines of 40 bytes each; what is the file size in bytes?
  4. FoundationFrom the previous item, how many KiB is that (1 KiB = 1024 bytes, two decimals)?
  5. IntermediateA loop runs 1000 times and 5 exceptions are caught; what is the failure rate?
  6. Intermediate12 users each open 5 files without closing them; how many file handles are held?
  7. ChallengeWith several except branches, which one should come first?
  8. ChallengeWhich keyword raises an exception deliberately?
  9. Error redoAfter catching an exception, how do you get the message text?
  10. Error redoUsing try and finally instead of with, what must finally contain to close the file?

03 Answers and one-line notes

# Answer One-line note
1 93 lines. 100 minus 7 gives 93; the rest are written normally.
2 93.0 percent. 93 out of 100 times 100 gives 93.0.
3 100000 bytes. 2500 times 40 gives 100000 bytes.
4 97.66 KiB. 100000 divided by 1024 gives 97.66 KiB.
5 0.5 percent. 5 out of 1000 times 100 gives 0.5.
6 60 handles. 12 times 5 gives 60; exhausting handles makes later opens fail.
7 The more specific subclass first. Branches match top to bottom, so list subclasses before their parents.
8 raise. raise takes an exception class or instance to stop on invalid data.
9 Use str(e). as e binds the exception object; str(e) gives a readable message.
10 f.close(). finally guarantees the block runs, but the close call must be written.

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 →