Guides › Interview prep

How to prepare for a C++ developer interview

Updated 27 Nov 2026

Introduction

C++ interviews have a reputation for being harder than interviews for most other languages, and the reputation is partly deserved. A C++ role usually exists because performance, memory or hardware matters: trading systems, databases, browsers, game engines, networking, embedded devices, compilers. Interviewers for these roles want to know two things at once — whether you can solve problems in code, and whether you understand what your code actually does when it runs.

The good news is that the subject is finite. The same groups of topics come up again and again, and a few weeks of structured preparation makes a visible difference. This guide walks through each part of a typical C++ interview process in India, what is usually asked, how to prepare for it, and the mistakes that cost strong candidates offers.

1. Understand the process before you prepare

Interview processes differ by company, but most C++ roles at product companies, trading firms and infrastructure teams follow a similar shape:

RoundWhat it checksUsual format
ScreeningBasic fit, salary expectations, notice period; sometimes a short testPhone call or online test (2–3 problems)
CodingProblem solving and clean, correct codeOne or two problems in a shared editor, 45–60 minutes
C++ depthKnowledge of the language and its runtime behaviourConversation with questions and small code snippets
Design or projectsHow you build systems and make decisionsDesign a component, or walk through something you built
Hiring manager / teamHow you work with others, what you want nextConversation

Services companies and campus processes often add an aptitude test and a written C++ test with output-prediction questions ("what does this program print?").

What to do: ask the recruiter which rounds to expect and whether the coding round allows you to choose the language. Most recruiters will tell you, and it changes how you spend your preparation time.

2. C++ depth: the topics that decide the interview

This is the round where C++ candidates are separated. Interviewers rarely ask for definitions alone; they ask why something behaves the way it does, and what you would do about it. Revise these areas in this order.

2.1 Object lifetime and memory

Know where objects live and when they die.

  • Stack and heap. A local object is destroyed when its scope ends; heap memory lives until something frees it.
  • RAII (Resource Acquisition Is Initialisation). A resource — memory, a file, a lock — is owned by an object, and the object's destructor releases it. This is the single most important idea in modern C++.
  • Smart pointers. std::unique_ptr for single ownership (the default choice); std::shared_ptr when ownership is genuinely shared; std::weak_ptr to observe without owning and to break reference cycles.

A typical question: "Why is std::make_unique preferred over new?" A good answer covers exception safety (no leak if something throws between allocation and the smart pointer taking ownership), clarity (no naked new in the code), and that it states ownership at the point of creation.

// Ownership is clear: the vector owns the widgets, and they are freed with it.
std::vector<std::unique_ptr<Widget>> widgets;
widgets.push_back(std::make_unique<Widget>("first"));

2.2 Copy and move

Most performance questions in C++ interviews come back to copies.

  • The rule of three / five / zero. If a class manages a resource itself, it needs a destructor, copy constructor, copy assignment, and — for efficiency — move constructor and move assignment. Better still, let members such as std::vector or std::unique_ptr manage resources, and write none of them (the rule of zero).
  • Move semantics. std::move does not move anything; it is a cast that allows a move to happen. After a move, the source is valid but unspecified.
  • Hidden copies. Passing large objects by value, returning by value into an existing variable, range-for loops without &, and capturing by value in lambdas.
for (auto order : orders)        // copies every Order
for (const auto& order : orders) // no copies

Be ready to explain return value optimisation (RVO): returning a local object by value usually costs nothing, because the compiler constructs it directly in the caller's space.

2.3 The standard library and its costs

You will be asked which container to use and why. Know the cost of the common operations:

ContainerFindInsertNotes
std::vectorO(n), O(log n) if sortedAmortised O(1) at the endContiguous memory, fastest in practice for small and medium sizes
std::mapO(log n)O(log n)Sorted; a tree of nodes
std::unordered_mapAverage O(1)Average O(1)Hashing; worst case O(n); iteration order not defined
std::dequeO(n)O(1) at both endsNot contiguous

Also revise iterator invalidation: inserting into a vector can move every element and invalidate all iterators and references; erasing from a map invalidates only the erased element.

A strong answer mentions the cache: a vector scanned linearly can beat a map lookup for small sizes because its memory is contiguous.

2.4 Polymorphism and the object model

  • Virtual functions, the vtable and its cost.
  • Why a base class with virtual functions needs a virtual destructor.
  • Object slicing when a derived object is copied into a base object.
  • When to prefer templates (compile-time polymorphism) over virtual functions.

2.5 Templates and modern C++

Know function and class templates, what the compiler generates from them, and why errors appear at instantiation. For modern C++ (C++11 onwards), be comfortable with auto, lambdas and their captures, constexpr, std::optional, std::variant, structured bindings and, for senior roles, concepts (C++20).

