C Questions
By
সৈকত ব্যানার্জ্জী

1. What does static variable mean?.
2. What is a pointer?
3. What are the uses of a pointer?
4. What is a structure?
5. What is a union?
6. What are the differences between structures and union?
7. What are the differences between structures and arrays?
8. In header files whether functions are declared or defined?
9. What are the differences between malloc () and calloc ()?
10. What are macros? What are its advantages and disadvantages?
11. Difference between pass by reference and pass by
12. What is static identifier?
13. Where is the auto variables stored?
14. Where does global, static, and local, register
15. Difference between arrays and linked list?
16. What are enumerations?
17. Describe about storage allocation and scope of
18. What are register variables? What are the advantages
19. What is the use of typedef?
20. Can we specify variable field width in a scanf()
21. Out of fgets() and gets() which function is safe to use and why?
22. Difference between strdup and strcpy?
23. What is recursion?
24. Differentiate between a for loop and a while loop? What are it uses?
25. What is storage class.What are the different storage classes in C?
26 What the advantages of using Unions?
27. What is the difference between Strings and Arrays?
28. What is a far pointer? where we use it?
29. What is a huge pointer?
30. What is a normalized pointer ,how do we normalize a pointer?
31. What is near pointer.
32. In C, why is the void pointer useful? When would you use it?
33. What is a NULL Pointer? Whether it is same as an uninitialized pointer
34. Are pointers integer ?
35. What does the error ‘Null Pointer Assignment’ means and what causes this error?
36. What is generic pointer in C?
37. Are the expressions arr and &arr same for an array of integers?
38. How pointer variables are initialized ?
39. What is static memory allocation ?
40. What is dynamic memory allocation?
41. What is the purpose of realloc ?
42. What is pointer to a pointer
.43. What is an array of pointers ?
44. Difference between linker and linkage ?
45. Is it possible to have negative index in an array?
46. Why is it necessary to give the size of an array in an array declaration ?
47. What modular programming ?
48. What is a function ?
49. What is an argument ?
50. What are built in functions ?
51. Difference between formal argument and actual argument ?
52. Is it possible to have more than one main() function in a C program ?
53. What is the difference between an enumeration and a set of pre-processor # defines?
54. How are Structure passing and returning implemented by the complier?
55. What is the similarity between a Structure, Union and enumeration?
56. Can a Structure contain a Pointer to itself?
57. How can we read/write Structures from/to data files?
58. Write a program which employs Recursion ?
59. Write a program which uses Command Line Arguments?
60. Difference between array and pointer ?
61. What do the ‘c’ and ‘v’ in argc and argv stand for?
62. What are C tokens ?
63. What are C identifiers?
64. Difference between syntax vs logical error?
65. What is preincrement and post increment ?
66. Write a program to interchange 2 variables without using the third one.
67. What is the maximum combined length of command line arguments including the space between adjacent arguments?
68. What are bit fields? What is the use of bit fields in a Structure declaration?
69. What is a preprocessor, What are the advantages of preprocessor ?
70. What are the facilities provided by preprocessor ?
71. What are the two forms of #include directive ?
72. How would you use the functions randomize() and random()?
73. What do the functions atoi(), itoa() and gcvt() do?
74. How would you use the functions fseek(), freed(), fwrite() and ftell()?
75. What is the difference between the functions memmove() and memcpy()?
76. What is a file ?
77. What are the types of file?
78. What is a stream ?
79. What is meant by file opening ?
81. What is a file pointer ?
82. How is fopen()used ?
83. How is a file closed ?
84. What is a random access file ?
85. What is the purpose of ftell ?
86. What is the purpose of rewind() ?
87. Difference between a array name and a pointer variable ?
88. Represent a two-dimensional array using pointer ?
89. Difference between an array of pointers and a pointer to an array ?
90. Can we use any name in place of argv and argc as command line arguments ?
91. What are the pointer declarations used in C?
92. Differentiate between a constant pointer and pointer to a constant ?
93. Is the allocated space within a function automatically deallocated when the function returns?

