Paper 1: File handling basics
Chapter practice with ten items, answers and a one-line note for each, about 25 minutes.
| 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 | Basic |
| # | Answer | One-line note |
|---|---|---|
| 1 | It is cleared. | ‘w’ truncates the file first, so old data is lost. |
| 2 | To the end of the file. | ‘a’ appends, so new data always follows existing content. |
| 3 | 4 elements. | One element per line, each keeping its newline character. |
| 4 | When the with block ends. | Even if an exception occurs inside, with still closes the file. |
| 5 | FileNotFoundError. | Check the path first or catch that exception directly. |
| 6 | ZeroDivisionError. | A zero divisor must be checked or caught. |
| 7 | 4 fields. | Comma-separated text files are usually split this way. |
| 8 | 12 fields. | 3 lines times 4 fields gives 12. |
| 9 | 3.0, a float. | Single-slash division always returns a float, even when exact. |
| 10 | ‘a’ mode. | ‘w’ clears the whole file, while ‘a’ appends. |
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.

