C++ Interview questions with answers and explanation. The following C++ Interview Questions are based upon programming skills and theoretical knowledge and will help you prepare for technical interviews and online selection tests during campus placement for freshers and job interviews for professionals.

After reading these tricky C++ questions, you can easily attempt the objective type and multiple choice type questions on C++ Programming.

Question-1. What is an object ?

Answer- An instance of the class is called as object.


Question-2. Types of Inheritance in C++ ?

Answer- Single, Multilevel, Multiple, Hierarchical and Hybrid.


Question-3. What is the role of protected access specifier ?

Answer- If a class member is protected then it is accessible in the inherited class. However, outside the both the private and protected members are not accessible.


Question-4. Explain the purpose of the keyword volatile ?

Answer- Declaring a variable volatile directs the compiler that the variable can be changed externally. Hence avoiding compiler optimization on the variable reference.


Question-5. What is an Inline function ?

Answer- A function prefixed with the keyword inline before the function definition is called as inline function. The inline functions are faster in execution when compared to normal functions as the compiler treats inline functions as macros.


Question-6. What is a storage class ?

Answer- Storage class specifies the life or scope of symbols such as variable or functions.


Question-7. Mention the storage classes names in C++ ?

Answer- The following are storage classes supported in C++
auto, static, extern, register and mutable


Question-8. What is the role of mutable storage class specifier ?

Answer- A constant class object’s member variable can be altered by declaring it using mutable storage class specifier. Applicable only for non-static and non-constant member variable of the class.


Question-9. Distinguish between shallow copy and deep copy ?

Answer- Shallow copy does memory dumping bit-by-bit from one object to another. Deep copy is copy field by field from object to another. Deep copy is achieved using copy constructor and or overloading assignment operator.


Question-10. What is a pure virtual function ?

Answer- A virtual function with no function body and assigned with a value zero is called as pure virtual function.