C++ Interview Questions and answers: Here, we highlight some common questions you might be asked during a job interview for C++ related positions. All the best for your interview Preparation.
What is C++?
What are the differences between C and C++?
What is a class?
What is object?
What is friend class?
Can you explain storage classes?
What is Token?
What is Recursion?
What is function overriding?
What is Virtual function?
What is Volatile Variable?
What are Pointers?
What is Null Pointer?
What is enumeration?
What are Structures and Unions?
What is inheritance?
What is Encapsulation?
What is Abstraction?
What is Data binding?
What is Polymorphism?
What is the real purpose of class – to export data?
What things would you remember while making a interface?
Explain the benefits of proper inheritance.
Does improper inheritance have a potential to wreck a project?
How should runtime errors be handled in C++?
When should a function throw an exception?
Where are setjmp and longjmp used in C++?
Are there any special rules about inlining?
Explain one-definition rule (ODR)
What are the advantages of using friend classes?
What is the use of default constructor?
Differentiate between class and structure?
Explain container class?
What is namespace?
Explain explicit container?
Explain class invariant
Differentiate between late binding and early binding. What are the advantages of early binding?
Explain public, protected, private in C++?
What are the different types of STL containers?
Explain Stack unwinding?
How would you find out if a linked-list is a cycle or not?
Explain Copy Constructor
When do you call copy constructors?
Name the implicit member functions of a class
Explain storage qualifiers in C++
Explain dangling pointer
In what situations do you have to use initialization list rather than assignment in constructors.
When does a class need a virtual destructor?
What is the type of “this” pointer? When does it get created?
How would you differentiate between a pre and post increment operators while overloading?
What is a pdb file?
You run a shell on UNIX system. How would you tell which shell are you running?
What are Stacks? Give an example where they are useful
Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator?
In a function declaration, what does extern mean?
You want to link a C++ program to C functions. How would you do it?