Loading...

C++ Programming Interview Questions

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

C++ Interview Questions Set-9

Commonly Asked C++ Programming Interview Questions | Set 9


81. What is the difference between variable declaration and variable definition?
Ans: Declaration associates type to the variable whereas definition gives the value to the variable.


82. What is the purpose of #undef preprocessor?
Ans: It will be used to undefine an existing macro definition.


83. Can we nest multi line comments in a C++ code?
Ans: No, we cannot.


84. What is the order of objects destroyed in the memory?
Ans: The objects are destroyed in the reverse order of their creation.


85. Which key word is used to perform unconditional branching?
Ans: goto.


86. What is the difference between variable declaration and variable definition?
Ans: Declaration associates type to the variable whereas definition gives the value to the variable.


87. Are the exceptions and error same?
Ans: No, exceptions can be handled whereas program cannot resolve errors.


88. What is reminder for 5.0 % 2?
Ans: Error, It is invalid that either of the operands for the modulus operator (%) is a real number.


89. Which compiler switch to be used for compiling the programs using math library with g++ compiler?
Ans: Opiton –lm to be used as > g++ –lm <file.cpp>


90. What are comments in C++?
Ans: Comments are pieces of source code that are useful to a programmer but not the compiler. They help add a description or extra information about the source code.


- Related Topics