1.2.4 Types of Programming Language (Object-Oriented Programming) Flashcards

(13 cards)

1
Q

What is a class?

A

The blueprint for defining methods and attributes that can be used to create objects

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

What is an object?

A

An instance of a class, it holds specific data values for the class attributes.

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

What is a method?

A

They are procedures/functions defined inside a class.

What actions an object can do

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

What is an attribute?

A

Attributes are variables inside a class.

What an object is or has

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

What are the two types of attributes?

A

1) Private attributes → only accessible within the class

2) Public attributes → accessible from outside the class (less common)

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

Why are attributes usually kept private?

A
  • To protect the data
  • Use encapsulation by controlling access through methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is encapsulation?

A

The bundling of methods and attributes into a class

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

What is inheritance?

A

The concept that subclasses can inherit methods and attributes from its parent class (e.g. super)

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

What is polymorphism?

A

The concept that allows objects to take on different forms

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

How is encapsulation implemented in pseudocode?

A

Restricting access using private and public with getters/setters

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

What is a getter method?

A

A public function used to retrieve the value of a private attribute.

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

What is a setter method?

A

A public procedure used to change the value of a private attribute.

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

What is method overriding?

A

When a subclass defines a method with the same name as one in its superclass to provide specific behaviour.

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