Skip to main content

Back to the full dot-point answer

SingaporeComputer ScienceQuick questions

Programming and Software Development

Quick questions on Object-oriented programming explained: H2 Computing

7short Q&A pairs drawn directly from our worked dot-point answer. For full context and worked exam questions, read the parent dot-point page.

What is encapsulation?
Show answer
Encapsulation bundles data with the methods that use it and hides the internal data behind those methods. In Python a leading double underscore marks an attribute as private:
What is inheritance?
Show answer
Inheritance lets a subclass acquire a parent class's attributes and methods, then add or override behaviour:
What is polymorphism?
Show answer
Polymorphism lets objects of different classes be used through a common interface, each responding to the same call in its own way:
What is not calling the constructor correctly?
Show answer
Creating an object runs __init__; missing required arguments raises an error, and attributes set there must exist before methods use them.
What is q1?
Show answer
Distinguish between a class and an object. [2 marks]
What is q2?
Show answer
How does encapsulation protect an object's data? [2 marks]
What is q3?
Show answer
What does it mean to override a method in a subclass? [1 mark]

Have a question we have not covered?

This dot-point answer is short enough that we have not extracted many short questions yet. Read the full dot-point answer or ask Mo, our study assistant, in the chat for follow ups.

All Computer ScienceQ&A pages