Performance, Debugging and Build Tools Interview Questions for C++
24 Performance, Debugging and Build Tools questions with answers for c++ roles — 7 easy, 12 medium, 5 hard.
About Performance, Debugging and Build Tools
Learn the professional toolchain: CMake, static and dynamic libraries, compiler flags, GoogleTest, gdb, sanitizers, Valgrind and perf. Understand cache locality and profiling-driven optimisation, and practise debugging crashes, latency spikes and slow builds the way experienced C++ engineers do in production teams.
What is the difference between a static library and a dynamic library?
Show answer
Which unit testing frameworks are common in C++?
Show answer
What are header guards and #pragma once?
Show answer
Write a minimal modern CMakeLists.txt for an app with a library and tests.
Show answer
Measure how long a function takes to run in C++.
Show answer
Show the compiler commands to build with strict warnings and sanitizers enabled.
Show answer
What do compiler optimisation levels like -O0, -O2, -O3 and -Os mean?
Show answer
What is cache locality and why does it matter for performance?
Show answer
Which profiling tools do you use for C++ and what does each show?
Show answer
What are AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer?
Show answer
A C++ server crashes with a segmentation fault in production. How do you debug it?
Show answer
A full build of your C++ project takes 40 minutes. How would you reduce it?
Show answer
Your application is slow and you are asked to optimise it. Where do you start?
Show answer
A binary runs on your laptop but fails on the server with error while loading shared libraries. What is wrong?
Show answer
List the gdb commands you would use to debug a crash.
Show answer
Write a GoogleTest unit test for a function, including an edge case.
Show answer
How do you prioritise when a critical bug and a feature deadline arrive at the same time?
Show answer
Why should we hire you for this C++ developer role?
Show answer
A low-latency service shows occasional latency spikes of several milliseconds. How would you investigate?
Show answer
You are building a particle simulation with millions of particles. Would you store them as an array of structs or a struct of arrays?
Show answer
Use perf to find the hotspots in a C++ program.
Show answer
Write a micro-benchmark with Google Benchmark comparing two approaches.
Show answer
Tell me about a performance improvement you delivered and how you measured it.
Show answer
Frequently asked questions
How important is Performance, Debugging and Build Tools in C++ interviews?
Learn the professional toolchain: CMake, static and dynamic libraries, compiler flags, GoogleTest, gdb, sanitizers, Valgrind and perf. Understand cache locality and profiling-driven optimisation, and practise debugging crashes, latency spikes and slow builds the way experienced C++ engineers do in production teams.
How should I use the Performance, Debugging and Build Tools sheet?
Go top to bottom — easy to hard. Answer before opening each answer, tick what you solved and save misses to Last-Minute Revision.