• Have Any Question?
  • contact@eitworld.com

Cpp Interview


This site provides all the Basic Interview Questions on C++ Language in a bunch related to each IT subject present at this site. In the current era, when students are looking for a job then the technical questions related to the programming knowledge are asked into the interview to the interview-person. To prepare the technical round of the interview, job seeker has to clear this round by answering these questions. Here all the technical questions are available in the simplest form so that students can understand easily because this site’s purpose is to provide the easy learning at one click. Here all the C++ Interview Questions are available which goes up to basic level to advance level.

We know that after C language, C++ is the base programming language. Whenever we go for technical interview in the field of technology they ask you for C++ language. The companies make sure that the candidate should have the knowledge of the C++ programming. So they ask various questions to the interview person. Here we provide all the possible questions related to C++ Language Interview Questions because we know that C++ is another base language to keep the secure place in the IT companies.

We provide the facility for the frequently asked questions to the students directly without getting any cost from the users. It is totally free service for the students. Here eitworld.com provides the solution for the questions with the easy and simplest answer.

Here we provide all the C++ Interview Questions for Freshers which are asked in the interview room and asked commonly and provide the better answers to the questions in the efficient way and in the simplest form.

Eitworld.com also covers the various short question answers type to full fill the requirement of academics. So that students can take the advantage in their exam to lead the marks. It makes easy for the students who wish to attend the interview and clear it with great success. This successful tutorial is here provided which provides the great experience to the user even that user visits this site first time.

We know that related to C++ language is object oriented programming and it is the base for all the developers whose dreams to become a programmer but without clearing the C++ programming with OOPS concepts round and when no chance to get this job that’s why eitworld.com provides you C++ Interview Questions And Answers For Freshers for getting clear the interview round.

Eitworld.com offers you to C++ Interview Questions which goes up to higher level and provides all the things in the easy manner and in the simplest way to make your interview more clear. So we introduce eitworld.com which gives you C++ Programming Interview Questions without any cost. Once visit and always here for getting the better performance in your technical round.

You know that all companies want that our employee should have good knowledge in the C++ programming that’s why they should take your technical round related to C++ language but don’t worry eitworld.com provides the Interview Questions On C++ which clears your doubt and increase your knowledge.

Eitworld.com is the only place where you can get all the programming C++ question at one place so we offered C++ Basic Interview Questions and provides you the advance level questions also here. Just you have to visit eitworld.com and explore the Basic Questions on C++ which goes up to advance level and get the great success with happiness.

Now Let’s see the list of top C++ interview questions.

Q1 What is C++ programming language?

Answer: C++ is a general purpose object oriented and case sensitive programming language.is an extension of C language with too many new features added.

Q2 Who is the founder of the C++?

Answer:It was developed by the Bjarne Stroustrup at AT & T’s bell laboratories in the Murray Hill, New Jersey, USA in 1979 with the name “C with Classes” but later in 1983 it was renamed as C++.

Q3 C++ is high level or middle level or low level language. Explain?

Answer:Like C language C++ is also a middle level language that combines the features of high level language (ADA, BASIC and COBOL etc) and low level language (assembly language).

Q4 List all the main OOPs features supported by C++?

Answer:C++ is an object oriented programming language which supports the following parameters of objects oriented paradigm:

  • Classes
  • Inheritance
  • Polymorphism
  • Encapsulation
  • Data Abstraction

Q5 Give some standard libraries provided by the C++?

Answer:C++ provides three types of libraries as follows:

  • Core library: It includes data types, literals, and variable.
  • Standard library: It includes set of functions to manipulate the strings, files etc.
  • Standard template library: it provides the various methods to deal with data structure.

Q6 which type of application can be developed using C++?

Answer:We can develop window application, client server application, device drivers, and embedded firmware application etc.

Q7 Give one difference between C and C++?

Answer:Function overloading is not possible in C language. But In C++, function overloading can be performed easily.

Q8 write some features of C++?

Answer:There are several features of C++ as follows:

  • C++ is a simple programming language.
  • C++ is a structured programming language.
  • C++ provides the facility to manage the memory or space means memory management.
  • It is a compiler based language.
  • It provides faster execution of the programs.

Q9 What is character set in C++?

Answer:Character set can be a collection or combination of various letters, digits and symbols which can be used in C++ program to specify or to define the variable names, function name or it can be class name.

Q10 What is keyword in C++?

Answer:C++ language contains some reserved words having some special meaning called keywords. The Meaning of each keyword is fixed. We cannot change the meaning of keywords.

Q11 What is identifier in C++?

Answer:Identifiers are the name given to the various programming elements like variables, array, functions and structures etc. In simple words, identifiers are used to give the name for elements or it is used to identify the elements of the program which we use in the program uniquely.

Q12 What is the definition of Data type in C++?

Answer:Data types determine the type of value stored in any variable or constant. In simple words, what kind of value is hold by the variable?

Q13 What is enumerated data type in C++?

Answer:Enumerated data types are user defined data types. Enumerated data types are declared using enum keyword. It arranges a list of items in a sequence and associates a symbolic number to each element. Basically it is used when we have fixed item to choose.

Q14 What is variable in C++?

Answer:A variable is a data name given to a data value stored in the memory. The value of variable can vary at the time of execution.

Q15 What is constant in C++?

Answer:Constants are also the name given to the data values stored in memory like variable but the value of constant cannot be changed at the time of execution means when we don’t want to change the value of variable or want to same value at various place then we have to use constants.

Q16 What is the structure of C++ program?

Answer:A program can contain documentation, header files, symbolic constants, global variables, functions, class declaration and main() function.

Q17 What is class declaration in C++?

Answer:class is main building block of any C++ program. Class declaration contains the declaration of data members and functions.

Q18 What is main() function in C++?

Answer:main() function must be present in the every C++ program. Execution of all C++ program begins with the main() function.

Q19 What is operator in C++?

Answer:An Operator performs operations on data value stored in variable, constants and array etc. Operators take one or more operand as input and give a result after applying operation over them. Like in “a+b”, ‘a’ and ‘b’ are the operands and ‘+’ is an operator which performs the add operation on ‘a’ and ‘b’ operands.

Q20 List the operators provided by C++?.

Answer:C++ provides rich set of operators which are as follows:

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Assignment Operators
  • Bitwise Operators
  • Conditional Operator

Q20 What is conditional operator in C++?

Answer:Conditional operators contain a condition followed by two statements or values. If the condition is true the first statement will be executed otherwise the second statement will be executed.

Q21 What is type conversion or type casting in C++?

Answer:Type conversion is a way to convert data type of a variable to another data type. Like convert float to int or int to float etc.; it is also called as type casting. It provides the facility to change the data type of one variable to another type.

Q22 write the possible ways for type casting in C++?

Answer:In C++ type conversion can be done in two ways:

  • Implicit Type Conversion
  • Explicit Type Conversion

Q23 What is implicit type conversion in C++?

Answer:Implicit type conversion is done automatically by the complier. In this type of conversion compiler internally converts the type of variable depending upon the expression.

Q24 What is explicit type conversion in C++?

Answer:In Explicit type conversion we have to explicitly convert the data type of a variable into another data type.

Q25 What is decision making statement in C++?

Answer:Decision Making Statement allows user to choose one path from the two or more execution path on the basis of condition or we can say that these statements provide the facility to select one option from the given option on the behalf of some condition. If the condition is true then one set of statement will be executed and if the condition is false another set of statement will be executed.

Q26 what is nested if in C++?

Answer:When if, if-else or if- else if- else statements are used inside another if, else if or else statements then these type of statements are known as nested if statements.

Q27 What is switch case statement in C++?

Answer:switch-case statement is a multi-way branch statement. case statement enables the user to choose an option from a number of options.

Q28 What are loops in C++?

Answer:Loops are such block of statements that are repeatedly executed for certain number of times on the basis of specific condition.

Q29 Define nested loops in C++?

