Embedded Careers

Common Embedded Systems Interview Questions and How to Answer Them

Common embedded systems interview questions on C, bit manipulation, interrupts, RTOS, memory, and protocols, with model answers, code, and what interviewers look for.

On this page
  1. How embedded interviews are usually structured
  2. C language questions
  3. Bit manipulation and coding questions
  4. Memory questions
  5. Interrupt questions
  6. RTOS and concurrency questions
  7. Hardware and architecture questions
  8. Communication protocol questions
  9. System design questions
  10. Debugging and behavioral questions
  11. How to prepare
  12. Questions to ask the interviewer

Embedded systems interviews tend to circle the same core topics: C at a low level, bit manipulation, memory, interrupts, RTOS concepts, hardware basics, communication protocols, and debugging. The questions themselves are often short. What separates candidates is how well they explain the why, and whether they can connect an answer to real hardware.

Below are the questions that come up most often, grouped by topic, with model answers and notes on what interviewers are usually checking.

How embedded interviews are usually structured

Formats vary by company, but a typical process includes some mix of:

  1. Recruiter or phone screen. Background, interest, and a few quick technical questions.
  2. Technical screen. C questions, bit manipulation, and a short coding problem, often in a shared editor.
  3. On-site or virtual loop. Several interviews covering deeper C, embedded concepts, system design, debugging scenarios, and behavioral questions.
  4. Sometimes a hands-on exercise. A take-home project, or debugging code on a real board.

Smaller companies may compress this into one or two conversations. Either way, expect to talk through your own projects in detail.

C language questions

What does volatile mean, and when do you need it?

Answer: volatile tells the compiler that a variable’s value can change outside the normal flow of the program, so every read and write in the source must actually happen. Without it, the compiler may keep the value in a register or remove accesses it thinks are redundant.

You need it for:

  • Memory-mapped hardware registers
  • Variables shared between an interrupt service routine (ISR) and the main code
  • Variables shared between tasks or threads in some cases, though volatile alone isn’t enough there (see below)
volatile bool data_ready = false;

void UART_IRQHandler(void) {
    /* ... read byte ... */
    data_ready = true;
}

int main(void) {
    while (!data_ready) {
        /* without volatile, the compiler could turn this into an infinite loop */
    }
}

Follow-up to expect: “Does volatile make a variable thread-safe?” No. It doesn’t make operations atomic and doesn’t stop reordering with non-volatile accesses. A read-modify-write such as count++ on a volatile variable can still be interrupted halfway. You need atomic operations, critical sections, or RTOS primitives for that.

What does const volatile mean?

Answer: The program can’t write the variable, but its value can still change. The classic example is a read-only hardware status register:

#define STATUS_REG (*(const volatile uint32_t *)0x40001000u)

What’s the difference between these declarations?

volatile uint32_t *p1;         /* pointer to volatile data */
uint32_t *volatile p2;         /* volatile pointer to normal data */
volatile uint32_t *volatile p3;/* volatile pointer to volatile data */

Answer: Read the declaration from right to left. p1 is the common case for registers: the data it points to is volatile. p2 is a pointer whose own value may change unexpectedly, for example a pointer updated in an ISR. p3 is both.

What are the meanings of static in C?

Answer: It depends on where it’s used:

  • Inside a function: the variable keeps its value between calls and lives for the whole program, not on the stack.
  • On a global variable or function at file scope: it limits visibility to that source file (internal linkage), which is useful for hiding module internals.

Interviewers like a mention of why the second use matters: it keeps module internals private and avoids name clashes in large firmware projects.

What is the size of this struct?

struct a { uint8_t x; uint32_t y; uint8_t z; };
struct b { uint32_t y; uint8_t x; uint8_t z; };

Answer: On a typical 32-bit target, struct a is often 12 bytes and struct b often 8. The compiler adds padding so that y sits on a 4-byte boundary, and adds trailing padding so arrays of the struct stay aligned. The exact layout is implementation-defined, so the honest answer is “usually, on this kind of target,” followed by an explanation of padding. Reordering members from largest to smallest often reduces padding.

Follow-up: “Why not just use __attribute__((packed))?” Packed structs can cause unaligned accesses, which are slower on some cores and fault on others. They’re useful for matching wire formats, but should be used with care.

What happens with sizeof on an array passed to a function?

Answer: Inside the function, the array parameter is really a pointer, so sizeof gives the pointer’s size, not the array’s. Pass the length as a separate argument.

