Embedded Systems Interview Q&A

Click on each question to expand and see the answer.

Answer: A microprocessor is CPU-based and requires external peripherals, while a microcontroller has CPU, memory, and I/O on a single chip.

Answer: An ISR is a special function executed when an interrupt occurs, handling urgent tasks before returning to normal flow.

Answer: Polling checks device status continuously, wasting CPU time. Interrupts signal the CPU only when needed, improving efficiency.

Answer: An RTOS ensures predictable scheduling of tasks with deadlines, used in real-time systems like automotive and robotics.

Answer: Debouncing removes false triggers when mechanical switches bounce during press/release, handled in hardware or software.

Answer: Harvard uses separate memory for data and instructions, enabling parallel access. Von Neumann uses one shared memory, causing bottlenecks.

Answer: A watchdog timer resets the system if the program hangs, improving reliability.

Answer: Volatile memory (RAM) loses data when power is off, while non-volatile (ROM, Flash) retains data without power.

Answer: Endianness defines byte order in memory. Big-endian stores MSB first; little-endian stores LSB first.

Answer: General Purpose Input/Output pins are used for digital input or output in microcontrollers.

Answer: DMA allows peripherals to transfer data to/from memory without CPU intervention, improving speed.

Answer: SPI (Serial Peripheral Interface) is a synchronous protocol using MOSI, MISO, SCLK, and SS lines.

Answer: I2C is a two-wire protocol (SDA, SCL) supporting multiple masters and slaves using addressing.

Answer: UART is an asynchronous serial protocol using TX and RX lines for communication.

Answer: Flash memory erases in blocks and is faster; EEPROM erases/writes byte by byte but has longer endurance.

Answer: The oscillator provides the clock signal for timing and synchronization of operations.

Answer: Priority inversion happens when a high-priority task is blocked by a lower-priority task holding a shared resource.

Answer: Memory-mapped I/O assigns peripheral registers to memory addresses, allowing CPU to use normal instructions for access.

Answer: Static allocation is fixed at compile-time; dynamic allocation is done at runtime using malloc/free.

Answer: Semaphores are synchronization primitives used to control access to shared resources among tasks.

Answer: A mutex (mutual exclusion) ensures only one task accesses a resource at a time, preventing race conditions.

Answer: The stack stores function return addresses, local variables, and temporary data during program execution.

Answer: Interrupt latency is the time between an interrupt request and the start of ISR execution.

Answer: Context switching is saving and restoring CPU states when switching between tasks or processes.

Answer: A real-time system guarantees task completion within strict deadlines, often safety-critical.

Answer: Cache memory stores frequently used instructions/data closer to CPU, reducing access time.

Answer: Embedded C is a set of language extensions for C to program embedded systems efficiently.

Answer: malloc allocates uninitialized memory, calloc allocates and initializes memory to zero.

Answer: Segmentation fault occurs when a program accesses restricted memory locations.

Answer: Inline functions request the compiler to replace function calls with code, reducing overhead.

Answer: Volatile tells the compiler that a variable can change unexpectedly, preventing optimization.

Answer: Const declares variables as read-only, preventing modification.

Answer: Macros are preprocessor directives (#define) that replace code before compilation.

Answer: A pointer is a variable that stores the memory address of another variable.

Answer: A dangling pointer points to freed or invalid memory, causing undefined behavior.

Answer: Structures store all members separately, unions share the same memory for all members.

Answer: Recursion is when a function calls itself directly or indirectly.

Answer: Segmentation divides memory into segments like code, data, and stack, improving organization.

Answer: Memory leak occurs when allocated memory is not freed, reducing available memory.

Answer: Stack overflow happens when the stack exceeds its limit, often due to deep recursion.

Answer: Embedded systems are application-specific with limited resources, while general-purpose computers are versatile and powerful.

Answer: A cross compiler generates code for a platform different from the one on which the compiler runs.

Answer: A bootloader is a small program that initializes hardware and loads the main firmware or OS.

Answer: Firmware is software programmed into non-volatile memory that controls hardware functions.

Answer: Bit-banding maps individual bits of a memory region to entire words, allowing atomic bit operations.

Answer: ISR nesting allows higher-priority interrupts to interrupt the execution of lower-priority ISRs.

Answer: JTAG is a standard for testing and debugging integrated circuits, also used for programming microcontrollers.

Answer: A race condition occurs when multiple tasks access shared resources simultaneously, leading to unpredictable results.

Answer: Memory fragmentation occurs when free memory is divided into small blocks, making allocation inefficient.

Answer: Embedded Linux is a lightweight version of Linux optimized for embedded devices with limited resources.