S6 ICT: object-oriented programming and debugging (basics)
- 2026-11-20
S6 ICT: object-oriented programming and debugging (basics)
Basics first: class and object, attribute and method, constructor, then the three kinds of program error.
Basics: classes, objects and three kinds of error Object orientation starts with the nouns. A class is the blueprint and an object an instance built from it; a class with 3 attributes and 5 objects holds 15 attribute values. Attributes store data, methods perform behaviour, and the constructor sets initial values. Program errors come in three kinds: a syntax error stops the program, a runtime error stops it at the offending line, and a logic error runs with a wrong result. A local variable lives inside a function, a global one throughout the program; return hands a value back while print only displays.
01 Paper details (check answers afterwards)
| Item | Detail |
|---|---|
| Questions | 10 |
| Suggested time | 25 |
| Difficulty mix | Foundation 3 · Intermediate 3 · Challenge 3 · Error redo 1 |
| Chapter | Chapter: S6 ICT: Object-Oriented Programming and Debugging |
| Level | Basics (10 items) |
02 Questions (10 items)
- FoundationWhat is a class and what is an object, and how do they differ?
- FoundationInside a class, how do attributes differ from methods?
- FoundationWhat is the purpose of a constructor?
- IntermediateA class has 3 attributes and the program creates 5 objects. How many attribute values are stored in total?
- IntermediateA missing colon stops the program from running. Which kind of error is that, and which kind is division by zero at run time?
- IntermediateA program runs but reports a wrong average because total is divided by (n – 1). Which kind of error is this?
- ChallengeHow do a local variable inside a function and a global variable outside it differ in scope, and what happens when they share a name?
- ChallengeHow does return differ from print?
- ChallengeThe program sets n = 7 then runs while n > 1: n = n // 2. How many times does the loop run and what is n at the end?
- Error redoCorrect three confusions: an object is a class; an attribute is an action the object performs; a method stores data.
03 Answers and one-line notes
| # | Answer | One-line note |
|---|---|---|
| 1 | A class is the blueprint that defines attributes and methods; an object is an instance built from it, with its own attribute values. | The class comes first, and one class can create many objects. |
| 2 | An attribute stores the object data, while a method performs a behaviour and is really a function. | A method call carries brackets; an attribute reference does not. |
| 3 | It runs automatically when an object is created, receiving parameters and setting the initial attribute values. | In Python the constructor is __init__, with two underscores on each side. |
| 4 | 15 (5 x 3). | Each object keeps its own copy of every attribute, so multiply objects by attributes. |
| 5 | The missing colon is a syntax error and the program never runs; division by zero is a runtime error that stops the program at that line. | Syntax errors are caught while parsing; runtime errors appear only on particular inputs. |
| 6 | A logic error: the program runs but the output does not meet the design requirement. | A logic error produces no message, so only tests and manual checking reveal it. |
| 7 | A local variable exists only inside the function and disappears when it ends; a global variable exists throughout the program. When the names clash, the local one shadows the global one. | Changing a global inside a function requires an explicit global declaration, otherwise a new local variable is created. |
| 8 | return hands a value back to the caller so it can be used again; print only displays text on the screen and returns no usable value. | A function without a return statement returns None. |
| 9 | 2 times, and n ends at 1 (7 becomes 3, then 1). | Integer division rounds down, so 3 // 2 gives 1 and the loop condition fails. |
| 10 | A class is the blueprint and an object is an instance; attributes store data; methods perform actions. | Separate blueprint from instance first, then data from behaviour; the two dimensions are not interchangeable. |
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 to separate class from object and inheritance from polymorphism, then debug with a real debugger instead of scattered print calls? Book a TutorZone tutor and link the concepts to practice in twenty-five minutes.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.



