Loading...

C++ Programming Interview Questions

This article is mainly focused on the most repeatedly asked and the latest updated questions.

C++ Interview Questions Set-8

Commonly Asked C++ Programming Interview Questions | Set 8


71. What is data hiding in C++?
Ans: An object oriented technique of hiding data members is called data hiding. In other words, giving restricted access to the data members so as to maintain object integrity.


72. What is the size of empty class in C++?
Ans: Size of an empty class is 1 byte generally just to ensure that the two different objects will have different addresses.


73. What is a static member in C++?
Ans: Static is a keyword in C++, used to give special characteristics to an element. Static elements are allocated storage only once in a program lifetime in static storage area. And they have a scope till the program lifetime.


74. Is it possible to have Virtual Constructor? If yes, how? If not, Why?
Ans: There is nothing like Virtual Constructor in C++. The Constructor cant be virtual as the constructor is a code which is responsible for creating an object.


75. What is C++ exceptional handling?
Ans: The problem that arises during execution of a program is referred as exceptional handling. The exceptional handling in C++ is done by three keywords.

  • Try: It identifies a block of code for which particular exceptions will be activated
  • Catch: The catch keyword indicates the catching of an exception by an exception handler at the place in a program
  • Throw: When a problem exists while running the code, the program throws an exception


76. What is multi-threading in C++?
Ans: To run two or more programs simultaneously multi-threading is useful. There are two types of:

  • Process-based: It handles the concurrent execution of the program
  • Thread-based: It deals with the concurrent execution of pieces of the same program


77. What is upcasting in C++?
Ans: Upcasting is the act of converting a sub class references or pointer into its super class reference or pointer is called upcasting.


78. What is pre-processor in C++?
Ans: Pre-processors are the directives, which give instruction to the compiler to pre-process the information before actual compilation starts.


79. What is the use of the keyword ‘using’?
Ans: It is used to specify the namespace being used in.


80. What is the difference between actual and formal parameters?
Ans: The parameters sent to the function at calling end are called as actual parameters while at the receiving of the function definition called as formal parameters.


- Related Topics