Back to marketplace

OOP questions

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

Advantages of OOP

Back (Answer)

• Can modify and maintain existing code more easily. • Reuse of code in other programs through libraries • Clear modular structure with a defined interface -> can abstract and hide away details.

#2
Front (Question)

Advantages of Constants

Back (Answer)

• They have meaningful identifiers which make code easier to follow and maintain • Constants only have to be updated in one place if the value changes.

#3
Front (Question)

“Inherits” meaning

Back (Answer)

The child class gains all of the non-private methods of the parent and all of the attributes of the parent.

#4
Front (Question)

What is Aggregation Association?

Back (Answer)

• Weaker association • The child class cannot exist independently of the parent class • Real-life example: A person in a car

#5
Front (Question)

What is Composition association?

Back (Answer)

• Stronger association • The child class cannot exist independently of the parent class. • Real-life example: A wheel of a car

#6
Front (Question)

What is encapsulation?

Back (Answer)

• Used to hide data and methods, which prevents them from being accessed and changed. • Distinguishes attributes/methods as public, protected and private.

#7
Front (Question)

What is a public method / attribute ?

Back (Answer)

A method/attribute accessible from outside the class.

#8
Front (Question)

What is a private method/attribute?

Back (Answer)

Private methods/attribute are accessible in their own class

#9
Front (Question)

How can you access private attributes?

Back (Answer)

Using a defined method, e.g. GetSymbol()

#10
Front (Question)

What are protected methods / attributes?

Back (Answer)

Only current class can access methods / attributes.

#11
Front (Question)

What programming language doesn’t recognise protected attributes / methods?

Back (Answer)

Python!

#12
Front (Question)

How can you update private attributes?

Back (Answer)

Using a setter method. E.g. ChangeSymbolInCell()

#13
Front (Question)

What is Overriding?

Back (Answer)

When a method in a child class overrides a method or attribute in a parent class.

#14
Front (Question)

What is Polymorphism?

Back (Answer)

Allows us to have a function that can take on many forms of its parameters by using overriding. E.g. the built in function len ()

#15
Front (Question)

What is a static attribute?

Back (Answer)

Static attributes are defined for the class and can be accessed without creating an object instance.

#16
Front (Question)

What is an abstract method?

Back (Answer)

The method isn’t supplied in the base class, which forces the method to be implemented in the subclass (child class)

#17
Front (Question)

What is a static method?

Back (Answer)

A method that doesn’t need to be accessed through object instantation.

#18
Front (Question)

What is a virtual method?

Back (Answer)

A method defined in a superclass that can be overridden by methods in a subclass.

#19
Front (Question)

What is the difference between an abstract and virtual method?

Back (Answer)

Virtual methods have implementation, whereas abstract methods do not.

#20
Front (Question)

What is special about every method in Python?

Back (Answer)

All methods in Python are virtual.

#21
Front (Question)

What is an interface?

Back (Answer)

A class containing abstract methods. It enforces classes to have a fixed set of methods, with the methods being run from the class and not the interface.

#22
Front (Question)

How do you indicate inheritance in a UML class diagram?

Back (Answer)

Have the child class pointing to the parent class using an arrow with its head shaded in.

#23
Front (Question)

How do you indicate composition in a UML class diagram?

Back (Answer)

Using an arrow with its head as a shaded in black diamond.

#24
Front (Question)

How do you indicate aggregation in a UML class diagram?

Back (Answer)

Using an arrow with its head as a white diamond.