65 Essential Embedded System Interview Questions and Answers
This comprehensive guide presents 65 common embedded‑system interview questions covering topics such as memory layout, stack vs. heap, static and volatile keywords, pointers and references, malloc usage, C vs. C++ differences, compilation stages, process and thread concepts, IPC mechanisms, and networking fundamentals, providing concise explanations and code examples for each.
Embedded systems integrate hardware and software to perform dedicated tasks with real‑time, stability, and reliability requirements. The following interview questions explore core concepts and practical knowledge needed for embedded‑system roles.
1. Difference between Heap and Stack
The stack is statically allocated, managed automatically by the compiler, small, fast, and follows LIFO order; the heap is dynamically allocated, managed manually via malloc/free, larger, and slower.
2. Stack and Heap Size Limits
Both are limited by OS and compiler settings; typical stack sizes range from a few to tens of megabytes, while heap size depends on address space (32‑bit ~2 GB, 64‑bit much larger).
3. static Keyword
Static local variables retain their value between calls; static global variables are limited to the defining source file; static functions have internal linkage.
4. volatile Keyword
Prevents compiler optimizations on a variable, ensuring every access reads/writes actual memory, useful for multi‑threaded or hardware‑mapped variables.
5. extern Keyword
Declares a variable or function defined in another translation unit, enabling cross‑file linkage.
6. Reference vs. Pointer
References are aliases, cannot be null, and must be initialized; pointers hold addresses, can be reassigned and null.
7. malloc Usage and Pitfalls
#include <stdlib.h> is required; always check the return value for NULL, free allocated memory, and cast when needed (e.g., int* ptr = (int*)malloc(sizeof(int)); ).
8. C vs. C++ Differences
C is procedural, C++ adds object‑orientation, templates, exception handling, and RAII for resource management.
9. C Compilation Process
Preprocessing → Compilation → Assembly → Linking, producing an executable.
10. Overloading, Overriding, Hiding
Overloading: same name, different parameters; Overriding: subclass redefines a base‑class method; Hiding: subclass member with same name hides the base member.
11. Smart Pointers
std::shared_ptr , std::unique_ptr , and std::weak_ptr automate memory management in C++.
12. Memory Leak vs. Overflow
Leak: allocated memory never freed; overflow: writing beyond allocated bounds.
13. Deep vs. Shallow Copy
Shallow copy duplicates references; deep copy duplicates the actual data structures.
14. Callback Functions
Functions passed as arguments to be invoked later, commonly used in asynchronous code.
15. Function Call Stack Mechanics
Parameters are pushed (usually right‑to‑left), stack frames are created, and cleaned up on return.
16. Type Specifiers
int, char, float, double, void, struct in C/C++; additional types in Java, Python, JavaScript.
17. Variable Scope and Addresses
Global variables have fixed addresses; local variables reside on the stack; GDB can display addresses with p &var .
18. Process vs. Thread
Processes have separate address spaces; threads share the same process memory, making communication cheaper but requiring synchronization.
19. Tree Traversal (Recursive & Non‑Recursive)
Pre‑order, in‑order, post‑order traversals using recursion or explicit stacks.
20. Linked List Sorting (Merge Sort)
Divide‑and‑conquer algorithm with O(n log n) time and O(1) extra space for singly linked lists.
21. TCP/IP Layer Functions
Application, Transport (TCP/UDP), Network (IP), Data Link, Physical layers each provide specific services.
22. UDP Transmission
Connectionless send/receive using sendto() and recvfrom() with explicit IP/port.
23. Process Synchronization Techniques
Mutexes, semaphores, condition variables, barriers, shared memory, message queues, etc.
24. Linux System Calls
Invoked via assembly syscall , C library wrappers (e.g., open() , read() ), or higher‑level language APIs.
25. ioctl
Device‑specific control interface: ioctl(fd, request, argp) to set/get driver parameters.
26. Debugging with GDB
Set breakpoints, use print var , display var , watch var , and info locals to inspect variables.
27. Network Troubleshooting
Check connectivity, firewalls, logs, capture packets with Wireshark, verify server configuration, and test with different clients.
28. iptables Basics
List rules ( iptables -L ), flush ( -F ), allow/deny specific IPs and ports, set default policies.
Deepin Linux
Research areas: Windows & Linux platforms, C/C++ backend development, embedded systems and Linux kernel, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.