C

0%

    Data Structures & Types

    • What is the fundamental difference between a struct and a union in terms of memory layout?

      Junior
    • Explain 'Structure Padding' and 'Alignment.' Why does the sizeof a struct often exceed the sum of its members?

      Mid
    • What is the difference between 'Deep Copy' and 'Shallow Copy' when dealing with structs containing pointers?

      Mid
    • Explain the difference between Structure Packing and Structure Padding. When is packing required?

      Mid
    • How do bit-fields work in a struct, and what are the potential portability issues associated with them?

      Senior
    • What is an opaque pointer (or incomplete type), and how does it help in implementing encapsulation in C?

      Senior
    • What is the difference between typeof and typeof_unqual in C23?

      Senior
    • Explain the use case for _BitInt(N). When would you use it over a standard int or long?

      Senior

    Pointers & Arrays

    • What is the difference between const char *p, char * const p, and const char * const p?

      Junior
    • What is the difference between an array and a pointer in C?

      Junior
    • What is the difference between void * and a null pointer?

      Junior
    • What is pointer arithmetic, and why is ptr + 1 different for a char* vs an int*?

      Junior
    • What is a void pointer, and why can't you perform pointer arithmetic on it directly?

      Junior
    • What is the purpose of a void* pointer, and what are the risks of using it?

      Mid
    • Explain the concept of 'Pointer Decay' when passing an array to a function.

      Mid

    Language Fundamentals

    • What is an enumeration (enum) and how does it differ from a series of #define constants?

      Junior
    • Why is C often referred to as a 'Mid-level' language rather than a High-level language?

      Junior
    • Is the break statement mandatory in a switch case? What happens if you omit it, and when might you do so intentionally?

      Junior
    • Explain 'Short-circuit Evaluation' in C logical expressions.

      Junior
    • What is the difference between pre-increment (++i) and post-increment (i++)?

      Junior
    • Where are string literals stored in memory, and why is modifying them undefined behavior?

      Junior
    • What is recursion, and what are the tradeoffs of recursive versus iterative solutions in C?

      Junior
    • What is the const keyword used for, and what does const correctness mean in C?

      Junior
    • Why doesn't C support function overloading, and how do developers typically work around this limitation?

      Mid
    • What is the difference between signed and unsigned integers, and what happens on overflow for each?

      Mid
    • What is two's complement, and how does C represent negative integers?

      Mid
    • Why might n++ execute faster than n = n + 1 on certain architectures?

      Senior

    Declarations Storage & Linkage

    • When would you use the extern keyword, and what happens at the linking stage if it's missing?

      Junior
    • What is the difference between a declaration and a definition?

      Junior
    • Explain the difference between 'Actual Parameters' and 'Formal Parameters'.

      Junior
    • Explain the three different meanings of the static keyword in C depending on its context.

      Mid
    • What does the register keyword suggest to the compiler, and is it still relevant in modern C development?

      Mid
    • What is the difference between a static local variable and a static global variable?

      Mid
    • What is the difference between a translation unit and a source file?

      Mid
    • What is the difference between extern and static for global variables?

      Mid
    • How does the auto keyword in C23 differ from its historical meaning in older C standards?

      Mid
    • What is the difference between 'Internal Linkage' and 'External Linkage'?

      Mid
    • What is the difference between virtual and physical memory, and how does the TLB speed up memory access?

      Senior

    Memory Management & Layout

    • Explain the difference between the stack and the heap. When would you choose one over the other?

      Junior
    • Explain the difference between malloc() and calloc() in terms of initialization and performance.

      Junior
    • What happens to a local variable's memory after a function returns?

      Junior
    • What is 'Stack Overflow,' and what are the most common conceptual causes in a C program?

      Junior
    • What is a memory leak, and how do you detect or prevent it in a C program?

      Mid
    • What is the difference between a microcontroller and a microprocessor in the context of C programming?

      Mid
    • What is the memory layout of a C program? Explain the text, data, BSS, heap, and stack segments.

      Mid
    • How does realloc work, and what are the pitfalls of using it incorrectly?

      Mid
    • What is size_t, and why should it be used for sizes and array indices?

      Mid
    • How does malloc() know how much memory to free when you only pass it a pointer?

      Senior
    • How does a memory allocator like malloc actually work under the hood, and what are the tradeoffs of different allocation strategies?

      Senior
    • What are the tradeoffs of using alloca() vs. malloc()?

      Senior
    • What is a flexible array member, and when would you use one?

      Senior

    Compilation & Preprocessor

    • What are 'include guards' and what specific problem do they solve in large-scale header inclusion?

      Junior
    • What is the difference between a typedef and a #define for creating aliases?

      Junior
    • What are the tradeoffs of using a #define macro versus a const variable?

      Junior
    • Why are #define macros considered unsafe compared to inline functions?

      Junior
    • What is the difference between #include <file.h> and #include "file.h"?

      Junior
    • Can you walk through the four stages of the C compilation process (Preprocessing, Compilation, Assembly, Linking)?

      Mid
    • Explain the difference between a macro and an inline function. When would you prefer one over the other?

      Mid
    • Explain the purpose of the constexpr keyword in C23. How does it differ from a #define macro?

      Mid
    • What do the stringizing (#) and token-pasting (##) operators do in macros?

      Senior
    • What is _Static_assert, and how does it differ from a runtime assert?

      Senior

    Functions & Control Flow

    • What is a function pointer, and what is a real-world use case for them such as callbacks or jump tables?

      Mid
    • What is 'Undefined Behavior' in C, and why is it more dangerous than a compiler error?

      Mid
    • How does printf handle a variable number of arguments? Explain the concept of va_list.

      Mid
    • Does the sizeof() operator evaluate the expression passed to it at runtime? Why or why not?

      Mid
    • What is a reentrant function, and why is it critical in multi-threaded or interrupt-driven environments?

      Senior
    • How would you implement polymorphism or virtual functions in pure C?

      Senior
    • What does the _Generic keyword (C11) do, and how does it enable pseudo-polymorphism in C?

      Senior
    • What is the purpose of setjmp and longjmp? When are they preferred over standard control flow?

      Senior

    Embedded & Systems Programming

    • Explain bitwise operations. Why are they critical for systems programming?

      Junior
    • Explain the volatile keyword. In what specific scenarios would a compiler's optimization break code if this keyword is missing?

      Mid
    • What is the difference between static linking and dynamic linking, and what are the tradeoffs regarding binary size and updateability?

      Mid
    • Explain the difference between 'Pass by Value' and 'Pass by Reference' using pointers and the architectural tradeoffs of each.

      Mid
    • What is endianness, and why does it matter when writing C code that communicates over a network or reads binary files?

      Mid
    • What is an Interrupt Service Routine (ISR), and why can't you pass parameters to it or return values from it?

      Mid
    • What is a Watchdog Timer, and how does software interact with it in C?

      Mid
    • Explain the difference between 'Polling' and 'Interrupt-driven' I/O.

      Mid
    • What are the limitations of an Interrupt Service Routine (ISR)?

      Senior
    • What is the restrict keyword, and how does it help the compiler optimize code?

      Senior
    • What is Memory-Mapped I/O (MMIO), and how do you access a hardware register in C?

      Senior
    • Why is it considered bad practice to use printf() or malloc() inside an Interrupt Service Routine (ISR)?

      Senior
    • What is 'Interrupt Latency,' and what factors contribute to it?

      Senior

    Memory Safety Vulnerabilities

    • Why is it generally considered dangerous to return the address of a local variable from a function?

      Junior
    • What is a dangling pointer, and what happens if you dereference it?

      Junior
    • What is a NULL pointer, and how does it differ from an uninitialized pointer?

      Junior
    • What is a dangling pointer, and how does it differ from a wild pointer?

      Mid
    • What is a 'Buffer Overflow' at a conceptual level, and how does C's design contribute to this vulnerability?

      Mid
    • What is the difference between nullptr (C23) and the traditional NULL macro?

      Mid
    • What is a double free and a use-after-free, and why are they dangerous?

      Mid

    Expressions Evaluation & Undefined Behavior

    • Explain the concept of 'L-value' and 'R-value' in the context of C expressions.

      Mid
    • What is Undefined Behavior (UB)? Give three examples of common C operations that result in UB.

      Mid
    • Is the order of evaluation of function arguments defined in C? Why does this matter?

      Mid
    • What is the 'Strict Aliasing Rule' and how does it affect how pointers of different types interact?

      Senior
    • Explain the concept of a 'Sequence Point' and how it relates to expressions like i = i++.

      Senior
    • How does C handle integer promotion and type conversion in mixed-type expressions?

      Senior
    • What is undefined behavior in C, and why is i = i++ + ++i considered UB?

      Senior

    Concurrency & String Memory Functions

    • What is the difference between strcpy and strncpy, and why is the latter often considered safer but still potentially dangerous?

      Junior
    • What is a race condition, and how do you use a mutex to prevent one in a multi-threaded C application?

      Mid
    • What is the difference between memcpy and memmove, and when must you use memmove?

      Mid
    • Explain the difference between a mutex and a semaphore, and when is a spinlock more efficient than a mutex?

      Senior