Roadmaps / C++ / Interview topics
Reference
Interview topics
Use these for C++ systems and performance roles. Each follow-up is the question a good interviewer asks next. The Staff line is what lifts the answer.
Phase 1
| Question | Follow-up | A Staff answer adds |
|---|---|---|
| What is undefined behaviour, and why do optimisers use it? | Show me code that "works" and is wrong. | A sanitizer-in-CI rule and how you roll it out to a large codebase |
Explain move semantics and what std::move does. | When does a move fall back to a copy? | A rule for the codebase and a check that finds accidental copies |
unique_ptr, shared_ptr or a raw pointer? | What does shared_ptr cost? | The ownership map of a real system and the cost measured |
| How do you avoid allocations on a hot path? | How do you prove there are none? | A counting allocator in tests that fails the build |
System design prompt (20 minutes): an order book at 1,000,000 messages a second with p99 under 5 microseconds. Outline: requirements and numbers (3 min), data layout (5), threads (5), failure cases (4), measurement (3).
Phase 2
| Question | Follow-up | A Staff answer adds |
|---|---|---|
| Explain acquire and release. | Where is relaxed safe? | A written ordering argument for each atomic and a test that breaks it |
| What is the ABA problem? | How do you avoid it? | Why a counter, a hazard pointer or an epoch scheme fits a given workload |
| How would you test a lock-free queue? | What does TSan not see? | Stress, a weak-memory run and a model checker, and what each cannot prove |
| Mutex or lock-free? | When is each faster? | A measured crossover under your contention |
System design prompt (20 minutes): a pipeline of parse, match and publish threads. Outline: stages and queues (4 min), ordering and backpressure (5), shutdown (4), testing (4), observability (3).
Phase 3
| Question | Follow-up | A Staff answer adds |
|---|---|---|
| A function is slow. What do you do? | What if the profile is flat? | A counter-based view (cache, branches) before a code change |
| Why does layout matter more than algorithm here? | How would you check? | A benchmark that compares layouts on the same machine |
| How do you benchmark honestly? | What can the machine do to your numbers? | Pinning, frequency control and spread reported with every number |
| When do you use SIMD? | How do you keep it portable? | A scalar fallback, a test against it and a measured gain |
System design prompt (20 minutes): a service's p99 doubled after a compiler upgrade. Outline: first questions (3 min), what to compare (5), profiling plan (5), likely causes (4), guard against a repeat (3).
Phase 4
| Question | Follow-up | A Staff answer adds |
|---|---|---|
| How do you make a C++ library usable from Python? | What about ownership across the boundary? | A C ABI, written ownership rules and an ABI check in CI |
| How do you fuzz a parser? | How do you know the fuzzer is working? | Coverage growth, a seeded crash and a corpus kept in the repository |
| How do you improve memory safety in a legacy codebase? | Where would you use Rust? | A staged plan: sanitizers, hardened libraries, then new code in a safe language where it pays |
| How do you adopt a new standard version? | What if a feature is disputed? | A feature gate, a trial in one component and a way to turn it off |
System design prompt (20 minutes): a build and release process for 200 C++ libraries. Outline: toolchains and dependencies (4 min), CI and caches (5), ABI and versioning (4), security and SBOMs (4), measuring build time and incidents (3).