C plus plus Notes

mobiprep (6).png

Basics of C plus plus

mobiprep (6).png

Basics Of OOPs

mobiprep (6).png

Classes and Objects

mobiprep (6).png

Polymorphism and Inheritence

mobiprep (6).png

Exception Handling

mobiprep (6).png

File Handling and templates

Heading

Q

1

What is the need of Object-Oriented Programming paradigm?

LRM_EXPORT_207556595493866_20190724_1939

Ans

OOP was developed were discovered in earlier approaches of programming. The fundamental idea behind OOP approach was to combine ‘data and functions that operate on that data’ into a single unit called object. It deals with overall organization. In the earlier approaches of traditional programming, few problems arose which were solved by OOP.

LRM_EXPORT_207556595493866_20190724_1939

Q

2

Describe the characteristics of OOP.

LRM_EXPORT_207556595493866_20190724_1939

Ans

i. Encapsulation- The wrapping up of data and function into a single unit (called class) is known as encapsulation. It is the most striking feature of a class. OOP encapsulates data (attributes) and functions (behavior) into packages called objects.
ii. Polymorphism- Polymorphism is another important OOP concept. Polymorphism means the ability to take more than on form. An operation may exhibit different behavior in different instances.
iii. Inheritance- Inheritance is the process by which objects of one class acquires the properties of objects of another classes. In OOP, the concept of inheritance provides the idea of reusability.

LRM_EXPORT_207556595493866_20190724_1939

Q

3

Define Data Abstraction

LRM_EXPORT_207556595493866_20190724_1939

Ans

Abstraction refers to the act of representing essential features without including the background details or explanation. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, wait, and cost, and function operate on these attributes.

LRM_EXPORT_207556595493866_20190724_1939

Q

4

Define Data members and member functions.

LRM_EXPORT_207556595493866_20190724_1939

Ans

The variables which are declared in any class by using any fundamental data types or derived data type are known as Data Members. The public data members can be accessed using the direct member access (.) operator. A member function of a class is a function that has its definition within the class. Members are accessed using dot (.) operator. Member functions can be defined within the class definition or separately using scope resolution operator (::).

LRM_EXPORT_207556595493866_20190724_1939

Q

5

Compare and contrast the structured programming and object.

LRM_EXPORT_207556595493866_20190724_1939

Ans

LRM_EXPORT_207556595493866_20190724_1939

Q

6

List and define the two types of Polymorphism.

LRM_EXPORT_207556595493866_20190724_1939

Ans

The two types of Polymorphism are-
1. Run time Polymorphism- If the appropriate member function could be selected while the program is running. This is called run time polymorphism. This could happen due to the fact that C++ supports a mechanism known as virtual function.
2. Compile time Polymorphism- The compiler uses the information from functions and operators at compile time, and, hence, is able to select the appropriate function for a particular call at compile time. This is called early or static binding or static linking or compile time polymorphism.

LRM_EXPORT_207556595493866_20190724_1939

Q

7

Define Dynamic Binding.

LRM_EXPORT_207556595493866_20190724_1939

Ans

Binding means matching the function call with the correct function definition by the compiler. When selection of function is done dynamically at run time, it’s called dynamic binding.

LRM_EXPORT_207556595493866_20190724_1939

Q

8

Define Message Passing.

LRM_EXPORT_207556595493866_20190724_1939

Ans

An OOP consists of a set of objects that communicate with each other. Message passing involves specifying the name of object, the name of the function (message) and the information to be sent.

LRM_EXPORT_207556595493866_20190724_1939

Q

9

What is the return type of main ()?

LRM_EXPORT_207556595493866_20190724_1939

Ans

The return type defines and constrains the data type of the value returned from a method. In many programming languages the return type must be explicitly specified when declaring a function.

LRM_EXPORT_207556595493866_20190724_1939

Q

10

Compare and Contrast late binding and early binding.

LRM_EXPORT_207556595493866_20190724_1939

Ans

LRM_EXPORT_207556595493866_20190724_1939