C++ Questions - III
Posted by Subash | 6:56 PM
[2] Comments
Here are some C++ Questions Taken from http://www1.cs.columbia.edu/~kns10/interview/
What is an object in C++?
What is a message?
What is a class?
What is an instance?
What is a super-class?
What is inheritance?
To what does message protocol refer?
What is polymorphism?
What are instance variables?
What are class variables?
What is a method?
In C++ what is a constructor? A destructor?
Compare and contrast C and C++.
What is operator overloading?
What is cin and cout?
Contrast procedural and object oriented programming.
How do you link a C++ program to C functions?
Explain the scope resolution operator.
What are the differences between a C++ struct and C++ class?
How many ways are there to initialize an int with a constant?
How does throwing and catching exceptions differ from using setjmp and
longjmp?
What is your reaction to this line of code?
What is a default constructor?
What is a conversion constructor?
What is the difference between a copy constructor and an overloaded
assignment operator?
When should you use multiple inheritance?
What is a virtual destructor?
Explain the ISA and HASA class relationships. How would you implement each in
a class design?
When is a template a better solution than a base class?
What is the result of compiling this program in a C compiler? in a C++ compiler?
What is the difference between C and C++ ? Would you prefer to use one over the
other ?
What are the access privileges in C++ ? What is the default access level ?
What is data encapsulation ?
What is inheritance ?
What is multiple inheritance ? What are it's advantages and disadvantages ?
What is polymorphism?
What do the keyword static and const signify ?
How is memory allocated/deallocated in C ? How about C++ ?
What is UML ?
What is the difference between a shallow copy and a deep copy ?
What are the differences between new and malloc?
What is the difference between delete and delete[]?
What are the differences between a struct in C and in C++?
What are the advantages/disadvantages of using #define?
What are the advantages/disadvantages of using inline and const?
What is the difference between a pointer and a reference?
When would you use a pointer? A reference?
What does it mean to take the address of a reference?
What does it mean to declare a function or variable as static?
What is the order of initalization for data?
What is name mangling/name decoration?
What kind of problems does name mangling cause?
How do you work around them?
What is a class?
What are the differences between a struct and a class in C++?
What is the difference between public, private, and protected access?
For class CFoo { }; what default methods will the compiler generate for you>?
How can you force the compiler to not generate them?
What is the purpose of a constructor? Destructor?
What is a constructor initializer list?
When must you use a constructor initializer list?
What is a:
Constructor?
Destructor?
Default constructor?
Copy constructor?
Conversion constructor?
What does it mean to declare a...
member function as virtual?
member function as static?
member varible as static?
destructor as static?
Can you explain the term "resource acqusition is initialization?"
What is a "pure virtual" member function?
What is the difference between public, private, and protected inheritance?
What is virtual inheritance?
What is placement new?
What is the difference between operator new and the new operator?
What is exception handling?
Explain what happens when an exception is thrown in C++.
What happens if an exception is not caught?
What happens if an exception is throws from an object's constructor?
What happens if an exception is throws from an object's destructor?
What are the costs and benefits of using exceptions?
When would you choose to return an error code rather than throw an exception?
What is a template?
What is partial specialization or template specialization?
How can you force instantiation of a template?
What is an iterator?
What is an algorithm (in terms of the STL/C++ standard library)?
What is std::auto_ptr?
What is wrong with this statement? std::auto_ptr ptr(new char[10]);
It is possible to build a C++ compiler on top of a C compiler. How would you do
this?
What output does the following code generate? Why?
What output does it generate if you make A::Foo() a pure virtual function?
What output does this program generate as shown? Why?
C++ ( what is virtual function ?
what happens if an error occurs in constructor or destructor.
Discussion on error handling, templates, unique features of C++.
What is different in C++, ( compare with unix).
I was given a c++ code and was asked to find out the bug in that. The
bug was that he declared an object locally in a function and tried to
return the pointer to that object. Since the object is local to the
function, it no more exists after returning from the function. The
pointer, therefore, is invalid outside.
longjmp?
delete this;
assignment operator?
a class design?
int __ = 0;
main() {
int ___ = 2;
printf("%d\n", ___ + __);
}
other ?
Constructor?
Destructor?
Default constructor?
Copy constructor?
Conversion constructor?
member function as virtual?
member function as static?
member varible as static?
destructor as static?
this?
What output does it generate if you make A::Foo() a pure virtual function?
what happens if an error occurs in constructor or destructor.
Discussion on error handling, templates, unique features of C++.
What is different in C++, ( compare with unix).
bug was that he declared an object locally in a function and tried to
return the pointer to that object. Since the object is local to the
function, it no more exists after returning from the function. The
pointer, therefore, is invalid outside.
5:16 PM
Please provide the answer side by side because sometime it is urgently needed.About this site i can say tha a wonderful site for preparing a technical interview.
2:24 AM
Prepare to fail, buddy.