Tuesday, May 28, 2013

C++ Questions / Interview / Mastery

I am going to try to answer this list of questions about C++




  • How many ways are there to initialize a primitive data type in C++ and what are they?
  • Why should you declare a destructor as virtual?
  • What does it mean that C++ supports overloading?
  • What are examples of overloading in C++?
  • What is name mangling in C++ and why is it used?
  • What is an abstract base class?
  • What is RTTI?
  • How can you access a variable that is “hidden” by another variable of the same name?
  • What is a namespace and how is it used.
  • What are the differences between a class and a struct in C++, and how does this compare to C?
  • What are templates? How are they used?
  • What is a copy constructor and when is it used, especially in comparison to the equal operator.
  • What is the difference between a “shallow” and a “deep” copy?
  • What is the const operator and how is it used?
  • What are the differences between passing by reference, passing by value, and passing by pointer in C++?
  • When is it and when is it not a good idea to return a value by reference in C++?
  • What is the difference between a variable created on the stack and one created on the heap?
  • How do you free memory allocated dynamically for an array? What are the implications of just using delete?
  • What is multiple inheritance? When should it be used?
  • What is a pure virtual function?
  • What does the keyword mutable do?
  • What does the keyword volatile do?
  • What is the STL?
  • What is a Vector?
  • What is contained in the header?
  • What is the difference between #include and #include ?
  • What’s the difference between “++i” and “i++”?
  • What is short circuit evaluation? How can it be used? Why can is be dangerous?
  • What is the ‘,’ operator?
  • What is the only ternary operator? How is it used?
  • What is the use of a const member function and how can it be used?
  • How is try/catch used in C++?
  • Why should you never throw an exception in a destructor?
  • What is the explicit keyword?
  • What is the proper way to perform a cast in C++?
  • What does inline do?



No comments: