C++/OOPS Interview Questions With Answers - Part IV.


Here, are some sample questions based on "C++/OOPS Programming language". Read it carefully as these questions will help you in cracking any interview.


Question - 16) Which header file is required for creating and manipulating data files in C++?

Answer: fstream.h


Question - 17) What is an access specifier?

Answer: An access specifier is a way to specify the scope and accessibility of members of a class. Access specifiers can be either private or protected or public.


Question - 18) How is memory allocated to a class and its objects?

Answer: When a class is defined, memory is allocated for its member functions and they are stored in the memory. When an object is created, separate memory space is allocated for its data members. All objects work with the one copy of member functions shared by all.


Question - 19) What is the difference between an object and a class ?

Answer: An object is an identifiable entity with some characteristics and behavior. It represents an entity that can store data and its associated functions.
A class is a group of objects that share common properties and relationships. It represents a group of similar objects.


Question - 20) Differentiate between data hiding and encapsulation ?

Answer: Data hiding is the property whereby the internal data structure of an object is hidden from the rest of the program.

Data encapsulation is the mechanism by which the data and associated functions are bound together within an object definition in such a way so that only relevant information is exposed and rest remains hidden. Thus, data encapsulation implements data hiding.



ALSO READ:

21) What is polymorphism? Explain with an example ?
22) What is public, protected and private ?
23) What is the significance of the protected access specifier ?
24) Do 'derivation' and 'friendship' mean the same ?
25) Enlist some advantages of object oriented programming ?


26) Is prototyping mandatory in C++ ? Why ?
27) When should a function be made inline ?
28) How is a static variable different from a static function ?
29) What is meant by macro ?
30) What do you mean by inline function?


31) What is a constructor? Why would I ever use one?
32) What are destructors really for? Why would I ever use them?
33) Is a default constructor equivalent to a constructor having default arguments?
34) Why is a destructor function required in a class?
35) What is a parameterized constructor?
... Back To C++ Programs Index

... Back To C++ FAQ's Index

... Back To C Programs Index

... Back To C FAQ's Index

... Back To HR Interview Index


Comments

Popular Posts