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.

Start a free mock interview

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.

  1. Memory

    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.

  2. Language

    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.

  3. Resources

    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.

  4. Standard library

    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.

  5. OOP

    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.

  6. Build

    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.

  7. Language

    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.

  8. Language

    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.

  9. Templates

    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.

  10. Concurrency

    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.

  11. Memory

    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.

  12. Language

    What are move semantics?

    A good answer covers that moving transfers an object's resources instead of copying them.

  13. OOP

    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.

  14. Standard library

    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.

  15. Standard library

    What is iterator invalidation?

    A good answer covers that changing a container can leave existing iterators, pointers or references pointing at nothing.

  16. Language

    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.

  17. Errors

    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.

  18. Performance

    How do you make a C++ hot path faster?

    A good answer covers that you measure with a profiler first and benchmark the change.

  19. Testing

    How do you test C++ code well?

    A good answer covers that unit tests with GoogleTest or Catch2 cover logic quickly.

  20. Concurrency

    What do memory orders on std::atomic mean?

    A good answer covers that compilers and CPUs may reorder memory operations unless told not to.

  21. Standard library

    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.

  22. Build

    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.

  23. Memory

    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.

  24. Security

    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.

  25. Concurrency

    When is lock-free code worth it?

    A good answer covers that lock-free structures avoid blocking but are very hard to get right.

  26. Build

    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.

  27. Language

    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.

  28. Performance

    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.

  29. Architecture

    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.

  30. Architecture

    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.

  31. Concurrency

    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.

  32. Build

    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.

  • Language
  • Standard library
  • Concurrency
  • Memory
  • Build
  • OOP
  • Performance
  • Resources
  • Architecture
  • Templates
  • Errors
  • Testing

How it works

How the mock interview runs.

  1. Concept questions that start simple and get harder.

  2. Follow-ups on every answer, so you explain the why.

  3. 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