C++ Interview Questions


  1. What are the major differences between C and C++?
  2. What are the differences between new and malloc?
  3. What is the difference between delete and delete[]?
  4. What are the differences between a struct in C and in C++?
  5. What are the advantages/disadvantages of using #define?
  6. What are the advantages/disadvantages of using inline and const?
  7. What does it mean to take the address of a reference?
  8. What does it mean to declare a function or variable as static?
  9. What is the order of initialization for data?
  10. What is name mangling/name decoration?
  11. What kind of problems does name mangling cause?
  12. How do you work around them?
  13. What is a class?
  14. What are the differences between a struct and a class in C++?
  15. What is the difference between public, private, and protected access?
  16. For class CFoo { }; what default methods will the compiler generate for you>?
  17. How can you force the compiler to not generate them?
  18. What is the purpose of a constructor? Destructor?
  19. What is a constructor initializer list?
  20. When must you use a constructor initializer list?
  21. What is a:Constructor?Destructor?Default constructor?Copy constructor?Conversion constructor?
  22. What does it mean to declare a...member function as virtual?member function as static?member function as static?member variable as static?destructor as static?
  23. Can you explain the term "resource acquisition is initialization?"
  24. What is a "pure virtual" member function?
  25. What is the difference between public, private, and protected inheritance?
  26. What is virtual inheritance?
  27. What is placement new?
  28. What is exception handling?
  29. Explain what happens when an exception is thrown in C++.
  30. What happens if an exception is not caught?
  31. What happens if an exception is throws from an object's constructor?
  32. What happens if an exception is throws from an object's destructor?
  33. What are the costs and benefits of using exceptions?
  34. When would you choose to return an error code rather than throw an exception?
  35. What is a template?
  36. What is partial specialization or template specialization?
  37. How can you force instantiation of a template?
  38. What is an iterator?
  39. What is an algorithm (in terms of the STL/C++ standard library)?
  40. What is std::auto_ptr?
  41. What is wrong with this statement?
  42. std::auto_ptr ptr(new char[10]);
  43. It is possible to build a C++ compiler on top of a C compiler. How would you do this?

2 comments:

  1. Salama Aleikum,

    C++ Interview Questions being contrived to exist for many projects simply so it can be run will be the first to hit the wall, but those projects where the functions to make existing transactions cheaper in real world applications will find the elusive real world demand.

    i noticed that the expression x+++y is equal to x+(++y)
    what make c to choose this and not (x++)+y?
    Please keep providing such valuable information.

    Grazie,
    Irene Hynes

    ReplyDelete