Answer:When one loop is used inside another loop then these loops are known as the nested loops. We can use for loop inside another for loop, while loop inside another for loop, do-while loop inside another while loop.

Q30 What is array in C++ ?

Answer:Array is the group of similar data elements having the contiguous memory location. An array is the indexed collection of fixed number of homogenous data elements.

Q31 What is the need of array in C++?

Answer:Array is very useful when you want to store the same type of data elements. For example, if you want to store the marks of 10 subjects of a student then we have to declare 10 variables to store the 10 subject’s marks. Here if we want to store more subject marks then the complexity will be increased and program readability will be down. To overcome this problem, we use array concept to store the same type of data elements into a single variable.

Q32 What are the advantages of the array in C++?


  • By using loop, you can retrieve the elements of array easily.
  • Provide Random Access: We can access any element of array via index number.
  • The main advantage of array is you can represent huge number of values by using single variable so that readability of the code will be improved.

Q33 What is multidimensional array in C++?

Answer:An array that have two dimensions; called as two-dimension array. This is the simplest form of the multidimensional array. It is said to be a multidimensional array if and only if when an array contains more than two dimensions.

Q34 How to declare 2D array in C++?


Data_type array_name [row][column];

For example an integer type two-dimensional array of size 3,3 can be declare as follows:

int a[3][3];

Q35 What is function in C++?

Answer:In C++ programming, function is the block of statements. Function is used to perform the specific task.

Q36 What is the need of the function?

Answer:If we want to perform a task more than one time then there is no need to write the same code again and again. Then we will write that code once and can use any number of times in the program. Functions provide the facility of write once and use any number of times for same task by calling the function.

Q37 What is the main advantage of the function in C++?

Answer:Function provides code reusability is the main advantage of the function in C++.

Q38 What are actual arguments?

Answer:Actual arguments are those values or arguments which are passed when we are calling the function.

Q39 What are formal arguments?

Answer:Formal arguments are those arguments or variables which are declared in the function definition.

Q40 What is call by value in C++?

Answer:In call by value, when we pass the value to the function is locally stored by the function parameter in stack memory location. If we change the value of function parameter or pass the different value, it is changed for the current function only. It will not change the value of variable inside the caller function such as main() . In call by value, original value cannot be changed or modified because copy of actual arguments is used.

Q41 What is call by reference in C++?

Answer:In call by reference, the address of value is passed. In call by reference, address of the value is passed in the function, so both actual arguments and formal arguments share the same address. Thus, value changed inside the function, is reflected both inside and outside the function.

Q42 What is recursion in C++?

Answer:When a function calls itself then this process is called as recursion and the function is called recursive function. When you are using recursion then always define the condition to come out the infinite loop.

Q43 What is string in C++?

Answer:As C in C++ also Array of characte’rs is known as String. To manipulate any text such as words normally strings are used. Every string is terminated with ” (NULL) character.

Q44 What is pointer in C++?

Answer:A pointer is a special kind of variable that holds the address of the variable or data item. With the help of pointer, you can access the memory location directly.

Q45 How to declare the pointer?

Answer:To declare a pointer, we use the * symbol. The basic syntax is as follows:

Data_type *variable_name;


int *p; //pointer to integer

Q46 what is array of pointer?

Answer:Array of pointers is used to point to an array of data items or data elements with each element of the pointer array pointing to an element or data item of the data array.

Q47 what id pointer to pointer in C++?

Answer:If one pointer variable has the address of another pointer variable then it is called as pointer to pointer.

Q48 What is class in C++?

Answer:Class is a base of the object oriented programming language. It is a user-defined data type that is a collection of variables of different-different data types and functions. Class binds the data-members and member functions to work together.

Q49 Write down the syntax to declare the class?

Answer:Here is a basic syntax of the class-declaration:

class class_name
member functions;};

Q50 which specifiers defined the visibility of the class members or functions?

Answer:Data members or member function may be defined as public, private or protected. These are the access-specifiers of the members of a class that defines the visibility of members of class in the program.

