Basics Of OOPs: C plus plus Class Notes

Updated: Aug 18

Mobiprep has created last-minute notes for all C++ and templates to help you with the revision of concepts for your university examinations. So let’s get started with the lecture notes on C++.

  1. Basics of C plus plus

  2. Basics Of OOPs

  3. Classes and Objects

  4. Polymorphism and Inheritence

  5. Exception Handling

  6. File Handling and templates

Our team has curated a list of the most important questions asked in universities such as DU, DTU, VIT, SRM, IP, Pune University, Manipal University, and many more. The questions are created from the previous year's question papers of colleges and universities.


  1. What is the need of Object-Oriented Programming paradigm?

  2. Describe the characteristics of OOP.

  3. Define Data Abstraction

  4. Define Data members and member functions.

  5. Compare and contrast the structured programming and object.

  6. List and define the two types of Polymorphism.

  7. Define Dynamic Binding.

  8. Define Message Passing.

  9. What is the return type of main ()?

  10. Compare and Contrast late binding and early binding.

Basics Of OOPs


Question 1) What is the need of Object-Oriented Programming paradigm?

Answer) 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.


 

Question 2) Describe the characteristics of OOP.

Answer)

  1. 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.

  2. 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.

  3. 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.


 

Question 3) Define Data Abstraction

Answer) 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.


 

Question 4) Define Data members and member functions.

Answer) 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 (::).


 

Question 5) Compare and contrast the structured programming and object.

Answer)

​Structured Programming

​Object-Oriented Programming

For each task, a procedure is created and are called from main.

Works on objects (smallest unit of OOP). Focuses more on data than Procedure

Follows Top Down Approach

​Follows Bottom Up Approach

No proper way of data hiding, less secure.

Provides data hiding, more secure.

Overloading is not possible.

Overloading is possible (Function and Operator)

Doesn’t have any access specifier

Has Access specifiers (Public, Private, Protected)

Example- C, FORTRAN

Example- C++, JAVA


 

Question 6) List and define the two types of Polymorphism.

Answer) 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.

 

Question 7) Define Dynamic Binding.

Answer) 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.

 

Question 8) Define Message Passing.

Answer) 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.

 

Question 9) What is the return type of main ()?

Answer) 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.


 

Question 10) Compare and Contrast late binding and early binding.

Answer)

Late Binding

Early Binding

Functions, methods, variables and properties are detected and checked only at the run-time.

Object is assigned to a variable declared to be of a specific object type

Compiler does not know what kind of object or methods of an object contains until run time.

Early binding objects are basically a strong type objects or static type objects.

Advantage- Objects of this type can hold references to any object

Advantage-for performance and ease of development.
















9 views0 comments

Recent Posts

See All