C++ questions banner

62 Exam and interview questions on C++ language form developers/learners. Click on the link to get the detailed explanations. One you visit any answer you can navigate through next and previous link to jump from one answer to another. You can also select index to come back to this index page. Please provide us the rating and feedbacks of our questions and answers.

Questions and Answers

  • Why is C++ called object oriented programming/OOP language?
  • Differentiate between C and C++?
  • Differentiate between C++ and JAVA?
  • What is encapsulation?
  • What is a class constructor function? [default constructor]
  • What is overloaded constructor?
  • What is a destructor?
  • Can a destructor be overloaded?
  • What is a copy constructor?
  • What is shallow copy?
  • What is deep copy constructor?
  • Differentiate between deep copy constructor and shallow copy constructor?
  • What is the design of singleton class?
  • What is the default access modifier for class members and member functions in a class?
  • What is the difference between a C structure and a C++ class?
  • What is the default access modifier for structure members and member functions in a structure?
  • What is abstraction or data hiding?
  • What is THIS pointer?
  • What is a static function?
  • Why THIS pointer will not be created for a static function?
  • What is scope resolution operator?
  • What is an inline function in C++?
  • What is the difference between a private member and a protected member?
  • What is a const function?
  • What is polymorphism?
  • What is operator overloading?
  • What is function overloading?
  • What is overriding?
  • How can I distinguish between prefix increment and postfix increment?
  • What is a friend class?
  • What is a friend function?
  • What is the size of a class having one or more virtual functions?
  • What is a virtual pointer or vfptr and virtual function table vftable? Explain with diagram and example.
  • How does virtual function work? Understanding vfptr and vftable using C.
  • What is early binding and late binding?
  • What is inheritance?
  • Can a virtual function call from a constructor/destructor work properly?
  • What is a virtual destructor and its utility?
  • What is a virtual base class?
  • How can I overload global << and >> operators to work with cin,cout,cerr etc?
  • What is an exception?
  • What is stack unwinding operation in exception handling?
  • How is exception handling done in C++?
  • Can you write a try-catch block that will catch all type of exceptions?
  • What is namespace?
  • How can I change a member variable within a const function?
  • What is mutable keyword and how is it used?
  • What does the keyword 'explicit' do? Why is it used?
  • How a function pointer may be used to access a member function?
  • What is object slicing?
  • What is ctor and what is the sequence of constructor calls?
  • What is dtor and what is the sequence of destructor calls?
  • Why is virtual destructor important in inheritance?
  • How can I print the type name of a variable?
  • What is dynamic casting?
  • What is static casting?
  • What is the difference between dynamic and static casting?
  • What is const casting?
  • What is reinterpret casting?
  • What is the difference between static casting and reinterpret casting?
  • What is template class?
  • How does template differ from macro?
  • C++ Topics

    object-oriented, C vs C++, C++ vs Java, encapsulation, constructor, overloaded constructor, destructor, destructor overloaded, copy constructor, copy constructor, deep copy, deep copy vs shallow copy, singleton, default access modifier, default access modifier, default access modifier, abstraction, THIS pointer, static function, THIS pointer, a static function, scope resolution operator, inline function, private vs protected, const function, polymorphism, operator overloading, function overloading, overriding, prefix vs postfix, friend class, friend function, sizeof class with virtual, vfptr and vftable, vfptr and vftable using C, early binding and late binding, inheritance, virtual function call from a constructor/destructor, virtual destructor, virtual base class, virtual base class, exception, stack unwinding, exception handling, try-catch block, namespace, mutable variable and const function, mutable keyword, explicit, access a member function, object slicing, ctor sequence of constructor, dtor sequence of destructor, virtual destructor, print the type, dynamic casting, static casting, dynamic and static casting, const casting, reinterpret casting, static and reinterpret casting, template class, template vs macro,

    Back to Questions <<