Object Oriented Programming Flashcards

1
Q

What are the 4 pillars of object oriented programming?

A

Encapsulation, Abstraction, Inheritance, and Polymorphism

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

In OOP
Variables are called?
Functions are called?

A

Property
Method

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

What is encapsulation?

A

Encapsulation is the packing of data and functions into one component (for example, a class) and then controlling access to that component to make a “blackbox” out of the object.

The process of wrapping code and data together into a single unit.

Information hiding

Example: wraps variables and functions into a class which can be made private, so the variables can’t be accessed unless they are made public or through a public method

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

What is Abstraction?

A

Displays only essential information and hides the details.

Implantation hiding

Its main goal is to handle complexity by hiding unnecessary details from the user. That enables the user to implement more complex logic on top of the provided abstraction without understanding or even thinking about all the hidden complexity.

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

What is Inheritance?

A

It used to inherit attributes and methods of a class.

Inheritance is a useful feature that allows code reusability.

The process where one class acquires the attributes and methods of another.

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

What is Polymorphism?

A

that provides a way to perform a single action in different forms. It provides an ability to call the same method on different JavaScript objects.

Polymorphism is the OOPs principle which provides the facility to perform one task in many ways.

Poly means many and morphism means many forms. Your classes can do the same thing in many ways.

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

What is an object in JavaScript?

A

It’s basically a collection of key value pairs

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

TRUE OR FALSE:
The first letter of a Constructor function should be capitalized

A

True

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

What is an example of abstraction?

A

A user knows that my pressing the brakes in a car stops the car but doesn’t know mechanics on how it makes that happen

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