03 - Objects as a Programimng Concept Flashcards

1
Q

What are instance attributes?

A

Attributes (fields) that belong to each instance of the class

Example: Every dog has its own colour.

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

What are class attributes?

A

Attributes that belong to the entire class

Example: An attribute that keeps a running total of how many instances there are of that class.

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

Define instance methods.

A

Methods that belong to the instance of the class

Example: getField(), setField()

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

Define class methods.

A

Methods that belong to the entire class and do not require an instance to call

Example: System.out.println()

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

What is decomposition in object-oriented programming?

A

The process of breaking down complex objects into simpler objects to understand them better.

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

What does ‘dependency’ mean in the context of object relationships?

A

A basic relationship where one entity is dependent on another, described as a ‘USES’ relationship.

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

What is aggregation in object relationships?

A

A form of association where one object ‘HAS A’ relationship with another, indicating a directional association.

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

What is composition in object relationships?

A

A stronger form of association where the contained object is fully encapsulated within another object and is destroyed with it.

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

What is the relationship indicated by ‘IS A’?

A

An inheritance relationship where one class is a subtype of another.

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

How is inheritance implemented in Java?

A

Using the keywords ‘extends’ for classes or ‘implements’ for interfaces.

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

Why is reducing dependencies between objects important?

A

It decreases maintenance overheads and simplifies system updates.

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

What are the four key data types in Java?

A

1) Integer (int)
2) Real (double)
3) String (String)
4) Boolean (boolean)

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

How much RAM does a boolean type use in Java?

A

1 byte.

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

How much RAM does an integer type use in Java?

A

4 bytes.

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

How much RAM does a real type use in Java?

A

8 bytes.

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

What are parameters in programming?

A

Special variables used in subroutines/methods/functions to refer to input data.

17
Q

What does the keyword ‘extends’ signify in Java?

A

It signifies that a class inherits from a parent class.