Bit manipulation and coding questions

Expect at least one of these. Write them cleanly, and use unsigned types.

Set, clear, toggle, and test a bit

reg |=  (1u << n);          /* set bit n */
reg &= ~(1u << n);          /* clear bit n */
reg ^=  (1u << n);          /* toggle bit n */
bool on = (reg >> n) & 1u;  /* test bit n */

Mention that 1u matters: shifting a signed 1 into the sign bit is undefined behavior.

Check whether a number is a power of two

bool is_power_of_two(uint32_t x) {
    return x != 0 && (x & (x - 1)) == 0;
}

Explain it: a power of two has exactly one bit set, and x - 1 flips that bit and sets every bit below it, so the AND is zero.

Count the set bits

unsigned count_bits(uint32_t x) {
    unsigned n = 0;
    while (x) {
        x &= x - 1;  /* clears the lowest set bit */
        n++;
    }
    return n;
}

You might mention that many compilers provide a built-in such as __builtin_popcount, and some cores have an instruction for it.

Determine the endianness of the system

bool is_little_endian(void) {
    uint16_t v = 1;
    return *(uint8_t *)&v == 1;
}

Explain it: in little-endian systems the least significant byte is stored at the lowest address. Most ARM Cortex-M parts and x86 are little-endian, while network protocols traditionally use big-endian byte order.

Implement a ring (circular) buffer

This is one of the most common embedded coding questions, because ring buffers sit between ISRs and main code everywhere.

#define RB_SIZE 64u  /* power of two */

typedef struct {
    uint8_t data[RB_SIZE];
    volatile uint32_t head;  /* written only by the producer */
    volatile uint32_t tail;  /* written only by the consumer */
} ringbuf_t;

bool rb_put(ringbuf_t *rb, uint8_t byte) {
    if (rb->head - rb->tail == RB_SIZE) {
        return false;  /* full */
    }
    rb->data[rb->head % RB_SIZE] = byte;
    rb->head++;
    return true;
}

bool rb_get(ringbuf_t *rb, uint8_t *byte) {
    if (rb->head == rb->tail) {
        return false;  /* empty */
    }
    *byte = rb->data[rb->tail % RB_SIZE];
    rb->tail++;
    return true;
}

Points to raise: the free-running unsigned indices wrap correctly because the size is a power of two. With one producer (say, an ISR) and one consumer, each index is written by only one side, which avoids most locking. On multi-core systems, or where the compiler or CPU can reorder accesses, you may also need memory barriers. Interviewers often ask what happens when the buffer is full: drop the new data, overwrite the oldest, or signal an error.

Memory questions

What’s the difference between the stack and the heap?

Answer: The stack holds local variables, function arguments, and return addresses. It’s allocated and freed automatically as functions are called and return, and it’s fast but limited in size. The heap provides dynamic memory through malloc and free, and its lifetime is controlled by the programmer.

Why is malloc often avoided in embedded systems?

Answer: Several reasons:

  • Fragmentation. Over time, free memory can break into small pieces, so a large allocation fails even though enough total memory is free.
  • Non-deterministic timing. Allocation time can vary, which is a problem for real-time code.
  • Failure handling. A device running unattended for years needs a plan for allocation failure, and that’s hard to test.

Common alternatives: static allocation, memory pools with fixed-size blocks, or allocating only during startup. Many safety coding standards restrict dynamic allocation for these reasons.

What are .text, .data, and .bss?

Answer: .text holds code and is usually in flash. .data holds initialized global and static variables. Their initial values are stored in flash and copied to RAM by startup code. .bss holds zero-initialized globals and statics, which the startup code clears to zero. Constants often go in a read-only section in flash.

How would you detect a stack overflow?

Answer: Options include filling the stack with a known pattern at startup and checking how much has been overwritten (“stack painting”), placing a guard region and using the MPU to fault on access, using hardware stack limit registers on cores that have them, or using the RTOS’s built-in overflow checks.

Interrupt questions

What should and shouldn’t you do in an ISR?

Answer: Keep ISRs short. Clear the interrupt flag, capture the data, signal a task or set a flag, and return. Avoid:

  • Blocking calls and long loops
  • printf and other slow or non-reentrant library functions
  • Heavy computation, or floating point on cores where it’s slow or requires extra context saving
  • Taking mutexes. RTOS kernels usually provide special ISR-safe calls instead.

