Top 50 Most Frequently Asked C Questions
Q: What is C programming?
A: C is a general-purpose, procedural programming language.
Q: What are variables in C?
A: Variables store data values in memory.
Q: What are data types?
A: They define the type and size of data.
Q: What is the difference between = and == ?
A: = assigns, == compares.
Q: What is a pointer?
A: A pointer stores the address of another variable.
Q: What is NULL pointer?
A: A pointer that points to nothing.
Q: What is a function?
A: A block of reusable code.
Q: Difference between call by value and call by reference
A: Value passes copy; reference passes address.
Q: What is recursion?
A: Function calling itself.
Q: What is an array?
A: A collection of same-type elements.
Q: What is a string?
A: A char array ending with \0.
Q: Difference between char[] and char*
A: char[] is array; char* points to string literal.
Q: What is dynamic memory allocation?
A: Allocating memory at runtime.
Q: Explain malloc, calloc, realloc, free
A: malloc allocates; calloc zero-initializes; realloc resizes; free releases.
Q: What is a structure?
A: User-defined data type grouping variables.
Q: What is a union?
A: Like struct but shares memory for all members.
Q: Structure vs union
A: Struct allocates memory for all; union shares memory.
Q: What is typedef?
A: Creates alias for type.
Q: What is a macro?
A: Text replacement via preprocessor.
Q: Difference between macro and function
A: Macros expand; functions execute.
Q: What is #include?
A: Includes header files.
Q: What is segmentation fault?
A: Invalid memory access.
Q: What is stack vs heap?
A: Stack auto memory; heap dynamic memory.
Q: What is volatile keyword?
A: Prevents optimization.
Q: What is static keyword?
A: Preserves value across calls or limits scope.
Q: What is const keyword?
A: Makes variable read-only.
Q: What is pointer arithmetic?
A: Operations on pointer addresses.
Q: What is a dangling pointer?
A: Pointer to freed memory.
Q: What is a wild pointer?
A: Uninitialized pointer.
Q: What is a void pointer?
A: Pointer to unknown type.
Q: What is a function pointer?
A: Holds address of function.
Q: What is a file pointer?
A: Pointer used for file operations.
Q: What are file modes in C?
A: r, w, a, rb, wb, etc.
Q: What is fseek and ftell?
A: Moves file pointer; tells current position.
Q: What are storage classes?
A: auto, static, extern, register.
Q: What is a preprocessor?
A: Runs before compilation.
Q: What is sizeof operator?
A: Returns size in bytes.
Q: What is a nested loop?
A: Loop inside loop.
Q: What is switch case?
A: Multi-branch selection.
Q: Difference between break and continue
A: break exits loop; continue skips iteration.
Q: What is pass by pointer?
A: Passing address of variable.
Q: What is a 2D array?
A: Array of arrays.
Q: What is a multi-file program?
A: (Explanation provided in interview context.)
Q: What is an enum?
A: User-defined constant list.
Q: What is undefined behavior?
A: Results unpredictable.
Q: What is buffer overflow?
A: Writing out of memory bounds.
Q: What is a segmentation fault?
A: (Explanation provided in interview context.)
Q: What is shallow copy vs deep copy?
A: Copying references vs copying data.
Q: Explain structure padding
A: Compiler adds bytes to align data.
Beginner-Level C Questions
Q: What is a variable?
A: (Explanation provided in interview context.)
Q: What is syntax of C program?
A: (Explanation provided in interview context.)
Q: What are keywords?
A: (Explanation provided in interview context.)
Q: What is printf?
A: (Explanation provided in interview context.)
Q: What is scanf?
A: (Explanation provided in interview context.)
Q: What is a datatype?
A: (Explanation provided in interview context.)
Q: What is an operator?
A: (Explanation provided in interview context.)
Q: What are arithmetic operators?
A: (Explanation provided in interview context.)
Q: What is if-else?
A: (Explanation provided in interview context.)
Q: What is a loop?
A: (Explanation provided in interview context.)
Q: What is for loop?
A: (Explanation provided in interview context.)
Q: What is while loop?
A: (Explanation provided in interview context.)
Q: What is do-while loop?
A: (Explanation provided in interview context.)
Q: What is a function?
A: A block of reusable code.
Q: What is an array?
A: A collection of same-type elements.
Q: What is a string?
A: A char array ending with \0.
Q: What is pointer basics?
A: (Explanation provided in interview context.)
Q: What is return type?
A: (Explanation provided in interview context.)
Q: What is header file?
A: (Explanation provided in interview context.)
Q: What is compiler?
A: (Explanation provided in interview context.)
Pointer-Related Interview Questions
Q: What is a pointer?
A: A pointer stores the address of another variable.
Q: What is NULL pointer?
A: A pointer that points to nothing.
Q: What is void pointer?
A: (Explanation provided in interview context.)
Q: What is wild pointer?
A: (Explanation provided in interview context.)
Q: What is dangling pointer?
A: (Explanation provided in interview context.)
Q: What is pointer arithmetic?
A: Operations on pointer addresses.
Q: What is pointer to pointer?
A: (Explanation provided in interview context.)
Q: What is array of pointers?
A: (Explanation provided in interview context.)
Q: What is pointer to array?
A: (Explanation provided in interview context.)
Q: What is function pointer?
A: (Explanation provided in interview context.)
Q: What is memory leak?
A: (Explanation provided in interview context.)
Q: What is malloc?
A: (Explanation provided in interview context.)
Q: What is calloc?
A: (Explanation provided in interview context.)
Q: What is realloc?
A: (Explanation provided in interview context.)
Q: What is free?
A: (Explanation provided in interview context.)
Q: How to avoid pointer errors?
A: (Explanation provided in interview context.)
Q: Pointer vs array difference
A: (Explanation provided in interview context.)