Thursday, July 16, 2015

C LANGUAGE INTERVIEW QUESTIONS

C LANGUAGE INTERVIEW QUESTIONS
1.What does static variable means?

2.What is a Pointer?
3.What is a Structure?
4.What are the differences between Structures and Arrays?
5.In header files whether functions are declared or defined?
6.What are the differences between malloc() and calloc()?
7.What are Macros? What are its advantages and disadvantages?
8.Difference between Pass by Value and Pass by reference?
9.What is static identifier?
10.Where is the auto variables stored?
11.Where does global, static, local, register variables, free memory and C program instructions get stored?
12.Difference between arrays and linked list?
13.What are enumerations?
14.Describe about storage allocation and scope of global, extern, static, local and register variables?
15.What are register variables? What are the advantages of using it?
16.What is the use of typedef?
17.Can we specify variable field width in a scanf()format string? If possible, how?
18.Out of fgets() and gets(), which function is safe to use and Why?
19.Difference between strdup and strcpy?
20.What is recursion?
21.Differentiate between a FOR loop and a WHILE loop? What are its uses?
22.What are the different storage classes in C?
23.Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
24.What is the difference between Structure and Unions?
25.What are the advantages of using Unions?
26.What are the advantages of using pointers in a program?
27.What is the difference between Strings and Arrays?
28.What is a far pointer? Where we use it?
29.How will you declare an array of three function pointers where each function receives two int and returns a float?
30.What is NULL pointer? Whether it is same as an un-initialized pointer?
31.What is a NULL macro? What is the difference between a NULL pointer and a NULL macro?
32.What does the error ‘Null Pointer Assignment’ means and what causes this error?
33.What is near, far and huge pointers? How many bytes are occupied by them?
34.How would you obtain segment and offset addresses from a far address of a memory location?
35.Are the expressions arr and &arr same for an array of integers?
36.Does mentioning the array name gives the base address in all the contexts?
37.Explain one method to process an entire string as one unit?
38.What is the similarity between a Structure, Union and Enumeration?
39.Can a Structure contain a Pointer to itself?
40.How can we check whether the contents of two structure variables are same or not?
41.How are Structure passing and returning implemented by the compiler?
42.How can we read/write Structures from/to data files?
43.What is the difference between an enumeration and a set of pre-processor # defines?
44.What do the ‘c’ and ‘v’ in argc and argv stand for?
45.What is the maximum combined length of command line arguments including the space between adjacent arguments?
46.If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
47.Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?
48.What are bit fields?
49.What is the use of bit fields in a Structure declaration?
50.To which numbering system can the binary number 1101100100111100 be easily converted to?
51.Which bit wise operator is suitable for checking whether a particular bit is on or off?
52.Which bit wise operator is suitable for turning off a particular bit in a number?
53.Which bit wise operator is suitable for putting on a particular bit in a number?
54.Which one is equivalent to multiplying by 2: Left shifting a number by 1 or Left shifting an unsigned int or char by 1?
55.Write a program to compare two strings without using the strcmp() function?
56.Write a program to concatenate two strings?
57.Write a program to interchange 2 variables without using the third one?
58.Write a program for String Reversal?
59.Write a program for Palindrome check?
60.Write a program to find the Factorial of a number?
61.Write a program to generate Fibonacci series?
62.Write a program which employs Recursion?
63.Write a program which uses Command Line Arguments?
64.Write a program which uses functions like strcmp(), strcpy(), etc.?
65.What are the advantages of using typedef in a program?
66.How would you dynamically allocate a one-dimensional and two-dimensional array of integers?
67.When reallocating memory if nay other pointers point the same piece of memory, do you have to readjust these other pointers or do they get readjusted automatically?
68.Which function should be used to free the memory allocated by calloc()?
69.How much maximum can you allocate in a single call to malloc()?
70.Can you dynamically allocate arrays in expanded memory?
71.What is object file? How can you access object file?
72.Which header file should include if you are to develop a function which can accept variable number of arguments?
73.Can you write a function similar to printf()?
74.How can a called function determine the number of arguments that have been passed to it?
75.Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
76.How do you declare, An array of three pointers to chars?
77.How do you declare, An array of three char pointers?
78.How do you declare, A pointer to array of three chars?
79.How do you declare, A pointer to function which receives an int pointer and returns a float pointer?
80.How do you declare, A pointer to a function which receives nothing and returns nothing?
81.What do the functions atoi(), itoa() and gcvt() do?
82.Does there exist any other function which can be used to convert an integer or a float to a string?
83.How would you use qsort() function to sort an array of structures?
84.How would you use qsort() function to sort the name stored in an array of pointers to string?
85.How would you use bsearch() function to search a name stored in array of pointers to string?
86.How would you use the functions sin(), pow(), sqrt()?
87.How would you use the functions memcpy(), memset(), memmove()?
88.How would you use the functions fseek(), fread(),fwrite() and ftell()?
89.How would you use the functions randomize() and random()?
90.How would you obtain current time and difference between two times?
91.How would you implement a substr() function that extracts a sub string from a given string?
92.What is the difference between the functions rand(), random(), srand() and randomize()?
93.What is the difference between the functions memmove() and memcpy()?
94.How do you print a string on the printer?
95.Can you use the function fprintf() to display the output on the screen?

1 comment: