# C++ & STL Interview Questions

> Pointers and references, RAII, rule of five, move semantics, vtables, smart pointers, and STL containers.

Canonical: https://www.internhack.in/learn/interview/cpp-interview
Last updated: 2026-11-28

Pointers and references, RAII, rule of five, move semantics, vtables, smart pointers, and STL containers.

## 30 questions in this section

- [What are the key differences between C and C++, and between struct and class?](https://www.internhack.in/learn/interview/cpp-interview/cpp-c-vs-cpp-struct-class) (Beginner)
- [References vs pointers in C++](https://www.internhack.in/learn/interview/cpp-interview/cpp-references-vs-pointers) (Beginner)
- [const pointer vs pointer to const, and const correctness](https://www.internhack.in/learn/interview/cpp-interview/cpp-const-correctness) (Beginner)
- [Stack vs heap memory in C++](https://www.internhack.in/learn/interview/cpp-interview/cpp-stack-vs-heap) (Beginner)
- [new/delete vs malloc/free](https://www.internhack.in/learn/interview/cpp-interview/cpp-new-delete-vs-malloc-free) (Beginner)
- [Memory leaks, dangling pointers and double free](https://www.internhack.in/learn/interview/cpp-interview/cpp-memory-leaks-dangling-pointers) (Intermediate)
- [RAII: Resource Acquisition Is Initialization](https://www.internhack.in/learn/interview/cpp-interview/cpp-raii) (Intermediate)
- [Constructors in C++: default, copy and move](https://www.internhack.in/learn/interview/cpp-interview/cpp-constructors-copy-move) (Intermediate)
- [Shallow copy vs deep copy](https://www.internhack.in/learn/interview/cpp-interview/cpp-shallow-vs-deep-copy) (Beginner)
- [Rule of three, rule of five and rule of zero](https://www.internhack.in/learn/interview/cpp-interview/cpp-rule-of-three-five-zero) (Advanced)
- [Lvalues, rvalues and move semantics](https://www.internhack.in/learn/interview/cpp-interview/cpp-lvalue-rvalue-move-semantics) (Intermediate)
- [Copy elision, RVO and NRVO](https://www.internhack.in/learn/interview/cpp-interview/cpp-copy-elision-rvo) (Advanced)
- [std::move vs std::forward and perfect forwarding](https://www.internhack.in/learn/interview/cpp-interview/cpp-std-move-vs-forward) (Advanced)
- [Virtual functions, vtable and vptr](https://www.internhack.in/learn/interview/cpp-interview/cpp-virtual-functions-vtable) (Intermediate)
- [Pure virtual functions and abstract classes](https://www.internhack.in/learn/interview/cpp-interview/cpp-pure-virtual-abstract-classes) (Beginner)
- [Why do base classes need a virtual destructor?](https://www.internhack.in/learn/interview/cpp-interview/cpp-virtual-destructor) (Intermediate)
- [Object slicing](https://www.internhack.in/learn/interview/cpp-interview/cpp-object-slicing) (Intermediate)
- [Function overloading vs overriding (and name hiding)](https://www.internhack.in/learn/interview/cpp-interview/cpp-overloading-vs-overriding) (Beginner)
- [Operator overloading in C++](https://www.internhack.in/learn/interview/cpp-interview/cpp-operator-overloading) (Intermediate)
- [Friend functions and inline functions](https://www.internhack.in/learn/interview/cpp-interview/cpp-friend-inline-functions) (Intermediate)
- [Templates and template specialization](https://www.internhack.in/learn/interview/cpp-interview/cpp-templates-specialization) (Advanced)
- [Smart pointers: unique_ptr and shared_ptr](https://www.internhack.in/learn/interview/cpp-interview/cpp-smart-pointers) (Intermediate)
- [weak_ptr and breaking shared_ptr cycles](https://www.internhack.in/learn/interview/cpp-interview/cpp-weak-ptr-circular-references) (Advanced)
- [vector growth and iterator invalidation](https://www.internhack.in/learn/interview/cpp-interview/cpp-vector-growth-iterator-invalidation) (Intermediate)
- [map vs unordered_map, and choosing an STL container](https://www.internhack.in/learn/interview/cpp-interview/cpp-map-vs-unordered-map-containers) (Intermediate)
- [STL algorithms and priority_queue: sort, lower_bound, heaps](https://www.internhack.in/learn/interview/cpp-interview/cpp-stl-algorithms-priority-queue) (Intermediate)
- [Lambdas and capture modes](https://www.internhack.in/learn/interview/cpp-interview/cpp-lambdas-captures) (Advanced)
- [The static keyword and its different meanings](https://www.internhack.in/learn/interview/cpp-interview/cpp-static-keyword) (Beginner)
- [Undefined behaviour: common examples and how to avoid it](https://www.internhack.in/learn/interview/cpp-interview/cpp-undefined-behaviour) (Advanced)
- [Tricky C++ output questions](https://www.internhack.in/learn/interview/cpp-interview/cpp-tricky-output-questions) (Advanced)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
