Fundamentals of Programming Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Define Instantiation

A

The process of an object being created from a class template.

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

What is encapsulation?

A

The bundling of attributes and methods into a single object, typically called a class.

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

How does information hiding work?

A

Each object should only expose a high-level interface for using it. This interface should hide internal implementation details, only revealing operations necessary for other objects.

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

Explain how inheritance works?

A

Objects share common logic.
Parent class contains common logic.
Child classes contain unique logic.
The child class reuses all fields and methods as well as implementing its own.

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

Explain the concept of overriding.

A

Each child class implements its own version of a method it inherits.

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

Describe relationships for following: inheritance, aggregation, composition

A

Inheritance:
A cat “is a” animal

Association:
A student “has a” teacher
A teacher “has a” student

Composition:
A page is “part of” a book

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

In composition, if the container is destroyed, what happens to the contained class?

A

It cannot exist independently, it is also destroyed.

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

In aggregation, can a child and parent class exist independently.

A

Yes, if a car is destroyed the engine doesn’t need to be destroyed as well.

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

How is aggregation represented?

A

Open diamond towards the container.

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

How is composition represented?

A

Filled diamond towards the container.

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

How is inheritance represented?

A

Open arrowhead that points to the parent class.

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

What is the structured approach?
What are the advantages?

A

The process of taking a big problem and breaking it down into smaller problems.

Saves time, and reduces risks and bugs.

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

Compare public, private, and protected methods and attributes.

A

Public:
Accessible from any part of the program

Private:
Only accessible within the class

Protected:
Accessible within the class and its subclasses

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