Q51 What is the scope of public specifier in class?

Answer:When we use public specifier then public members of class can be used inside or outside the class.

Q52 What is the scope of private specifier in class?

Answer:When we use private specifier then private members of class can only be used inside the class.

Q53 What is the scope of protected specifier in class?

Answer:When we use protected specifier then protected members of class can be used inside the containing class as well as its derived class.

Q54 What is object in C++?

Answer:Object is instance of class which can access all the members of class. All objects of the class have their own copies of variables and method defined in the class.

Q55 How to define and declare object in C++?

Answer:The basic syntax to define C++ object is as follows:
class-name object-name;

Q56 How to access method via class object?

Answer:we can access the members of class through the object. The basic syntax for accessing the member of class through object is as follows:


Q57 How to define member function outside the class?

Answer:We can also define the member function outside the class. To define member function outside the class we have to use the scope resolution operator (::).

Q58 What is scope resolution operator in C++?

Answer:To define member function outside the class we have to use the scope resolution operator (::) to tell the compiler to which class the function belongs. Scope resolution operator is used to identify the variables when we declare same name variable globally or locally. Now if we want to access global variable then we have to use this operator.

Q59 How to provide the functionality to the function outside the class?

Write syntax.
The basic syntax of it is given here:

Return-type class-name :: function-name (paramtere-list)

Q60 What is constructor?

Answer:Constructor is a special type of member function of class whose name is same as the name of the class in which is it is declared. The main aim of the constructor is to initialize the data members of the class.

Q61 When constructor is called in program?

Answer:Constructor is called when the object of the class is created in which it is declared.

Q62 what is non-parameterized constructor?

Answer:It is also called default constructor. It does not contain any parameter. If we have not created any constructer in the class then when we create the object of class then it will be created by the compiler internally.

Q63 what is parameterized constructor?

Answer:Parameterized constructors are the constructors which contains parameters. It can have any number of parameter.

Q64 what is destructor in C++?

Answer:A destructor is a member function of the class whose name is same as the class but preceded with a tilde sign (~).

Q65 What is the working of destructor in C++?

Answer:In C++, there is no facility of automatic destruction like java so we have to handle it manually by using the destructor. In C++, this constructor must be the last statement of the program so that memory can be free.

Q66 what is inheritance in C++?

Answer:Inheritance is the process of creating the new classes from the existing class. In this case, existing class or old class is called as parent class or base class or super class.

Q67 List the advantages of the inheritance?


  • Code reusability.
  • Increase the reliability of the code.
  • Add enhancement of the base class.
  • Reusing the existing code can save the time and money and increase the program’s readability.

Q68 Write the syntax to inherit the class in C++?

Answer:The general form of derived class is as follows:

class :

Q69 List the type of inheritance in C++?

Answer:The levels of the inheritance refer to the length of its path from the route. In C++, a base class itself might have been derived from other class.

  • Single level inheritance
  • Multilevel Inheritance
  • Multiple Inheritance
  • Hierarchical Inheritance
  • Hybrid Inheritance

Q70 What is multiple inheritance in C++?

Answer:In this form of inheritance, a child class derived from more than one parent classes i.e a child has two or more parents. In multiple inheritance, a class can have more than one parent means a class can inherit more than one class.

Q71 What is hierarchical inheritance in C++?

Answer:When a parent class has more than one child then this form of inheritance is called as hierarchical inheritance that means more than one child class can derived from one parent class.

Q72 What is overloading in C++?

Answer:Overloading refers to use of same thing for different purpose. C++ provides the concept of overloading where we provides more than one definition for a single function or operator.

Q73 What is function overloading in C++?

Answer:Function Overloading refers to creating number of functions with the same name which perform different tasks. In Function overloading we can create number of functions with the same name but either number of arguments or type of arguments must be different.

Q74 What is operator overloading in C++?

Answer:Operator Overloading refers to overloading of one operator for many different purpose. We can say that when we assign the additional task to the operators then it is called as operator overloading.