A common interview prompt shows a bad ISR and asks what’s wrong:

void UART_IRQHandler(void) {
    char c = UART->DR;
    printf("got %c\n", c);  /* slow, may block, may not be reentrant */
}

The better answer: push c into a ring buffer and let the main loop or a task do the printing.

How do you safely share a variable between an ISR and main code?

Answer: Declare it volatile, and make sure accesses are atomic. On an 8-bit microcontroller, reading a 32-bit variable takes several instructions, so an interrupt can fire halfway through and produce a torn value. Protect multi-step accesses with a short critical section that disables interrupts, or use atomic operations where the hardware supports them.

What is interrupt latency, and what affects it?

Answer: It’s the time from the hardware event to the first instruction of the ISR. It’s affected by the CPU’s interrupt entry mechanism, higher-priority interrupts already running, sections of code that disable interrupts, and memory wait states. Keeping critical sections short is the main way software reduces it.

RTOS and concurrency questions

What’s the difference between a mutex and a semaphore?

Answer: A mutex is for mutual exclusion around a shared resource. It has an owner, so only the task that locked it should unlock it, and many RTOS implementations add priority inheritance to mutexes. A semaphore is a signaling mechanism with a count. A binary semaphore is often used to signal from an ISR to a task, and a counting semaphore tracks a number of available resources. Using a binary semaphore as a lock works, but you lose ownership and priority inheritance.

What is priority inversion, and how is it solved?

Answer: A high-priority task needs a resource held by a low-priority task, and a medium-priority task preempts the low-priority one. The high-priority task ends up waiting on the medium-priority task, even though they share nothing. The well-known example is the Mars Pathfinder mission in 1997, which experienced repeated resets caused by priority inversion. Engineers fixed it by enabling priority inheritance remotely.

Solutions: priority inheritance, where the low-priority task temporarily gets the priority of the waiting high-priority task, or the priority ceiling protocol. Good design also keeps the time spent holding shared resources short.

What is a race condition? Give an embedded example.

Answer: A race condition is a bug where the outcome depends on the timing of concurrent operations. Example: main code does counter++ while an ISR also modifies counter. The increment is a read, a modify, and a write, so if the interrupt fires between the read and the write, one update is lost.

What is a deadlock, and how do you avoid it?

Answer: Two or more tasks each hold a resource the other needs, so neither can proceed. Avoid it by acquiring locks in a consistent global order, holding as few locks as possible, using timeouts, and designing so tasks communicate through queues rather than shared locked data where practical.

When would you use an RTOS instead of a super loop?

Answer: A super loop is simpler and fine for small systems with few timing demands. An RTOS helps when you have several activities with different timing requirements, when you need preemption so urgent work isn’t stuck behind slow work, or when the code is getting hard to manage as one loop. The costs are RAM for task stacks, some CPU overhead, and new failure modes like priority inversion.

Hardware and architecture questions

What’s the difference between a microcontroller and a microprocessor?

Answer: A microcontroller puts the CPU, flash, RAM, and peripherals on one chip, and is designed for dedicated control tasks with low power and cost. A microprocessor is mainly the CPU, relying on external memory and often external peripherals. It’s typically used where more performance and an operating system like Linux are needed.

What’s the difference between Harvard and von Neumann architectures?

Answer: Von Neumann uses one memory space and bus for both instructions and data. Harvard uses separate paths for instructions and data, so an instruction fetch and a data access can happen at the same time. Many modern microcontrollers use a modified Harvard design, with separate buses internally but a unified address map.

Why does I2C need pull-up resistors?

Answer: I2C lines are open-drain (or open-collector). Devices can only pull a line low, so a resistor pulls it high when no one is driving it. This lets multiple devices share the bus without fighting over it, and enables clock stretching and arbitration. The resistor value is a tradeoff between rise time (bus capacitance and speed) and current draw.

What is switch bounce, and how do you handle it?

Answer: Mechanical contacts bounce when pressed or released, producing a burst of transitions over a few milliseconds. Handle it in hardware with an RC filter (sometimes with a Schmitt trigger), or in software by sampling the input periodically and accepting a change only after it has been stable for several samples.

What is a watchdog timer, and how should you use it?

Answer: It’s a hardware timer that resets the system if software doesn’t refresh (“kick”) it in time, so the device can recover from hangs. Interviewers like to hear that you shouldn’t kick it blindly from a timer interrupt, because the interrupt can keep running while the main application is stuck. A better approach is to kick it only after confirming that each critical task has checked in.

