Common Interview Questions in C
Common Interview Questions in C
Introduction
C interview questions help you test your understanding of core programming concepts.
👉 These questions are commonly asked in placements and technical interviews.
Why Practice Interview Questions?
- ✔ Improve problem-solving
- ✔ Strengthen concepts
- ✔ Prepare for placements
- ✔ Build confidence
1. What is the difference between ++i and i++?
Answer:
-
++i→ Pre-increment (increase first, then use) -
i++→ Post-increment (use first, then increase)
Example
#include <stdio.h>
int main() {
int i = 5;
printf("%d\n", ++i);
printf("%d\n", i++);
return 0;
}
Output
6
6
2. What is a Pointer?
Answer:
👉 A pointer is a variable that stores the address of another variable.
3. What is the difference between Structure and Union?
Answer:
- Structure → Separate memory for each member
- Union → Shared memory
4. What is NULL pointer?
Answer:
👉 A pointer that does not point to any valid memory location.
5. What is Dangling Pointer?
Answer:
👉 A pointer pointing to memory that has been deallocated, freed, or gone out of scope.
6. What is Memory Leak?
Answer:
👉 Memory allocated but not freed using free().
7. What is Recursion?
Answer:
👉 A function calling itself.
8. Difference between malloc() and calloc()?
Answer:
-
malloc()→ Uninitialized memory -
calloc()→ Initialized to zero
9. What is a Segmentation Fault?
Answer:
👉 Error caused by accessing invalid memory.
10. What is static keyword?
Answer:
👉 Retains variable value between function calls.
Interview Questions Table
| Question | Key Concept |
|---|---|
| Increment Operators | Operators |
| Pointers | Memory |
| Structures vs Union | Data Types |
| Memory Leak | DMA |
| Recursion | Functions |
Important Notes
- Focus on concepts
- Practice coding questions
- Understand memory
Common Mistakes
- ❌ Memorizing without understanding
- ❌ Ignoring basics
- ❌ Not practicing coding
Pro Tips
- ✔ Revise fundamentals
- ✔ Practice daily
- ✔ Solve previous questions
- ✔ Explain answers clearly
Conclusion
Interview questions in C help you prepare for technical rounds and improve your understanding of core concepts.
Practice regularly to succeed in interviews.
👉 This article is part of Dharani Tech Edu Hub — where learning programming is made simple and practical.
Comments
Post a Comment