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

  1. Why is C++ called object oriented programming/OOP language? answer
  2. Differentiate between C and C++? answer
  3. Differentiate between C++ and JAVA? answer
  4. What is encapsulation? answer
  5. What is a constructor? answer
  6. What is overloaded constructor? answer
  7. What is a destructor? answer
  8. Can a destructor be overloaded? answer
  9. What is a copy constructor? answer
  10. What is shallow copy? answer
  11. What is deep copy constructor? answer
  12. Differentiate between deep copy constructor and shallow copy constructor? answer
  13. What is the design of singleton class? answer
  14. What is the default access modifier for class members and member functions in a class? answer
  15. What is the difference between a C structure and a C++ class? answer
  16. What is the default access modifier for structure members and member functions in a structure? answer
  17. What is abstraction or data hiding? answer
  18. What is THIS pointer? answer
  19. What is a static function? answer
  20. Why THIS pointer will not be created for a static function? answer
  21. What is scope resolution operator? answer
  22. What is an inline function in C++? answer
  23. What is the difference between a private member and a protected member? answer
  24. What is a const function? answer
  25. What is polymorphism? answer
  26. What is operator overloading? answer
  27. What is function overloading? answer
  28. What is overriding? answer
  29. How can I distinguish between prefix increment and postfix increment? answer
  30. What is a friend class? answer
  31. What is a friend function? answer
  32. What is the size of a class having one or more virtual functions? answer
  33. What is a virtual pointer or vfptr and virtual function table vftable? Explain with diagram and example. answer
  34. How does virtual function work? Understanding vfptr and vftable using C. answer
  35. What is early binding and late binding? answer
  36. What is inheritance? answer
  37. Can a virtual function call from a constructor/destructor work properly? answer
  38. What is a virtual destructor and its utility? answer
  39. What is a virtual base class? answer
  40. How can I overload global << and >> operators to work with cin,cout,cerr etc? answer
  41. What is an exception? answer
  42. What is stack unwinding operation in exception handling? answer
  43. How is exception handling done in C++? answer
  44. Can you write a try-catch block that will catch all type of exceptions? answer
  45. What is namespace? answer
  46. How can I change a member variable within a const function? answer
  47. What is mutable keyword and how is it used? answer
  48. What does the keyword 'explicit' do? Why is it used? answer
  49. How a function pointer may be used to access a member function? answer
  50. What is object slicing? answer
  51. What is ctor and what is the sequence of constructor calls? answer
  52. What is dtor and what is the sequence of destructor calls? answer
  53. Why is virtual destructor important in inheritance? answer
  54. How can I print the type name of a variable? answer
  55. What is dynamic casting? answer
  56. What is static casting? answer
  57. What is the difference between dynamic and static casting? answer
  58. What is const casting? answer
  59. What is reinterpret casting? answer
  60. What is the difference between static casting and reinterpret casting? answer
  61. What is template class? answer
  62. How does template differ from macro? answer

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 <<