C Interview Questions

 
1.
What is C language?
2.
What does static variable mean?
3.
What are the different storage classes in C ?
4.
What is hashing ?
5.
Can static variables be declared in a header file ?
6.
Can a variable be both constant and volatile ?
7.
Can include files be nested?
8.
What is a null pointer ?
9.
What is the output of printf("%d") ?
10.
What is the difference between calloc() and malloc() ?
11.
What is the difference between printf() and sprintf() ?
12.
How to reduce a final size of executable ?
13.
Can you tell me how to check whether a linked list is circular ?
14.
Advantages of a macro over a function ?
15.
What is the difference between strings and character arrays ?
16.
Write down the equivalent pointer expression for referring the same element a[i][j][k][l] ?
17.
Which bit wise operator is suitable for checking whether a particular bit is on or off ?
18.
Which bit wise operator is suitable for turning off a particular bit in a number ?
19.
Which bit wise operator is suitable for putting on a particular bit in a number ?
20.
Does there exist any other function which can be used to convert an integer or a float to a string ?
21.
Why does malloc(0) return valid memory address ? What's the use ?
22.
Difference between const char* p and char const* p
23.
What is the result of using Option Explicit ?
24.
What is the benefit of using an enum rather than a #define constant ?
25.
What is the quickest sorting method to use ?
26.
When should the volatile modifier be used ?
27.
When should the register modifier be used? Does it really help ?
28.
How can you determine the size of an allocated portion of memory ?
29.
What is page thrashing ?
30.
When does the compiler not implicitly generate the address of the first element of an array ?
31.
What is the benefit of using #define to declare a constant ?
32.
How can I search for data in a linked list ?
33.
Why should we assign NULL to the elements (pointer) after freeing them ?
34.
What is a null pointer assignment error ? What are bus errors, memory faults, and core dumps ?
35.
When should a type cast be used ?
36.
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
37.
How can I convert a string to a number ?
38.
How can I convert a number to a string ?
39.
Is it possible to execute code even after the program exits the main() function?
40.
What is the stack ?
41.
How do you print an address ?
42.
Can a file other than a .h file be included with #include ?
43.
What is Preprocessor ?
44.
How can you restore a redirected standard stream ?
45.
What is the purpose of realloc( ) ?
46.
What is the heap ?
47.
How do you use a pointer to a function ?
48.
What is the purpose of main( ) function ?
49.
Why n++ executes faster than n+1 ?
50.
What will the preprocessor do for a program ?
51.
What is the benefit of using const for declaring constants ?
52.
What is the easiest sorting method to use ?
53.
Is it better to use a macro or a function ?
54.
What are the standard predefined macros ?
55.
What is a local block?
56.
Should variables be stored in local blocks?
57.
When is a switch statement better than multiple if statements?
58.
Is a default case necessary in a switch statement?
59.
Can the last case of a switch statement skip including the break?
60.
Other than in a for statement, when is the comma operator used?
61.
How can you tell whether a loop ended prematurely?
62.
What is the difference between goto and long jmp( ) and setjmp()?
63.
What is an lvalue?
64.
Can an array be an lvalue?
65.
What is an rvalue?
66.
Is left-to-right or right-to-left order guaranteed for operator precedence?
67.
What is the difference between ++var and var++?
68.
What does the modulus operator do?
69.
Where in memory are my variables stored?
70.
Do variables need to be initialized?
71.
What is page thrashing?
72.
What is a const pointer?
73.
When should the register modifier be used? Does it really help?
74.
When should the volatile modifier be used?
75.
Can a variable be both const and volatile?
76.
When should the const modifier be used?
77.
How reliable are floating-point comparisons?
78.
How can you determine the maximum value that a numeric variable can hold?
79.
Are there any problems with performing mathematical operations on different variable types?
80.
What is operator promotion?
81.
When should a type cast be used?
82.
When should a type cast not be used?
83.
Is it acceptable to declare/define a variable in a C header?
84.
Can static variables be declared in a header file?
85.
What is the benefit of using const for declaring constants?
86.
How can I remove the trailing spaces from a string?