2.6 Concurrency

For trading, systems and backend roles this is often the deciding topic.

  • std::thread, std::mutex, std::lock_guard, std::unique_lock, condition variables.
  • Data races and why they are undefined behaviour, not just "wrong results".
  • std::atomic and the idea of memory ordering; be honest about how deep your knowledge goes.
  • Deadlock: how it happens (two locks taken in different orders) and how to avoid it (a fixed order, std::scoped_lock).

A common exercise: "Make this counter thread-safe" — and then the follow-up, "Now make it fast." The second question is about contention: atomics, per-thread counters, or batching.

2.7 Undefined behaviour and tools

Interviewers like candidates who know how C++ goes wrong and how to catch it.

  • Common causes: reading uninitialised memory, out-of-bounds access, dangling references, signed integer overflow, data races.
  • Tools: AddressSanitizer, UndefinedBehaviorSanitizer, ThreadSanitizer, Valgrind, and compiler warnings (-Wall -Wextra).

Saying "I would run it under AddressSanitizer first" when a program crashes intermittently shows real-world experience.

3. Coding rounds: how to practise

Coding rounds in C++ interviews are similar to those for other languages, but you are expected to use the language well.

Practise in C++, with the standard library. Use std::vector, std::unordered_map, std::priority_queue and std::sort as you would at work. Writing your own linked list in an interview is rarely what anyone wants.

Follow the same routine for every problem:

  1. Repeat the problem in your own words and ask about edge cases and input sizes.
  2. Describe a simple solution first, with its time and memory cost.
  3. Improve it if needed, and say why the improvement works.
  4. Write the code — clear names, small functions.
  5. Test it out loud with small cases: empty input, one element, duplicates, the largest size.

Topics worth covering: arrays and strings, hashing, two pointers and sliding windows, sorting and binary search, stacks and queues, trees and graphs (BFS, DFS), heaps, and basic dynamic programming. For trading and systems roles, add bit manipulation and problems about streams of data.

Practise without autocomplete at least sometimes. Some interviews use a plain shared editor, and small syntax gaps are surprisingly stressful under time pressure.

4. Design and project rounds

Mid-level and senior candidates usually face a design or project discussion. For C++ roles, the design is often lower level than for web roles — a cache, a rate limiter, a logging library, an order book, a thread pool.

A useful structure:

  1. Clarify what the component must do and its limits (requests per second, memory, latency).
  2. Sketch the interface — the functions other code will call.
  3. Choose data structures and explain the cost of each operation.
  4. Discuss concurrency: who calls this from which threads?
  5. Discuss failure: what happens when memory runs out, input is malformed, or a dependency is slow?

For the project discussion, prepare two projects you know deeply. For each, be ready to answer: what problem it solved, what you personally built, one decision you would change today, and one result you can measure. If you made something faster, say how you measured it — interviewers notice the difference between "it felt faster" and "p99 latency dropped, measured with our benchmark suite".

5. Common mistakes that cost offers

  • Reciting definitions without explaining consequences.
  • Writing C-style C++: raw new/delete, manual arrays, char* strings, in a modern codebase interview.
  • Ignoring the cost of what you write — copies, allocations, hidden O(n) operations.
  • Silence while coding. Interviewers want to follow your thinking.
  • Overclaiming. If you have never used memory orderings beyond the default, say so; then explain what you do know.

6. A four-week preparation plan

WeekFocus
1Memory, RAII, smart pointers, copy and move. Rewrite one old project file in modern C++.
2Standard library costs and iterator rules; 10–12 coding problems in C++.
3Concurrency and undefined behaviour; build a small thread pool or bounded queue; run it under ThreadSanitizer.
4Design practice (two components out loud), project stories, and two timed mock interviews.

Frequently asked questions

Which C++ standard should I prepare for? Most teams in India use C++14 or C++17, with C++20 growing. Know C++11/14/17 well and be aware of the main C++20 features.

Do I need to know assembly? Rarely, except for low-latency, compiler or embedded roles. Knowing roughly what the compiler generates — inlining, vtable calls, copies — is enough for most interviews.

Can I use C++ for the coding round if the job uses another language? Usually yes; ask the recruiter. Use the language you are fastest and most accurate in.

Find C++ roles on Boostinorbit

  • See open roles that ask for C++, updated daily: C++ developer jobs in India, or by city — Bengaluru, Pune, Hyderabad.
  • Start a thread with your CV. Its fibers find C++ roles that fit you, and Sarah prepares you for each one, including the topics that role's interview is likely to cover. You approve every application before it is sent.
Did this answer your question?
See developer jobs in India →