Q75 What is encapsulation in C++?

Answer:Encapsulation is simple concept which prevents the access to data that is not essential. It is a process of binding the variable and methods together required by an object in a single unit that is class.

Q76 How to achieve encapsulation in C++?

Answer:In C++, encapsulation is achieved through class concept.

Q77 List some advantage of the encapsulation?


  • It provides data security.
  • It provides the abstraction between objects and its clients.
  • It provides the security from the unwanted access.

Q78 What is abstraction in C++?

Answer:Abstraction is the process of providing the essential features of an object without providing its background details or explanation. Abstraction is the process of just highlighting the set of services what we are offering and hiding the internal details.

Q79 What is polymorphism in C++?

Answer:Polymorphism is the ability for classes to provide different implementation to the method that are called by same name. Polymorphism is a way to define the several same name methods in a class. It is called as polymorphism.

Q80 What is method overriding in C++?

Answer:When we define any method with same name, same return type and with same arguments in the base class and child class then it is called as method overriding. When we implement this concept then we cannot guess which method will execute at the runtime because method names are same.

Q81 What is inline function in C++?

Answer:Inline function is the most powerful and most usable feature of the C++. When we make a function as inline then compiler places a replica or copy of that function at every point where this function is called at compile time.

Q82 How to call inline function in C++?

Answer:When we want to call inline function then it is simple as calling the normal function.

Q83 What is the main advantage of the inline function?

Answer:The main advantage of this function is it makes the program faster.

Q84 What is the syntax to define inline function in C++?

Answer: The basic syntax is as follows:

inline function_name(arguments)
// body of function

Q85 What is friend function in C++?

Answer:C++ provides a way to access the private and protected data members in another class by using the friend function. It is called as friend class.

Q86 What is the advantage of the friend function in C++?

Answer:The main advantage of friend function is we can access the private and protected data of one class can be accessed in another class.

Q87 What is friend class in C++?

Answer:When we make a friend class of another class then other class can access all the member function of its friend class.

Q88 What is virtual function in C++?

Answer:C++ provides the concept of virtual function to implement the runtime polymorphism. A virtual function is declared in the parent class prefix with virtual keyword; and re-defined that function without using virtual keyword in the child class. It is known as virtual function.

Q89 write syntax to define virtual function?

Answer: Syntax:

virtual return_type function_name()

Q90 What is pure virtual function in C++?

Answer:When we want to declare a function in base class and don’t want to provide the body for this function then we use the concept of the pure virtual function. In C++, pure virtual function is a kind of virtual function without body and this function is end with =0;

Q91 What is abstract class in C++?

Answer:A class that has pure virtual function is known as abstract class.

Q92 When pure virtual function is useful in C++?

Answer:This function is very useful when we declare the function without body and provide the body to this function in the child class and we can provide the different functionality to this function in different classes where we define the code for it.

Q93 Write the syntax to define pure virtual function in C++?

Answer:The basic syntax of this is as follows:

Virtual () = 0;

Q94 What is template in C++?

Answer:Template provides the idea of generic classes. Use of one function or class that works for all data types is generalization. Template is a mechanism which allows us to declare generic classes and functions.

Q95 What is function template in C++?

Answer:A template created for function so that a function works for variety of data types is termed as function template. The function template does not occupy space in memory. Function template allow us to write same code for different data-types.

Q96 what is class template in C++?

Answer:When a template is written for a class so one single class works for variety of data types is termed as class template. The class template are basically used for creating container classes. That is which can contains varieties of objects of any type. For the class template definition method remains same but instantiation changes.

Q97 What is stream in C++?

Answer:The sequence of bytes is called as stream. A stream is a general name that is given to the flow of data. Different streams are used to represent different kind of data flow.

Q98 How to open the file in C++?

Answer:Open() function is used to open a file.

Q99 How to close the file in C++?

Answer:If a file is open then it must be close after completion of all operation related to file. For closing file we use close() function.

Q100 What are the file opening mode in C++?

Answer:These are as follows:

Real Time Web Analytics