🔴 Advanced · Lesson 48
C Interview Questions
Interview Questions
Interview Preparation
C interviews mostly check fundamentals: memory, pointers, arrays, functions, strings, structures, files and logic building.
Important Questions and Answers
| No. | Question | Answer |
|---|---|---|
| 1 | What is C language? | A procedural, general-purpose programming language used for system and application programming. |
| 2 | Difference between compiler and interpreter? | Compiler translates whole program; interpreter executes line by line. |
| 3 | What is pointer? | A variable that stores address of another variable. |
| 4 | What is dangling pointer? | A pointer that points to memory already freed or invalid. |
| 5 | malloc vs calloc? | malloc gives uninitialized memory; calloc initializes memory to zero. |
| 6 | Structure vs union? | Structure members have separate memory; union members share memory. |
| 7 | What is recursion? | A function calling itself with a base condition. |
| 8 | What is static variable? | A variable that preserves its value for whole program lifetime. |
| 9 | What is segmentation fault? | Invalid memory access error. |
| 10 | What are header files? | Files containing declarations, macros and constants. |
Common Coding Questions
- Reverse a string without library function
- Check prime number
- Find second largest element in array
- Swap two numbers using pointer
- Implement stack using array
- Count vowels in a string
- Write and read student record from file
- Create linked list and display nodes
C Language
#include <stdio.h>
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}Interview Tips
- Explain memory diagrams for pointer questions
- Always mention base condition in recursion
- Write clean code with meaningful names
- Check edge cases
- Do not ignore compile warnings
Interview Preparation
C interview में fundamentals check होते हैं: memory, pointers, arrays, functions, strings, structures और files.
Important Q&A
| No. | Question | Answer |
|---|---|---|
| 1 | What is C language? | A procedural, general-purpose programming language used for system and application programming. |
| 2 | Difference between compiler and interpreter? | Compiler translates whole program; interpreter executes line by line. |
| 3 | What is pointer? | A variable that stores address of another variable. |
| 4 | What is dangling pointer? | A pointer that points to memory already freed or invalid. |
| 5 | malloc vs calloc? | malloc gives uninitialized memory; calloc initializes memory to zero. |
| 6 | Structure vs union? | Structure members have separate memory; union members share memory. |
| 7 | What is recursion? | A function calling itself with a base condition. |
| 8 | What is static variable? | A variable that preserves its value for whole program lifetime. |
| 9 | What is segmentation fault? | Invalid memory access error. |
| 10 | What are header files? | Files containing declarations, macros and constants. |
Coding Questions
- String reverse करें
- Prime number check करें
- Array में second largest find करें
- Pointer से swap करें
- Stack implement करें
- File में student record save/read करें
Tips
- Pointer questions में memory diagram समझाएं
- Recursion में base condition बताएं
- Clean code लिखें
- Edge cases check करें
- Warnings ignore न करें