What is DMA, and when would you use it?

Answer: Direct memory access lets a peripheral move data to or from memory without the CPU copying each byte. It’s useful for high-throughput transfers like ADC sampling, audio, SPI displays, and UART reception. Follow-ups may cover cache coherency on cores with data caches, and double buffering.

Communication protocol questions

Compare UART, I2C, and SPI.

UART I2C SPI
Clock Asynchronous (agreed baud rate) Synchronous Synchronous
Wires TX, RX (plus ground) SDA, SCL (plus ground) SCLK, MOSI, MISO, plus one chip select per device
Topology Point to point Shared bus with addresses One controller, multiple peripherals selected by chip select
Duplex Full duplex Half duplex Full duplex
Typical use Debug consoles, GPS and modem modules Sensors, EEPROMs, low-speed peripherals Displays, flash memory, fast ADCs

Good follow-up answers: I2C is convenient for many slow devices on two wires. SPI is faster and simpler at the signal level but needs more pins. UART needs both sides to agree on baud rate and frame format.

What is CAN, and why is it used in vehicles?

Answer: Controller Area Network is a multi-node differential bus designed for noisy environments. Messages carry identifiers instead of node addresses, and the identifier also sets priority during arbitration, so the most important message wins without corrupting the bus. It has built-in error detection and fault confinement, which suits automotive and industrial systems.

System design questions

Expect open-ended prompts like:

How to answer:

  1. Ask clarifying questions. Power source, update requirements, timing constraints, cost, safety needs.
  2. Sketch the hardware blocks. MCU, sensors, power, communication.
  3. Choose an architecture. Super loop, RTOS tasks, or an event-driven state machine, and say why.
  4. Cover the failure cases. Power loss during an update, sensor failure, communication dropouts, the watchdog.
  5. Mention testing. How you’d test logic off-target and verify behavior on hardware.

For a bootloader in particular, interviewers look for an A/B or backup image scheme, image verification (checksums or signatures), and a way to recover if the new image fails to boot.

Debugging and behavioral questions

“Tell me about the hardest bug you’ve fixed.”

This is close to universal. Prepare one or two stories that show your process: the symptoms, how you narrowed it down, the tools you used (debugger, logic analyzer, oscilloscope, logging), the root cause, and what you changed so it wouldn’t happen again. Hardware-software boundary bugs make especially good stories.

“How would you debug a device that resets randomly in the field?”

A strong answer covers: checking reset cause registers, examining power supply stability and brown-out settings, looking for watchdog resets and stack overflows, capturing fault information (such as the Cortex-M fault status registers) into memory that survives a reset, adding logging, and trying to reproduce under stress or temperature conditions.

Behavioral questions

Expect questions about working with hardware engineers, handling disagreements, meeting deadlines, and learning new things quickly. Answer with specific examples, and be honest about what you did yourself versus as part of a team.

How to prepare

  • Revise C fundamentals until you can explain them out loud: pointers, volatile, static, memory layout, and undefined behavior.
  • Practice bit manipulation and small data structures by hand and in an editor without autocomplete.
  • Know your own projects inside out. Interviewers often spend a large part of the interview on your resume, so be ready to explain every design choice.
  • Review the job posting. If it mentions CAN, BLE, embedded Linux, or a specific RTOS, refresh those topics.
  • Do a few mock interviews, including explaining a design on a whiteboard.

If you’re still building the projects to talk about, our guide to getting an embedded systems job with no experience covers portfolio projects that hold up well in interviews. For study material, see our list of books and websites to learn embedded systems, and for broader preparation, the embedded systems engineer roadmap.

Questions to ask the interviewer

Good questions show you understand embedded work and help you judge the role:

  • What hardware and toolchain does the team use? Which MCU families, RTOS, or Linux?
  • How is firmware tested? Is there unit testing, hardware-in-the-loop, or CI?
  • How much lab time does the role involve, and what equipment is available?
  • How do firmware and hardware engineers work together during board bring-up?
  • What does onboarding look like for someone new to the codebase?
  • What are the biggest technical challenges on the current product?

The answers also tell you a lot about engineering maturity, which matters as much as salary when comparing offers. For more on pay, see embedded software engineer salary: what to expect.

The complete guide to embedded careers

Embedded Systems Engineer Roadmap and Prerequisites
Read the guide

Keep exploring

Guides from other topics

All topics →