Advanced C++ Interview
Advanced C++ Interview
Advanced C++ Interview
questions
By admin | December 7, 2003
Q: How do you link a C++ program to C functions?
A: By using the extern "C" linkage specification around the C function declarations.
Q: Explain the scope resolution operator.
A: It permits a program to reference an identifier in the global scope that has been
hidden by another identifier with the same name in the local scope.
Q: What are the differences between a C++ struct and C++ class?
A: The default member and base-class access specifiers are different.
Q: How many ways are there to initialize an int with a constant?
A: Two.
There are two formats for initializers in C++ as shown in the example that follows.
The first format uses the traditional C notation. The second format uses constructor
notation.
int foo = 123;
int bar (123);
Q: How does throwing and catching exceptions differ from using setjmp and
longjmp?
A: The throw operation calls the destructors for automatic objects instantiated since
entry to the try block.
Q: What is your reaction to this line of code?
delete this;
A: Its not a good practice.
Q: What is a default constructor?
A: A constructor that has no arguments.