51. What is a storage class in C?
Storage classes define the scope (visibility), lifetime, and memory location of variables. There are four main storage classes in C: auto, register, static, and extern. They control how variables behave in a program.
52. Explain auto storage class.
The auto keyword is the default storage class for local variables. It stores variables in stack memory. The scope is limited to the block in which it is declared.
53. What is register storage class?
The register keyword requests the compiler to store a variable in CPU register instead of RAM for faster access. It is generally used for frequently accessed variables like loop counters.
54. What is scope of a variable?
Scope defines the region of the program where a variable is accessible. It can be local (inside function/block) or global (entire program).
55. What is lifetime of a variable?
Lifetime refers to the duration for which a variable exists in memory. For example, local variables exist during function execution, while static variables exist throughout program execution.
56. What is function prototype?
A function prototype declares a function before its definition. It tells the compiler about function name, return type, and parameters.
57. What is call stack?
The call stack is a memory structure that stores information about active function calls. Each function call creates a stack frame.
58. What is stack overflow?
Stack overflow occurs when too many function calls are made (for example, infinite recursion), exceeding stack memory limit.
59. What is buffer overflow?
Buffer overflow occurs when more data is written into a buffer than it can hold, which can cause crashes or security vulnerabilities.
60. What is const keyword?
The const keyword makes a variable read-only. Once assigned, its value cannot be modified.
61. Difference between const and #define?
#define is a preprocessor directive and replaces text before compilation. const creates a typed constant variable managed by compiler.
62. What is inline function?
An inline function is expanded in place during compilation to reduce function call overhead.
63. What is infinite recursion?
Infinite recursion happens when recursive function has no proper base condition, leading to stack overflow.
64. What is function overloading in C?
C does not support function overloading directly (same function name with different parameters). It is supported in C++.
65. What is bit field in C?
Bit fields allow storing data in specific number of bits inside a structure. It helps optimize memory usage.
66. What is volatile pointer?
A volatile pointer points to a variable whose value may change unexpectedly (e.g., hardware registers).
67. What is self-referential structure?
A structure that contains a pointer to itself. It is commonly used in linked list implementation.
68. What is nested structure?
A structure inside another structure is called nested structure.
69. What is function pointer?
A function pointer stores the address of a function and allows calling the function dynamically.
70. What is difference between array and pointer?
Array is a collection of elements. Pointer is a variable storing memory address. Array name acts as constant pointer.
71. What is multi-dimensional array?
An array with more than one dimension, such as 2D or 3D array. Example: int arr[3][3];
72. What is pass by pointer?
Passing address of variable to function using pointers to allow modification of original variable.
73. What is feof() function?
feof() checks whether end-of-file has been reached during file reading.
74. What is fseek()?
fseek() moves file pointer to specified location in file.
75. What is ftell()?
ftell() returns current position of file pointer.
76. What is rewind()?
rewind() moves file pointer to beginning of file.
77. What is command line input?
Input passed through command line using argc and argv parameters in main().
78. What is getenv()?
getenv() retrieves value of environment variable.
79. What is exit status?
Exit status indicates program termination status. 0 means successful execution.
80. What is difference between getch() and getchar()?
getchar() reads character from standard input and requires Enter key. getch() reads character without waiting for Enter (non-standard).
81. What is error handling in C?
Error handling is done using return values, perror(), and errno variable.
82. What is assert()?
assert() is used for debugging. It checks condition and terminates program if condition is false.
83. What is setjmp() and longjmp()?
Used for non-local jumps in error handling.
84. What is memory alignment?
Memory alignment arranges data in memory based on data type size for faster access.
85. What is padding in structure?
Padding is extra unused memory added between structure members to maintain alignment.
86. What is difference between shallow copy and deep copy?
Shallow copy copies references. Deep copy copies actual data.
87. What is recursion stack?
Memory used during recursive function calls stored in stack frames.
88. What is implicit type conversion?
Automatic conversion of data type by compiler.
89. What is explicit type conversion?
Manual conversion using type casting.
90. What is modular programming?
Dividing program into small manageable functions or modules.
91. What is header guard?
Prevents multiple inclusion of header files using #ifndef, #define, #endif.
92. What is static function?
A static function is visible only within the file it is declared.
93. What is difference between compilation and linking?
Compilation converts source code to object code. Linking combines object files into executable.
94. What is object file?
Intermediate file generated after compilation before linking.
95. What is executable file?
Final output file that can be run by operating system.
96. What is makefile?
Makefile automates compilation process for large projects.
97. What is segmentation violation?
Another term for segmentation fault caused by illegal memory access.
98. What is portability?
Ability of program to run on different platforms without modification.
99. What is embedded C?
Embedded C is used for programming microcontrollers and embedded systems.
100. Why are pointers important in C?
Pointers provide dynamic memory allocation, efficient array handling, function arguments modification, and are essential for data structures like linked lists, trees, and graphs.
📢 Join Our WhatsApp Channel
💼 Get Daily IT Job Updates, Interview Preparation Tips & Instant Alerts directly on WhatsApp.
👉 Join WhatsApp Now📢 Join Our Telegram Channel
💼 Get Daily IT Job Updates, Interview Tips & Exclusive Alerts directly on Telegram!
👉 Join Telegram