Skip to Content, PHP, MySQL, Javascript, Ajax, Htacces

C++ Programming Interview Questions and Answers For Freshers Part-2

Be First!

c++11.What is a storage class?
Storage class specifies the life or scope of symbols such as variable or functions.

12.Mention the storage classes names in C++.
The following are storage classes supported in C++

auto, static, extern, register and mutable

13.What is the role of mutable storage class specifier?
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.

14.Distinguish between shallow copy and deep copy.
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.

15.What is a pure virtual function?
A virtual function with no function body and assigned with a value zero is called as pure virtual function.

16.What is an abstract class in C++?
A class with at least one pure virtual function is called as abstract class. We cannot instantiate an abstract class.

17.What is a reference variable in C++?
A reference variable is an alias name for the existing variable. Which mean both the variable name and reference variable point to the same memory location. Therefore updation on the original variable can be achieved using reference variable too.

18.What is role of static keyword on class member variable?
A static variable does exit though the objects for the respective class are not created. Static member variable share a common memory across all the objects created for the respective class. A static member variable can be referred using the class name itself.

19.Explain the static member function.
A static member function can be invoked using the class name as it exits before class objects comes into existence. It can access only static members of the class.

20.What are/is the operator/operators used to access the class members?
Dot (.) and Arrow ( -> )



Leave a Reply