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

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

Be First!

c++21.Can we initialize a class/structure member variable as soon as the same is defined?
No, Defining a class/structure is just a type definition and will not allocated memory for the same.

22.What is the data type to store the Boolean value?
bool, is the new primitive data type introduced in C++ language.

23.What is function overloading?
Defining several functions with the same name with unique list of parameters is called as function overloading.

24.What is operator overloading?
Defining a new job for the existing operator w.r.t the class objects is called as operator overloading.

25.Do we have a String primitive data type in C++?
No, it’s a class from STL (Standard template library).

26.Which access specifier/s can help to achive data hiding in C++?

Private & Protected.

27.When a class member is defined outside the class, which operator can be used to associate the function definition to a particular class?
Scope resolution operator (::)

28.What is a destructor? Can it be overloaded?
A destructor is the member function of the class which is having the same name as the class name and prefixed with tilde (~) symbol. It gets executed automatically w.r.t the object as soon as the object loses its scope. It cannot be overloaded and the only form is without the parameters.

29.What is a constructor?
A constructor is the member function of the class which is having the same as the class name and gets executed automatically as soon as the object for the respective class is created.

30.Name the default standard streams in C++.
cin, cout, cerr and clog.



Leave a Reply