✅ Embedded C Interview Questions
1. Basics of Embedded C
- What is Embedded C and how is it different from standard C?
- Why is C language preferred for embedded systems?
- What are the features of Embedded C?
- What are the differences between C and Embedded C?
- Explain the role of cross compilers in Embedded C.
- What is the difference between firmware and software?
- What are the memory types used in embedded systems?
- Explain the use of the
volatile
keyword in Embedded C. - What is the use of
const
in Embedded C? - What is the difference between
#define
andconst
in C?
2. Data Types & Storage
- What are the basic data types in Embedded C?
- What is the difference between signed and unsigned integers?
- Explain fixed-point vs floating-point in embedded systems.
- What is the difference between
int8_t
,uint8_t
,int16_t
, etc.? - Why do we prefer fixed-width data types in Embedded C?
- How does the compiler decide the size of an
int
? - What is endianess (big-endian vs little-endian)?
- How do you handle endianess issues in Embedded C?
- What is memory alignment and why is it important?
- What is padding in structures?
3. Pointers & Memory
- What is a pointer in C?
- How are pointers used in embedded systems?
- What is a null pointer?
- What is a dangling pointer?
- What is the difference between pointer to constant and constant pointer?
- Explain pointer to a function with an example.
- How are function pointers used in embedded systems (e.g., ISRs)?
- What is a memory leak? Can it happen in embedded C?
- How is dynamic memory allocation handled in embedded systems?
- Why is
malloc()
often avoided in embedded systems?
4. Preprocessor & Macros
- What is the role of the preprocessor in C?
- Difference between
#include <file>
and#include "file"
? - What are macros? Give an example.
- What is the difference between macros and inline functions?
- Explain conditional compilation in Embedded C.
- What is the use of
#pragma
in Embedded C? - How are header guards used and why are they needed?
- What are predefined macros in C?
- What is the difference between
#ifdef
and#if defined()
? - Can you write a macro for swapping two numbers?
5. Embedded C Specific Concepts
- What is an interrupt?
- How do you write an Interrupt Service Routine (ISR) in Embedded C?
- What is the difference between polling and interrupts?
- What is the role of timers in Embedded C?
- How is delay implemented in Embedded C?
- How do you configure I/O ports in Embedded C?
- What is a watchdog timer?
- What is memory-mapped I/O?
- What is the difference between Harvard and Von Neumann architecture?
- How do you access hardware registers in Embedded C?
6. Embedded C Programming Questions
- Write a program to toggle an LED connected to a GPIO pin.
- Write a program to generate a PWM signal.
- How do you write a delay function using timers?
- Write a function to reverse a string in C.
- Write a program to count the number of 1s in a binary number.
- Write a program to implement a circular buffer in Embedded C.
- Write code to detect button debounce.
- How do you write an ISR for a UART receive interrupt?
- Write a program to check whether a number is power of 2.
- Implement a simple state machine in C.
7. Optimization & Best Practices
- What are the different ways to reduce code size in Embedded C?
- What is loop unrolling?
- Why is
volatile
important in Embedded C? - How do you avoid race conditions in embedded systems?
- What is inline assembly in C?
- Explain memory fragmentation in embedded systems.
- How do you optimize power consumption in embedded firmware?
- What is debouncing and how do you handle it in code?
- Explain the difference between RTOS and bare-metal programming.
- What is the use of bit-fields in Embedded C?
8. Debugging & Testing
- How do you debug embedded C code without printf()?
- What tools are used for embedded system debugging?
- Explain JTAG and SWD debugging.
- What is the difference between simulation and emulation?
- What is boundary scan (JTAG IEEE 1149.1)?
- How do you measure execution time of a function in Embedded C?
- What are common causes of hard faults in ARM Cortex MCUs?
- How do you debug a stack overflow in embedded systems?
- What is static code analysis?
- How do you handle error logging in resource-constrained devices?
9. Advanced Embedded C Concepts
- Explain re-entrant functions.
- What is mutual exclusion (mutex)?
- How do you implement semaphores in Embedded C?
- What is priority inversion and how to solve it?
- What is the difference between ISR and task in RTOS?
- How do you implement inter-task communication?
- What is double buffering in embedded systems?
- What are DMA controllers and how are they programmed?
- Explain bootloaders in embedded systems.
- What is memory protection unit (MPU) in ARM Cortex-M?
10. Frequently Asked HR + Practical Questions
- Why do you want to work in embedded systems?
- What projects have you done in Embedded C?
- How do you keep yourself updated with embedded technologies?
- What are the biggest challenges in embedded firmware development?
- What microcontrollers have you worked with (ARM, AVR, PIC, STM32, etc.)?
- Can you explain your experience with RTOS programming?
- How do you manage limited memory in embedded systems?
- Have you worked with UART, SPI, I²C protocols in Embedded C?
- Describe a debugging issue you faced and how you solved it.
- Where do you see yourself in embedded development in the next 5 years?
Leave a Reply