OOP Flashcards

1
Q

Polymorphism

A

Having multiple forms. An object could have multiple forms. Compile time polymorphism is method overloading. Runtime version is done via inheritance and interfaces.

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

Method overloading and method overriding

A

Overloading: create a method of the same name, but different return values
Overriding: Create your own implementation of an existing method

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

Can you override a private or static method in Java

A

No.

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

Features of OOP

A
Encapsulation, Polymorphism, Ineheritance
Abstraction
Composition
Association
Aggregation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain Encapsulation

A

Restricting data access of variables in an object. Restricting methods to an object

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

Explain abstraction

A

Concept of oops to construct an object related to the real world. Only general states and behaviors are defined. More specifics are left to be defined by the implementers

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

What is a class

A

Template of an object

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

What is an object

A

An instance of a classin

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

Static binding

A

Also called early binding. Resolving an association at compile time. Example method overloading

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

Dynamic binding

A

Also called late/virtual binding. Resolving an association at run time.

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

Override vs Overload

A

Override: same function name different signature. This is done by creating a method of the same name. But different parameters. This is compile time polymorphism.

Overload: same function name AND signature. Usually used when you want to extend/reuse functionality. This is known as run time polymorphism.

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