InterviewStack.io LogoInterviewStack.io

C and C Plus Plus Fundamentals Questions

Core syntax and semantics of C and C Plus Plus languages, including pointers, references, manual memory allocation and deallocation patterns such as malloc/free and new/delete, structs, enums, preprocessor directives, const and volatile qualifiers, function declarations and prototypes, and differences between C and C Plus Plus. Covers writing correct and idiomatic code, understanding undefined behavior, lifetime and ownership, common standard library usage, compilation and linking basics, and how language features affect correctness and performance.

MediumTechnical
63 practiced
You have legacy C code that violates the strict aliasing rule by type-punning via pointers. Explain the problem and show two correct alternatives in C to safely reinterpret a float as uint32_t and back without invoking undefined behavior.
HardTechnical
72 practiced
Provide a concrete example where compiler optimizations combined with the strict aliasing rule lead to incorrect program behavior in C. Explain why the optimizer is allowed to assume strict aliasing, and show two correct ways to fix the code so it is portable and safe on modern compilers.
EasyTechnical
125 practiced
In C, explain what a pointer is, how to declare and initialize pointers, and show an example of pointer dereference and pointer arithmetic. Also explain the difference between a pointer-to-const and a const-pointer, with short code examples. Frame the answer for embedded systems where pointers commonly reference memory-mapped registers and peripheral buffers.
EasyTechnical
61 practiced
Explain scoped enums (enum class) in C++ and how they differ from C-style enums. Discuss underlying type selection, implicit conversions, and why enum class can reduce bugs in embedded code where integer sizes and sign matter.
HardTechnical
61 practiced
You encounter a hard fault on a bare-metal ARM Cortex-M device running C/C++ firmware. Describe a systematic debugging plan: what registers and stack frame to inspect, how to interpret fault status registers, how compiler optimization levels can change fault behavior, and practical instrumentation techniques to make fault reproduction and stacking diagnostics reliable in production devices.

Unlock Full Question Bank

Get access to hundreds of C and C Plus Plus Fundamentals interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.