C Interview Questions - Part II

I had earlier given some basic questions for which every candidate must know the answer before appearing for an interview, projecting C language as one of the skills. Here we go a little wider into the language and see some more interview questions. If you want to have a look at the older post, click here.

These questions are highly probably to be asked in C based interviews. If you can explain the answers to these questions in a very elementary way rather than in a bookish way, then it will be a additional bonus for you. Prepare the answers to the questions listed below before you appear for an interview. It will be really helpful to you.

1) What is the basic difference between an array and a pointer?

2) What is the purpose of realloc();?

3) How are pointer variables initialized?

4) Write a simple program in C to print "Hello World" using pointers.

5) What is the difference between main() and void main() ?

6) What is modular programming? Why should a program be modular in first place? How to achieve modular programming in C?

7) What are the advantages of 'auto' variables?

8) Why n++ executes faster than n+1 ?

9) Write a program in C to print the address of a variable?

10) How can you make a PC to burn using a C program? (Interesting one! Try your hand)

11) What is the difference between stack and queue?

12) List some queue algorithms.

13) When would you use a pointer to a function?

14) How do you convert a string to a long integer? Where can you use this in real time?

15) What is the difference between strcpy and memcpy?

16) What is a pragma?

17) What is the difference between #include and #include “file”?

18) What is the benefit of using enum?

19) Why is a binary search faster than a linear search?

20) Write a program in C to check if a number is divisible by 7 or not in shortest lines.

Keep watching this space. In my next blog, I will come up with some real time scenario based questions that are normally asked during interviews.

No comments:

Post a Comment