Top 30 OOPS Interview Questions

Coding Tag provides you a bunch of Top 30 OOPS concept interview questions. These C++ interview questions are taken from basic to advance level concepts to crack any MNC interview.

1) What do you mean by programming language?

As we all know that a computer is an electronic device used for computation task. It does not have its own brain to do work. To make computer to do any task we need to provide him some instructions and those instructions are known as a program and the person who is giving that instructions are known as a programmer and the language in which these instructions are written is known as a programming language. There are many programming languages available nowadays for e.g. C, JAVA, PYTHON  and many more. C++ is also one of them.

2) When was the C++ discovered?

Bjarne Stroustrup in 1979.

3) C++ Language consist of?

C++ is known as C with classes as it contains features of C and OPPS concepts of Simula 67 and in 1983 the C with classes is renamed as C++ language.

4) What are the main benefits of C++ programming language?

  • Web browsers
  • Games
  • For building another programming languages like JAVA
  • GUI Applications
  • Compilers
  • Simulation Software
  • Image editing software like ADOBE
  • And many more

5) Name the basic tools used to create any C++ Application?

The archiver, linker, and compilers are the three basic tools required to convert source file of C++ into an executable file.

6) What is the requirement of IDE in C++?

You need to pass input and output files along with important configuration as a text in command line tools to get specific outputs from specific programs. Invoking these tools with repeated text as the time of developing any program is more deadening and time-consuming. To solve this problem IDE is used to describe the binary values and organizing the source files with buttons as it provides the graphical interface.

Most common C++ IDE are:

Code Warrior

Code Block

Visual C++

7) Namespace in C++?

The namespace can be referred as a declarative region or part, in which various elements of the program can be is used to manage or organize the large program.

8) What is the extension of C++ file?

.CPP is the extension of the file saved in C++

For example codingtag.cpp

9) Before using any variable if it is not defined it will generate an error as in given program?

Int age=7;

Float avg;


Yes, it will generate an error because b is not declared.

10) What is the need for object-oriented programming language if there is already a readable c programming language?

C is the structural and procedural language as it contains a proper structure such as looping, decision-making constructs, function and various applications still there is the problem in C language because of

the following reason

  • the approach of c language is to divide the huge logic into a set of functions i.e.overall emphasis is on functionality not on data inside it, the program is manageable on certain limits.
  • less secure

for e.g.

if you have 45000 lines of code, even you break down this huge code into 5 functions. Each of these 5 functions contain 9000 lines. Even these function are not manageable because we are not able to debug the 9000 lines of code at once.when we want to share data among these 5 function. We need to pass an argument to same data it will waste memory, to avoid this, some data is made global and but global data can be accessed by any function it will reduce security. Every MNC company cares about data, not on functionality and invest on the security of data they don’t want to place data public. This is the reason why object-oriented language is used.

11) What do you mean by object-oriented programming?

The activity of simulating the real life things in the code is known as object-oriented programming.

12) What do you mean by objects in C++?

The object can be referred to as the small part of code representing a real-time entity or real life things. every object have their own characteristics known as attributes and functionality can be called as its behavior. Example of Attributes can be the type, color, or dimensions. In programming language attributes are mapped with variables and functionality are mapped with function. attributes correspond to data members whereas behaviors correspond to function.

13) Is it possible for the virtual function to be achieved in C programming language?

Yes, it is possible with pointers to function or function pointers.

14) What is a virtual function?

A virtual function is known as the member function of the class that can be redefined in derived classes. The implementation can be done with the keyword known as virtual that can be given while declaring a function. virtual functions are primarily used to attain Runtime polymorphism.

15) Friend Function?

Data hiding is an interesting concept found in an object-oriented language. With that data hiding, non-member function is not allowed to access private and protected information of an object. The programmer needs to write lengthy and complex code to access that data. You can access that data with the help of friend function. It  can be declared in any place in the class declaration and allowed to access the public, protected and private data in the same class.

16) What is operator overloading?

Operator overloading means multiple jobs. In C++, it is known as the form of polymorphism where the operator is overloaded to achieve meaningful operation on the user-defined data type. We can assume + basic application of addition is to add numeric values i.e. 5+9 =14; it is possible to add objects also with + symbol i.e. obj7= obj2 + obj5 with the operator overloading. Thus, it can be overloaded to achieve various addition on different data types such as String(concatenation), Integer etc.

17) List few names of Operators not overloaded in C++?

  • Dot operator-.
  • scope operator-::
  • member pointer selector – *
  • Pointer-to-member operator (.*)
  • Ternary operator – ?:
  • (typeid)object type operator
  • (Sizeof)object size operator

18) Ternary operator in C++?

The ternary operator is known as a conditional operator that precedes three arguments. Data types and results contain different data types depends upon the function.

The syntax of the ternary operator is Exp2? exp3: exp4

The expression exp2 will always evaluate. Depends on the outcome of exp2 is responsible for the Execution of exp3 and exp4. If the result of exp1 is non zero exp3will be evaluated, otherwise exp4 will be evaluated.

19) Abstraction?

Abstraction is one of the considerable concepts of OOPS as it is used to display only the relevant and required details of an object.

Example-when anyone wants to enjoy the air of fan in summer, he wants to switch on the fan; it is not required for him to show all the features inside that fan. Whatever is required to switch on the fan will be displayed by the use of abstract class

20) Is it possible without creating an instance, you can able to call the base method in C++?

Yes, it is possible with the use of inheritance, but the method should be a static method.

21) Name the different access specifiers found in C++ language?


22) What are sealed modifiers?

Sealed modifiers are identical to access modifiers but the only difference is that they cannot be inherited and can be easily applied to the events, properties, and methods except static members and static methods

23) What is the default access modifier found in class in OOPS?


24) What is a pure virtual function?

A pure virtual function is a virtual function that cannot be defined but can be overridden in the derived class.

The operator =0 can be used to declare any virtual function as a pure virtual function.

25) Is it possible to override the method with virtual keyword represented in method definition?


26) Is reuse mechanism possible in OOPS?

Yes, it is possible with the inheritance concept of OOPS

27) What is ‘this’ pointer?

‘THIS’ pointer is referred to the current object of a class. It also differentiates the global object with a current object.

28) Is it possible to call the function of c program in the C++ program?

With the use of extern “C” declaration, it is possible to call the c function in C++ program.

29) What do you mean by mutable modifiers in C++?

As we know that the data members and member functions of a constant object and class cannot be modified but if we want some modifications, the mutable keyword can be used.

30) What do you mean by reference variable in C++?

A reference variable can be called as another name of existing variable. It is similar to a pointer in C with some differences as it is declared with & Operator.

Related Articles:

1. Top 30 C language Interview Questions

Leave a Reply

Notify of