Object Oriented Programming Flashcards

1
Q

What is the difference between Attributes and Methods?

A

Attribute is a variable associated with an object.
Method is a function associated with an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In Object-Oriented Programming, what is an object?

A

A data type which can have associated attributes and methods.
An object is instantiated from a class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Encapsulation?

A

The bundling of data, and the methods that act on that data, into an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name the 3 OOP Principles

A

Encapsulation
Inheritance
Polymorphism

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Inheritance?

A

The ability of a child class to access public methods of a parent class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Polymorphism?

A

Polymorphism is the ability of methods with the same name in different classes to exhibit different behaviours at runtime.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the purpose of encapsulation?

A

Encapsulation protects the data against inadvertent modification. It also separates the interface of the object or class from its implementation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of inheritance?

A

To promote code reuse.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of polymorphism?

A

Polymorphism promotes code generalisation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly