InterviewStack.io LogoInterviewStack.io

Embedded C and C Plus Plus Questions

Skills for writing correct, efficient, and deterministic C and C plus plus code in resource constrained and hardware close environments. Topics include pointer arithmetic and ownership, manual memory management, static versus dynamic allocation, stack and heap tradeoffs, const correctness, volatile qualifier usage, memory mapped input output, struct packing and alignment, bit manipulation, inline assembly basics, compiler optimizations and flags, avoiding or carefully using runtime features such as exceptions and heavy use of templates or virtual functions in constrained contexts, deterministic timing and real time considerations, defensive coding patterns for embedded systems, common embedded idioms and pitfalls, and debugging and toolchain practices such as cross compiling, linkers, and hardware debugging techniques.

EasyTechnical
43 practiced
You boot your microcontroller and it immediately triggers a HardFault. Outline a pragmatic, step-by-step debugging plan to find the root cause using typical embedded tools (JTAG/SWD, map files, symbol information, reading registers). Mention minimally intrusive techniques if the target hardware is fragile.
HardTechnical
41 practiced
You compiled with optimization and noticed a test that relied on a side-effecting read to a peripheral register no longer behaves correctly. The disassembled code shows the read was removed. Explain why this happened, how to fix the code, and how to design code and review practices to prevent such bugs across a codebase.
MediumTechnical
54 practiced
A flag variable 'volatile uint8_t data_ready' is set in an ISR and cleared in the main loop. The main loop reads it in a while loop waiting for data_ready == 1. Describe data races, potential optimizations the compiler could do incorrectly if volatile is omitted, and write a robust pattern to safely set/clear and consume this flag including any required memory barriers or atomic semantics.
HardSystem Design
52 practiced
Design a GPIO abstraction layer for an embedded platform that must support: 1) low-power safe operations (able to configure wake-up sources), 2) shared pins among multiple drivers with conflict resolution, and 3) IRQ-safe API for setting/clearing pins from ISRs. Sketch the API and describe internal data structures and locking strategies appropriate for small MCUs.
HardTechnical
40 practiced
You have a templated C++ utility that is instantiated in many translation units leading to code bloat and long link times. As an embedded developer, propose refactoring techniques to reduce code size and compilation/link times while preserving type safety: consider explicit instantiation, pimpl/type-erasure, reducing template parameter space, or moving heavy templates to single compilation units.

Unlock Full Question Bank

Get access to hundreds of Embedded C and C Plus Plus interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.