Interview Questions

C++ Interview Questions

Short Questions

  1. Describe the conditions under which a method call uses the static type vs when it uses the dynamic type.
  2. Explain why we prefer to put implementations in a .cc file vs in a .h file.
  3. Describe at a high level how a templated class is compiled.
  4. Define in your own words what an invariant is.
  5. Describe the steps of the Object Construction sequence. How do they relate to those of the object destruction sequence?
  6. What is the difference between Overloading and Overriding?
  7. Give two differences between overloading operators as a method vs as a standalone function.
  8. Give one example where an operator overload has to be defined as a standalone function, and one where it has to be defined as a method.
  9. Explain the different situations where we would prefer pass-by-value, pass-by-reference, and pass-by-constant-reference.
  10. Give the definition of an lvalue, give the definition of an rvalue.
  11. Describe the mechanism behind the copy-swap idiom, and why one one may wish to use it.
  12. For a container class C, list what methods must be defined to implement an iterator for C.
  13. List two advantages to using a Makefile for build automation
  14. Explain differences between the waterfall and agile methodology of software development.
  15. Describe the conditions that indicate an owns-a relationship, and a has-a relationship

Also useful in CS247.

Long Questions

todo

System Design

I’ve never had system design questions but from what Sophia told me, she always gets them. Probably if you interview with big companies since they have multiple rounds…

Java Questions

  • Is Java platform independent if then how?
    • Yes, java is a platform independent language. javac compiler compiles the program to form a bytecode or .class file unlike other programming languages. this file is independent of the software or hardware running but needs a JVM file preinstalled in the OS for further execution of the bytecode.
  • Features of Java
    • Secured