OOdesign Flashcards

1
Q

What is OOP

A

Object Oriented Programming; Programs are considered as a collection of objects. Each object is nothing but an instance of a class

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

What are the basic concepts of OOP

A

Abstraction, Encapsulation, Inheritance, Polymorphism

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

What is a class

A

A class is a representation of a type of object; it is the blueprint that describes the details of an objet

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

What is an object

A

An object is an instance of a class; it has its own state, behavior and identity

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

Encapsulation

A

Encapsulation is an attribute of an object, and it contains all data which is hiddent. The hidden data can be restricted to the members of that class

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

Polymorphism

A

Polymorphism is nothing but assigning behavior or value in a subclass to something that was already declared in the main class. Simply, polymorphism takes more than one form.

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

Inheritance

A

Inheritance is a concept where one class shares the structure and behavior defined in another class. Ifinheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is called multiple Inheritance.

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

Constructor

A

Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation

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

Function Overloading

A

Function overloading is defined as a normal function, but it has the ability to perform different tasks. It allows the creation of several methods with the same name which differ from each other by the type of input and output of the function.

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

Abstract Class

A

An abstract class is a class which cannot be instantiated. Creation of an object is not possible with an abstract class, but it can be inherited. An abstract class can contain only Abstract method. Java allows only abstract method in abstract class while for other languagesit allows non-abstract method as well

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

Call by value

A

Value passed will get modified only inside the function, and it returns the same value whatever it is passed it into the function

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

Call by reference

A

Value passed will get modified in both inside and outside the functions and it returns the same or different value

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

Method Overridding

A

Method overriding is a feature that allows sub class to provide implementation of a method that is already defined in the main class. This will overrides the implementation in the superclass by providing the same method name, same parameter and same return type.

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

Interface

A

An interface is a collection of abstract method. If the class implements an inheritance, and then thereby inherits all the abstract methods of an interface

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

Difference between overloading and overridding

A

Overloading is static binding whereas Overriding is dynamic binding. Overloading is nothing but the same method with different arguments , and it may or may not return the same value in the same class itself. Overriding is the same method names with same arguments and return types associates with the class and its child class.

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

Difference between a class and an object

A

An object is an instance of a class. Objects hold any information , but classes don’t have any information. Definition of properties and functions can be done at class and can be used by the object

17
Q

Abstraction

A

Abstraction is a good feature of OOPS , and it shows only the necessary details to the client of an object. Means, it shows only necessary details for an object, not the inner details of an object. Example – When you want to switch On television, it not necessary to show all the functions of TV. Whatever is required to switch on TV will be showed by using abstract class

18
Q

Access Modifiers

A

Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes

19
Q

Access Modifiers (types)

A

Private, Protected, Public, Friend, Protected Friend

20
Q

How to call base method without creating an instance

A

Static method Use Base Keyword from derived class

21
Q

This

A

THIS pointer refers to the current object of a class. THIS keyword is used as a pointer which differentiates between the current object with the global object. Basically, it refers to the current object

22
Q

Pure virtual function

A

A pure virtual function is a function which can be overridden in the derived classbut cannot be defined. A virtual function can be declared as Pure by using the operator =0.

23
Q

Virtual

A

The method can be overridden

24
Q

Can an instance of an abstract class be created?

A

No

25
Q

Which OOP concept is used as a reuse mechanism

A

Inheritance is the OOPS concept that can be used as reuse mechanism

26
Q

Exposes only the necessary information

A

Encapsulation