Embedded Interview Q&A - C, Linux, RTOS, ARM & More
Embedded Interview Q&A - C, Linux, RTOS, ARM & More
12. Explain the difference between static and dynamic memory allocation.
22. What are the advantages of a doubly linked list over a singly linked list?
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
26. Explain the working of Bubble Sort vs Quick Sort.
27. What is the worst-case time complexity of Merge Sort?
39. What is the difference between text and binary file modes?
EXTRA:
1. What is the purpose of the volatile keyword in C?
8. Describe the difference between singly, doubly, and circular linked lists.
9. What is a stack and queue? How are they implemented using arrays and linked lists?
12. Compare Merge Sort and Quick Sort in terms of time complexity and stability.
15. Explain the difference between pass by value and pass by reference.
17. How does garbage collection work in C? (Hint: Manual vs. Automatic)
21. Explain the const keyword and its different use cases.
24. What is the difference between deep copy and shallow copy?
29. What are B-trees and B+ trees? How are they used in databases?
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
30. Explain AVL trees and their balancing mechanisms.
SOLVE
1. Reverse a string in-place.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
7. Print "Hello, World!" N times without loops (Recursion)
15. Find the sum of all digits until a single digit remains (Digital root)
21. Separate even and odd numbers in an array (In-place, two- pointer)
22. Find all triplets in an array that sum to zero (O(n²) time)
24. Merge two sorted arrays into a third sorted array (O(m+n) time)
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
32. Find the odd numbers in an array
41. Check if a number is even or odd without using % or /. (Hint: Use bitwise operations)
51. Find the majority element in an array (appears > n/2 times). (Boyer-Moore Voting
Algorithm)
53. Find the smallest missing positive integer in an unsorted array. (O(n) time, O(1)
space)
55. Find the longest substring with at most k distinct characters. (Sliding
Window)
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
57. Add two numbers represented as linked lists (MSB first).
58. Rearrange a linked list in zig-zag fashion (a < b > c < d > e
...).
60. Detect and remove the longest palindrome list in a linked list.
62. Convert a binary tree into a circular doubly linked list. (In-place)
64. Count the number of ways to decode a message (A=1, B=2, ..., Z=26).
79. Implement a Binary Search Tree (BST) with insertion, deletion, and
traversal.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
82. Implement BFS and DFS for a graph.
98. Implement LRU Cache using a hashmap and doubly linked list.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
111. Swap two numbers without a temporary variable.
118. Implement a binary search tree (BST) with insertion and traversal.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
139. Implement strstr() (substring search).
Operating Systems
Advanced Processes & Threads
1. What is a process control block (PCB)? What information does it store?
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
3. What is a zombie process? How can it be avoided?
6. CPU Scheduling
7. Explain Multilevel Queue Scheduling with an example.
18. Deadlocks
19. What are the four necessary conditions for a deadlock?
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
33. Compare FAT, NTFS, and ext4 file systems.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
3. Write a program to list all running processes (using /proc).
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
34. Write a port scanner in C.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
4. What is the significance of /proc and /sys filesystems?
6. Process Management
7. Explain the difference between fork(), vfork(), and clone().
8. What happens during exec() system call? Does it create a new process?
9. How does wait() and waitpid() work? What are zombie processes?
26. What is the difference between O_SYNC and O_DIRECT flags in open()?
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
33. Explain madvise() and its performance impact.
46. What are Unix domain sockets? When are they faster than TCP?
58. How are system calls implemented in Linux (from glibc to kernel)?
Solve
1. File & I/O Operations
2. Implement cat command to display file contents.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
4. Create a program that appends text to a file atomically (using O_APPEND).
7. Process Management
8. Create a process tree (parent → child → grandchild) and print PIDs.
13. Signals
14. Write a signal handler to gracefully shutdown on SIGINT.
18. Write a program that sends signals between processes using kill().
24. Write a program to pass file descriptors between processes using sendmsg().
30. Write a program to deadlock two threads and then resolve it.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
32. Implement a TCP echo server and client.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Embedded Systems & ARM Architecture
Embedded Fundamentals
1. What defines an embedded system? How does it differ from general computing?
4. What are the key constraints in embedded systems? (Power, Memory, Real-time)
6. ARM Architecture
7. Compare ARM Cortex-M, Cortex-R, and Cortex-A series processors
9. What are the key differences between ARM and RISC-V architectures?
11. What are the various ARM processor modes? (User, IRQ, FIQ, Supervisor etc.)
14. What are the different memory types in embedded systems? (Flash, SRAM,
EEPROM)
23. What are the various ARM exception types? (Reset, NMI, HardFault etc.)
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
26. How does the WFI (Wait For Interrupt) instruction work?
27. What are the techniques for power optimization in embedded designs?
28. Explain dynamic voltage and frequency scaling (DVFS) in ARM SoCs
40. How does SWD (Serial Wire Debug) differ from JTAG?
50. What are the key differences between FreeRTOS and Zephyr for ARM?
52. How are mutexes and semaphores implemented at the ARM assembly
level?
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
54. Optimization Techniques
55. Explain ARM NEON technology and its applications
59. What are the key considerations for writing interrupt-safe code on ARM?
Solve
ARM Assembly Fundamentals
1. Write ARM assembly to add two 64-bit numbers
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
25. Implement a memory allocator for embedded systems
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
57. Create a command-line interface over UART
4. What are Loadable Kernel Modules (LKMs)? How are they different from built-in
drivers?
9. What is Direct Memory Access (DMA)? How does the kernel handle it?
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
15. What is RCU (Read-Copy-Update)? When is it preferred?
17. What is priority inversion and how does the kernel prevent it?
20. Explain the difference between top halves and bottom halves in interrupt handling.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
45. What is KASAN (Kernel Address Sanitizer)?
solve
Basic Kernel Modules
1. Write a "Hello, Kernel!" module that logs to dmesg.
6. Memory Management
7. Allocate contiguous memory with kmalloc and dma_alloc_coherent.
12. Synchronization
13. Implement a mutex to protect shared data in a driver.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
16. Simulate a deadlock between two kernel threads.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
47. Simulate a battery/power management driver.
6. IP Layer
7. Compare IPv4 and IPv6 header structures
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
12. Transport Layer
13. Describe the TCP 3-way handshake and 4-way termination
29. What are Unix domain sockets and when to use them?
42. Security
43. Compare stateful and stateless firewalls
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
44. How do SYN floods and DDoS attacks work?
54. Performance
55. How to measure network latency vs throughput?
Solve
Socket Programming
1. Implement TCP echo server/client
6. Protocol Implementation
7. Simulate ARP cache with timeout
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
15. Implement TC classifier for QoS
RTOS Fundamentals
1. Compare RTOS vs GPOS design philosophies
6. Scheduling
7. Explain rate monotonic scheduling (RMS)
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
15. Explain MPU (Memory Protection Unit) usage
solve
Task Management
1. Create periodic tasks in FreeRTOS
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
4. Build task statistics collector
6. Synchronization
7. Implement priority inheritance mutex
18. Performance
19. Measure context switch time
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
GOING ADVANCED
1. C & Data Structures
1. How would you implement a lock-free linked list using CAS (Compare-And-
Swap)?
2. Explain the ABA problem in lock-free algorithms and how to mitigate it.
3. Design a thread-safe, generic red-black tree in C using macros.
4. How does restrict keyword optimize pointer aliasing? Show disassembly
examples.
5. Implement a memory allocator with O(1) allocation/deallocation using buddy system.
6. Write a C macro to simulate templated functions (e.g., MAX(T, x, y)).
7. Explain how to exploit undefined behavior (e.g., type-punning) for performance gains.
8. Design a concurrent hash table with striped locking and resizing.
9. How would you detect stack corruption using canary values?
10. Implement a coroutine scheduler in C using setjmp/longjmp.
2. Operating Systems
1. How does the Linux CFS (Completely Fair Scheduler) handle NUMA architectures?
2. Explain how eBPF hooks into the kernel to replace iptables for packet filtering.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
3. Design a userspace page fault handler using userfaultfd().
4. How does the kernel mitigate Spectre/Meltdown vulnerabilities at runtime?
5. Implement a fault-tolerant filesystem using COW (Copy-On-Write) techniques.
6. Explain how io_uring achieves zero-copy I/O with kernel bypass.
7. How would you hotpatch a running kernel function using kprobes?
8. Design a deterministic memory allocator for real-time tasks.
9. Explain how KASLR (Kernel Address Space Layout Randomization) is bypassed in
exploits.
10. Implement a minimal hypervisor using KVM APIs.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
7. Explain how to use ARM ETM for real-time instruction tracing.
8. Implement a CAN FD driver with zero-copy DMA and hardware timestamps.
9. How do you mitigate Rowhammer attacks on LPDDR4 in automotive SoCs?
10. Design a fault-tolerant system using dual-core lockstep (Cortex-R52).
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
7. Explain how BBR congestion control outperforms CUBIC in high-BDP networks.
8. Implement a zero-copy RDMA-based filesystem (e.g., NVMe-over- Fabrics).
9. How does TCP Fast Open (TFO) reduce HTTPS handshake latency?
10. Design a DDoS mitigation system using eBPF and hardware rate-limiting.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Microcontrollers & Microprocessors
1. Raspberry Pi (Latest Models: Pi 5, Pi 4B, Pi Pico) Raspberry Pi 5
(2023)
Processor: Broadcom BCM2712 (4× Cortex-A76 @ 2.4GHz)
GPU: VideoCore VII (OpenGL ES 3.1, Vulkan 1.2)
RAM: 4GB/8GB LPDDR4X
Storage: MicroSD, PCIe 2.0 x1 for NVMe SSD
GPIO: 40-pin header (3.3V logic, 26× GPIO, UART, I2C, SPI, PWM)
USB: 2× USB 3.0, 2× USB 2.0
Networking: Gigabit Ethernet, Dual-band Wi-Fi 5, Bluetooth 5.0
Video Output: 2× micro-HDMI (4K @ 60Hz)
Power: USB-C (5V/5A)
Peripherals:
o 2× MIPI CSI (camera)
o 1× MIPI DSI (display)
o RTC (Real-Time Clock)
Raspberry Pi Pico (RP2040 MCU)
Processor: Dual-core ARM Cortex-M0+ @ 133MHz
RAM: 264KB SRAM
Flash: 2MB QSPI
GPIO: 26× multifunction (UART, I2C, SPI, PWM, ADC)
ADC: 3× 12-bit (0-3.3V)
Interfaces: USB 1.1 (Host/Device), PIO (Programmable I/O)
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Cortex- M33
ARMv8-M 160MHz TrustZone, FPU Secure IoT
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Pinout Diagrams for Microcontrollers &
Microprocessors
1. Raspberry Pi 5 (40-Pin Header) Pinout:
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
3V3 ─── EN
GND ─── VP (GPIO36)
D15 ─── VN (GPIO39)
D2 ─── D34 (Input Only) D4 ───
D35 (Input Only) D16 ─── D32
D17 ─── D33
D5 ─── D25 (DAC1)
D18 ─── D26 (DAC2)
D19 ─── D27
D21 ─── D14
RX2 ─── D12
TX2 ─── D13
D22 ─── D23
D23 ─── GND
5V ─── 3V3
Key Pins:
3V3 → 3.3V output (for sensors, LEDs).
5V → Input for USB/external power.
GND → Ground (multiple pins).
GPIO0 → LOW = Flashing mode, HIGH = Normal boot.
EN → Reset (LOW = reset, HIGH = run).
UART0 (GPIO1-TX, GPIO3-RX) → Debug serial (avoid using).
I2C (GPIO21-SDA, GPIO22-SCL) → Default I2C bus.
SPI (GPIO18-CLK, GPIO19-MISO, GPIO23-MOSI) → Default VSPI.
GPIO36 (SVP), GPIO39 (SVN), GPIO34, GPIO35 → Input-only (no pull-ups).
GPIO2, GPIO5, GPIO12, GPIO15 → Must be in correct state at boot.
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
P9 Header (46-Pin):
Key Pins:
P8_3-P8_6: eMMC (do not use)
P9_19/20: I2C2 (SCL/SDA)
P9_24/26: UART1 (TXD/RXD)
P9_33: 1.8V ADC (AIN4)
Key Pins:
A0-A5: Analog inputs (10-bit ADC)
D3/D5/D6/D9/D10/D11: PWM (8-bit)
D10-D13: SPI (SS/MOSI/MISO/SCK)
A4/A5: I2C (SDA/SCL)
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
5. STM32F103C8T6 (Blue Pill)
Pinout:
Key Pins:
PA9/PA10: USART1 (TXD/RXD)
PB6/PB7: I2C1 (SCL/SDA)
PA2/PA3: USART2 (TXD/RXD)
PA0-PA7: 12-bit ADC
Key Pins:
SWDIO/SWCLK: Debugging (PA13/PA14)
USART_TX/RX: Default serial (PA9/PA10)
I2C_SCL/SDA: PB6/PB7
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
1, 17 3.3V power
2, 4 5V power
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Linkedin@KeerthanaGaliveeti
Interview Questions For Embedded Engineer
Linkedin@KeerthanaGaliveeti