94. Discuss on pointer arithmetic?
95. What are the invalid pointer arithmetic ?
96. What are the advantages of using array of pointers to string instead of an array of strings?
97. Are the expressions *ptr ++ and ++ *ptr same ?
98. What would be the equivalent pointer expression foe referring the same element as a[p][q][r][s] ?
99. Are the variables argc and argv are always local to main ?
100. Can main () be called recursively?
101. Can we initialize unions?
102. What’s the difference between these two declarations?
103. Why doesn’t this code: a[i] = i++; work?
104. Why doesn’t struct x { … };x thestruct; work?
105. Why can’t we compare structures?
106. How are structure passing and returning implemented?

1. What is C language ?
2. What are the different storage classes in C ?
3. What is hashing ?
4. Can static variables be declared in a header file ?
5. Can a variable be both constant and volatile ?
6. Can include files be nested?
7. What is a null pointer ?
8. What is the output of printf(“%d”) ?
9. How to reduce a final size of executable ?
10. Can you tell me how to check whether a linked list is circular ?
11. What is the difference between strings and character arrays ?
12. Write down the equivalent pointer expression for referring the same element a[i][j][k][l] ?
13. Which bit wise operator is suitable for checking whether a particular bit is on or off ?
14. Which bit wise operator is suitable for turning off a particular bit in a number ?
15. Which bit wise operator is suitable for putting on a particular bit in a number ?
16. Does there exist any other function which can be used to convert an integer or a float to a string ?
17. Why does malloc(0) return valid memory address ? What’s the use ?
18. Difference between const char* p and char const* p
19. What is the result of using Option Explicit ?
20. What is the benefit of using an enum rather than a #define constant ?
21. What is the quickest sorting method to use ?
22. When should the volatile modifier be used ?
23. When should the register modifier be used? Does it really help ?
24. How can you determine the size of an allocated portion of memory ?
25. What is page thrashing ?
26. When does the compiler not implicitly generate the address of the first element of an array ?
27. What is the benefit of using #define to declare a constant ?
28. How can I search for data in a linked list ?
29. Why should we assign NULL to the elements (pointer) after freeing them ?
30. What is a null pointer assignment error ? What are bus errors, memory faults, and core dumps ?
31. When should a type cast be used ?
32. What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
33. How can I convert a string to a number ?
34. How can I convert a number to a string ?
35. Is it possible to execute code even after the program exits the main() function?
36. What is the stack ?
37. How do you print an address ?
38. Can a file other than a .h file be included with #include ?
39. What is Preprocessor ?
40. How can you restore a redirected standard stream ?
41. What is the purpose of realloc( ) ?
42. What is the heap ?
43. How do you use a pointer to a function ?
44. What is the purpose of main( ) function ?
45. Why n++ executes faster than n+1 ?
46. What will the preprocessor do for a program ?
47. What is the benefit of using const for declaring constants ?
48. What is the easiest sorting method to use ?
49. Is it better to use a macro or a function ?
50. What are the standard predefined macros ?
51. What is the difference between the functions memmove() and memcpy()?
52. How do you print a string on the printer?
53. Can you use the function fprintf() to display the output on the screen?
54. What is a linklist and why do we use it when we have arrays? – I feel the correct answer should be linklist is used in cases where you don’t know the memory required to store a data structure and need to allocate is dynamically on demand.
55. How do you detect a loop in linked list?
56. What is the difference between main() in C and main() in C++?
57. what will be printed out when the following code is executed:
58. main()
{
printf(“%x”,-1<<4);
}
59. what does void(*tmp)();
60. How to override a defined macro
61. Explain the difference between NULL and NUL
62. Define wild pointer
63. Where is fflush () used?
64. Explain #pragma directives
65. What does self-referential structure means?
66. What is difference between pass by value and pass by reference?

Advertisements