C++ Developer track
C++ interview questions and answers
C++ interviews test memory, pointers, object lifetimes, templates and speed. Then you solve a coding problem. Practice both with follow-ups.
Questions
Interview questions and answers.
Real questions from this track, from easier to harder, with what a good answer covers. In the mock interview, each one comes with follow-ups based on what you say.
What is the difference between the stack and the heap in C++?
A good answer covers that stack objects are created and destroyed automatically with their scope.
What is the difference between a reference and a pointer?
A good answer covers that a reference is another name for an existing object and cannot be null or reseated.
What is RAII?
A good answer covers that a resource is tied to an object's lifetime: taken in the constructor, released in the destructor.
How does std::vector work?
A good answer covers that a vector keeps its elements in one block of memory, so access by index is fast.
What does virtual do in C++?
A good answer covers that a virtual function is chosen by the object's real type when called through a base pointer or reference.
Why does C++ split code into header and source files?
A good answer covers that headers declare what other files can use and source files define it.
What does const mean in C++, and where do you use it?
A good answer covers that const marks a value that must not change after it is set.
What is undefined behavior in C++?
A good answer covers that some mistakes, like reading past an array or using freed memory, have no defined result.
How do templates work in C++?
A good answer covers that a template is a pattern the compiler fills in for each type it is used with.
How do you share data safely between threads in C++?
A good answer covers that a data race on shared data without a lock is undefined behavior.
When do you use unique_ptr, shared_ptr and weak_ptr?
A good answer covers that unique_ptr owns an object alone and frees it when it goes away.
What are move semantics?
A good answer covers that moving transfers an object's resources instead of copying them.
What are the rule of three, five and zero?
A good answer covers that a class managing a resource needs a destructor, copy and move operations that agree.
How do you choose between vector, list, map and unordered_map?
A good answer covers that vector is the default because contiguous memory is fast for the CPU cache.
What is iterator invalidation?
A good answer covers that changing a container can leave existing iterators, pointers or references pointing at nothing.
How do lambdas capture variables, and what can go wrong?
A good answer covers that a lambda can capture by value, copying, or by reference, sharing.
What are the levels of exception safety?
A good answer covers that the basic guarantee leaves objects valid and leaks nothing if an exception is thrown.
How do you make a C++ hot path faster?
A good answer covers that you measure with a profiler first and benchmark the change.
How do you test C++ code well?
A good answer covers that unit tests with GoogleTest or Catch2 cover logic quickly.
What do memory orders on std::atomic mean?
A good answer covers that compilers and CPUs may reorder memory operations unless told not to.
What are std::string_view and std::span, and what are their risks?
A good answer covers that they are cheap views into memory owned by something else.
How do you manage builds and dependencies in a C++ project?
A good answer covers that CMake describes targets and their dependencies, not just compiler flags.
Why can memory allocation be a performance problem, and what do you do about it?
A good answer covers that each heap allocation costs time and can fight between threads.
How would you reduce memory safety bugs in a C++ codebase?
A good answer covers that safer types like span, smart pointers and bounds-checked access replace raw buffers.
When is lock-free code worth it?
A good answer covers that lock-free structures avoid blocking but are very hard to get right.
What is ABI compatibility, and why does it matter for C++ libraries?
A good answer covers that the ABI is how compiled code agrees on layout, names and calling.
How would you modernize a large old C++ codebase?
A good answer covers that you start with warnings, sanitizers and tests to make changes safe.
How would you build a C++ system where tail latency matters, like trading or games?
A good answer covers that allocations, locks and system calls are kept off the hot path.
How would you structure a large C++ system for many teams?
A good answer covers that components have clear interfaces and few header dependencies between them.
When would you choose C++ for a new system today, and when not?
A good answer covers that C++ fits when you need control over memory and speed, or existing C++ code.
How would you design a C++ server that uses all cores without races?
A good answer covers that work is split so each thread owns its data, with messages between them.
What tools and checks would you require for a team's C++ code?
A good answer covers that formatting and clang-tidy run on every change.
What it covers
Topics.
How it works
How the mock interview runs.
Concept questions that start simple and get harder.
Follow-ups on every answer, so you explain the why.
One coding challenge in a live editor.
Your report scores technical correctness, problem-solving & tradeoffs, communication clarity, with quotes from your answers as proof.
Questions.
What C++ questions come up most?
Expect pointers and references, RAII and smart pointers. Move semantics and virtual functions come up a lot. You may also be asked about undefined behavior: code that can break in surprising ways.
How does an Orin mock interview work?
You talk with Orin by voice, like a video call. It asks questions, listens and asks follow-ups based on what you said. Coding happens in a live editor and design on a live whiteboard. After the interview you get a report with quotes from your answers, what cost you points and what to practice next.
Is it free?
Your first interview is free: a 15-minute round with a short coding exercise. No card needed.
Practice the real thing.
A c++ developer mock interview by voice, with follow-ups and feedback you can use. First interview free.
Start free interview