Pillars of OOP Flashcards

1
Q

Object-oriented programming is based on four pillars, concepts that

A

differentiate it from other programming paradigms(system of concepts)

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

4 pillars

A

Abstraction
Encapsulation
Inheritance
Polymorphism

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

Abstraction

A

model of a real-world object or phenomenon,
limited to a specific context, which represents all details relevant to this context with high accuracy and omits all the rest.

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

each object has
an interface —

A

a public part of an object, open to interactions
with other objects

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

Encapsulation is

A

the ability of an object to hide parts of its
state and behaviors from other objects, exposing only a limit-
ed interface to the rest of the program.

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

To encapsulate something means to make it

A

private and thus
accessible only from within of the methods of its own class.

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

There’s a little bit less restrictive than private mode called

A

protected that
makes a member of a class available to subclasses as well.

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

the interface mechanism (usually declared with the
interface or protocol keyword) lets you

A

define contracts of
interaction between objects.

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

Inheritance is

A

the ability to build new classes on top of exist-
ing ones.

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

he main benefit of inheritance is

A

code reuse.

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

The consequence(result) of using inheritance is that

A

subclasses have
the same interface as their parent class. You can’t hide a
method in a subclass if it was declared in the superclass. You
must also implement all abstract methods, even if they don’t
make sense for your subclass.

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

In most programming languages a subclass can extend only

A

one superclass.

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

any class can implement
several

A

interfaces at the same time

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

if a superclass implements an interface,

A

all of its subclasses
must also implement it.

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

Polymorphism is

A

the ability of a program to detect the real class of an object and call its implementation even when its real
type is unknown in the current context.

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

You can also think of polymorphism as the ability of an object
to

A

“pretend” to be something else, usually a class it extends or
an interface it implements.