C++ interviews focus on OOP, memory, STL, move semantics, templates, and modern best practices. Be ready to explain trade-offs with Java GC, C manual memory, and Rust ownership.
Must-know topics
- RAII, constructors/destructors, rule of zero/five
- virtual functions, vtables, abstract classes
- STL containers, iterators, algorithms
- Smart pointers, move semantics, lvalue/rvalue references
- Templates vs runtime polymorphism
- const correctness, exceptions, compilation model
Important interview questions and answers
- Q: Explain RAII in 30 seconds.
A: Acquire resources in constructors; release in destructors tied to scope—exceptions still unwind and cleanup runs. - Q: unique_ptr vs shared_ptr?
A: Exclusive ownership vs reference-counted sharing; default to unique_ptr. - Q: When not use C++?
A: Simple CRUD web apps, teams without C++ expertise, or domains where managed languages dominate and native latency is unnecessary.
Self-check
- List three C++ topics you will review before interviews.
- How does error handling differ from Java exceptions in style debates?
Tip: Be ready to whiteboard RAII, virtual destructors, and unique_ptr vs shared_ptr—common screen questions.
Interview prep
- Must-know C++ interview topics?
RAII, OOP/virtual, STL, smart pointers, move semantics, templates, const correctness, and compilation model.
- Explain RAII in 30 seconds?
Acquire resources in constructors; release in destructors at scope end—works with exceptions via stack unwinding.