InterviewStack.io LogoInterviewStack.io

Embedded C and C++ Programming Questions

Coding for resource-constrained and real-time hardware in C and C++: register and hardware access, the const and volatile qualifiers, embedded coding patterns, and compiler pragmas, together with the performance-and-safety discipline embedded work demands: memory management under tight budgets, struct packing and memory layout, code-size optimization, hardware-level atomicity, and synchronization primitives for inter-task communication. Covers the language-level discipline where every construct maps to hardware behavior, plus reasoning about deterministic timing, footprint, and safe concurrency on microcontrollers and real-time systems. Distinct from general C/C++ in its hardware-facing constraints.

MediumTechnical
23 practiced

Describe correct read-modify-write patterns for hardware registers that have non-trivial side-effects (for example, some bits are write-1-to-clear). Explain how to implement bit-set and bit-clear operations safely when bits are volatile and concurrent writes can occur from different contexts.

EasyTechnical
24 practiced

Describe const correctness in C and C++. Explain the difference between 'const pointer to T' vs 'pointer to const T' and how to express that in function signatures. Give a short example of an API for reading sensor data that uses const to prevent accidental modification.

HardTechnical
22 practiced

Implement a deterministic memory pool allocator in C that supports allocate(size) and free(ptr) for fixed-size blocks (configurable block sizes). Provide APIs and an implementation sketch (free-list per size class). Discuss how you would avoid fragmentation and what bookkeeping you need for diagnostics.

MediumTechnical
22 practiced

Describe atomic operations and memory ordering primitives available in C11 (stdatomic.h). Give an example to implement an atomic increment with acquire-release semantics and explain when you would need weaker or stronger orderings in embedded code.

MediumTechnical
38 practiced

Describe how to implement a lightweight stack canary (guard value) scheme for task stacks in an RTOS. Explain where to place the canary, when to check it, and how to handle detection in production devices with limited diagnostics.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.