25-05-2012, 11:09 AM
C Interview Questions
C_INTERVIEW_QUESTIONS from VNR VJIET.doc (Size: 48.5 KB / Downloads: 37)
C Basics
1. What is the difference between C and ANSI C?
2. Is C high level or middle level or low level language?
3. Is C structural or procedural language?
4. Can we write a program without main()?
5. How many ways constant variables can be declared?
6. What is constant variable?
7. What is volatile variable?
8. Can a variable be const and volatile?
9. Can we specify variable field width in a scanf()?
10. What do the ‘c’ and ‘v’ in argc and argv stand for?
11. What are C tokens ?
12. What are C identifiers?
13. Difference between syntax vs logical error?
14. What is preincrement and post increment ?
15. Write a program to interchange 2 variables without using the third one.
16. What is the maximum combined length of command line arguments including the space between adjacent arguments?
17. Which expression always returns true and which expression always returns false?
18. printf("%c","abcdef",4[]); What is the output of above program?
19.
Control Statements and Loops
1. Differentiate between a for loop and a while loop? What are it uses?
Arrays, Structures and Unions
1. Is it possible to have negative index in an array?
2. Why is it necessary to give the size of an array in an array declaration ?
3. Difference between arrays and linked list?
4. What are the differences between structures and arrays?
5. What is a structure?
6. How are Structure passing and returning implemented by the complier?
7. Can a Structure contain a Pointer to itself?
8. Why can’t we compare structures?
9. How are structure passing and returning implemented?
10. What is a union?
11. What are the differences between structures and union?
12. What the advantages of using Unions?
13. Can we initialize unions?
Functions and Pointers
1. What modular programming?
2. What is a function ?
3. What is an argument ?
4. What are built in functions ?
5. What is function prototype?
6. How many arguments a function can have in maximum?
7. Difference between formal argument and actual argument ?
8. Difference between local and global variable
9. Is it possible to have more than one main() function in a C program ?
10. In header files whether functions are declared or defined?
11. Difference between pass by reference and pass by value.
12. Is the allocated space within a function automatically deallocated when the function returns?
13. What is static function?
14. Should a function contain a return statement if it does not return a value?
15. How can you pass an array to a function by value?
16. Is it possible to execute code even after the program exits the main() function?
17. Is using exit() the same as using return?
18. Write a program which uses Command Line Arguments?
19. Can we use any name in place of argv and argc as command line arguments?
20. Are the variables argc and argv are always local to main ?
21. What is recursion?
22. Can main () be called recursively?
23. What are printf and scanf, call by reference or call by value?
24. What is a pointer?
25. What are the uses of a pointer?
26. What are the differences between malloc () and calloc ()?
27. What is a far pointer? Where we use it?
28. What is near pointer?
29. What is a huge pointer?
30. What is a normalized pointeer? How do we normalize a pointer?
31. In C, why is the void pointer useful? When would you use it?
32. What is a NULL Pointer? Whether it is same as an uninitialized pointer?
33. What does the error ‘Null Pointer Assignment’ means and what causes this error?
34. What is generic pointer in C?
35. Are the expressions arr and &arr same for an array of integers?
36. How pointer variables are initialized?
37. What is dynamic memory allocation?
38. What is the purpose of realloc ?
39. What is pointer to a pointer?
40. What is an array of pointers?
41. Difference between array and pointer?
42. Difference between linker and linkage?
43. Represent a two-dimensional array using pointer ?
44. Difference between an array of pointers and a pointer to an array?
45. Differentiate between a constant pointer and pointer to a constant ?
46. Are the expressions *ptr ++ and ++ *ptr same ?
47. What happens when an array pointed out by temp is freed using free()?
Storage Classes
1. What is storage class? What are the different storage classes in C?
2. What is scope of a variable?
3. What does static variable mean?
4. What is static identifier?
5. What are register variables? What are its advantages?
6. Are both extern and global variables same?
7. Where does global, static, and local, register variables stored?
8. What is a heap?
Strings
1. Differentiate strdup() and strcpy() .
2. What is the difference between Strings and Arrays?
3. How can a string be converted into a number?
4. How can a number be converted into a string?
5. What is the difference between a string copy (strcpy) and a memory copy (memcpy)?
6. How can I remove the trailing spaces from a string?
7. How can you compare two strings?
8.
Files
1. Out of fgets() and gets() which function is safe to use and why?
2. How can we read/write Structures from/to data files?
3. How would you use the functions fseek(), freed(), fwrite() and ftell()?
4. What is the difference between the functions memmove() and memcpy()?
5. What is a file?
6. What are the types of file?
7. What is a stream?
8. What is meant by file opening?
9. What is a file pointer?
10. How is fopen()used?
11. How is a file closed ?
12. What is a random access file?
13. What is the purpose of ftell?
14. What is the purpose of rewind() ?
Miscellaneous
1. What are macros? What are its advantages and disadvantages?
2. What are enumerations?
3. What is the use of typedef?
4. What is the difference between an enumeration and a set of pre-processor # defines?
5. What is the similarity between a Structure, Union and enumeration?
6. What are bit fields? What is the use of bit fields in a Structure declaration?
7. What is a preprocessor, What are the advantages of preprocessor?
8. What are the facilities provided by preprocessor?
9. What are the two forms of #include directive?
10. How would you use the functions randomize() and random()?
11. What do the functions atoi(), itoa() and gcvt() do?
Data Structures
1. How do we check whether a linked list is circular?
2. Which is the easiest sorting method?
3. Which is the quickest sorting method?
4. Which are the best sorting algorithms to sort a linked list?
5. Evaluate the following prefix expression " ++ 26 + - 1324" (Similar types can be asked)
6. Convert the following infix expression to post fix notation ((a+2)*(b+4)) -1 (Similar types can be asked)
7. How is it possible to insert different type of elements in stack?
8. Stack can be described as a pointer. Explain.
9. Write a Binary Search program
10.