C++ Interview Questions

  1. If a class has only parameterized constructor. Is it possible to instantiate the class without passing any parameters to constructor? Will it give compilation error in doing so if yes how can you fix it?
  2. How can you keep track of instances of a class?
  3. What is the property of static data members?
  4. Describe a situation where you can't use this pointer.
  5. Explain concept of polymorphism.
  6. What is the necessary condition for implementing run time polymorphism?
  7. What is abstract base class?
  8. Explain early binding and late binding.
  9. What is this pointer? Write a code to show the use of this pointer.
  10. Explain shallow copy and deep copy.
  11. There is anything called virtual destructor when it is necessary and why the destructor is made virtual.
  12. There are two classes; one is Base class containing one static member and another class deriving the Base. Is it possible to access the static member variable from the derived class?
  13. How can you access private static member of a class.
  14. What all things an empty class can have? What is the size of an empty class?
  15. Implement a class which can't be instantiated. 
  16. Divide by 7 without using (/) operator...basically using bitwise shifting
  17. In a copy constructor, why argument is not passed by value, and why is it passed by constant reference?
  18. What is the difference between copy constructor and assignment operator overloading?
  19. What is difference between structures and classes?

No comments:

Post a Comment