OOPS GENERAL Flashcards

1
Q

Why OOPS?

A

The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.

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

OOPS concepts

A
OOPs, Concepts:
Polymorphism
Inheritance
Encapsulation
Abstraction
Class
Object
Method
Message Passing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Polymorphism?

A

Differentiate between entities with the same name efficiently. This is done by Java with the help of the signature and declaration of these entities.
Polymorphism in Java is mainly of 2 types:
Overloading in Java
Overriding in Java

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

Inheritance

A

the mechanism in java by which one class is allowed to inherit the features(fields and methods) of another class. Inheritance supports the concept of “reusability”, i.e. when we want to create a new class and there is already a class that includes some of the code that we want, we can derive our new class from the existing class.

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

Syntax of inheritance

A
class derived-class extends base-class  
{  
   //methods and fields  
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Encapsulation?

A
It is a protective shield that prevents the data from being accessed by the code outside this shield.
Technically in encapsulation, the variables or data of a class is hidden from any other class and can be accessed only through any member function of its own class in which they are declared.
Encapsulation can be achieved by Declaring all the variables in the class as private and writing public GETTERS and SETTERS.
Also defined as wrapping up of data under a single unit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Encapsulation is also known as ….?

A

Data Hiding, the data in a class is hidden from other classes

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

Abstraction?

A

Data Abstraction is the property by virtue of which only the essential details are displayed to the user. The trivial or the non-essentials units are not displayed to the user.

In java, abstraction is achieved by interfaces and abstract classes. We can achieve 100% abstraction using interfaces.

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

How to implement abstraction?

A

In java, abstraction is achieved by interfaces and abstract classes. We can achieve 100% abstraction using interfaces.

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

Class?

A

Class: A class is a user-defined blueprint or prototype from which objects are created.

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