Basic C Interview Questions

These are few basic Interview questions in C .....

1)How do we check whether a linked list is circular?

2)What is the output of this program?

#include
##include
main()
{
typedef union
{
int a;
char b[10];
float c;
}
Struct;

Struct x,y = {100};
x.a = 50;
strcpy(x.b,"hello");
x.c = 21.50;

printf("Union x : %d %s %f \n",x.a,x.b,x.c );
printf("Union y : %d %s %f \n",y.a,y.b,y.c);
}

3)What is a Null object?

4)Name some pure object oriented languages.

5)What is a container class? What are the different types of container classes?

6)What will be the output of the following program:
#include
main()
{
printf("%x",-1<<4);
}

7)What are the major differences between C and C++?

8)What is an incomplete type?

9)What are printf and scanf, call by reference or call by value?

10)What is a const pointer?

11)When should a type cast be used and when should it not be used?

12)Which is the easiest sorting method?

13)Which is the quickest sorting method?

14)Which are the best sorting algorithms to sort a linked list?

15)What is a preprocessor and what will it do for a program?

16)How can a string be converted into a number?

17)How can a number be converted into a string?

18)What is a heap?

19)Why does n++ execute much faster than n+1?

20)What is modular Programming?

21)Which expression always returns true and which expression always returns false?

22)What is the difference between "malloc" and "calloc"?

23)Is C
a)A low level language
b)A middle level language
c)A high level language ?

24)Why doesn't C support function overloading?

25)What is the difference between global int & static int declaration?


Click here for the solutions

44 comments:

  1. Hello. Could you please clear the 19th Question. The question asks difference between n++ and n+1, but the solution gives the explanation for n++ and ++n .

    But i hope the question really meant d/b n++ and ++n , coz i was asked the same question in an interview, n i gave this same answer.! fingers crossed.

    Thank you again.

    ReplyDelete
    Replies
    1. +n is faster than n++ is faster than n=n+1
      Machine usually have increment x as well as add const to x

      In case of n++, you will have 2 memory access only (read n, inc n, write n )
      In case of n=n+1, you will have 3 memory access (read n, read const, add n and const, write n)

      Delete
  2. Thank you very much. Your blog is well presented and easy to navigate. But try to use blockquotes for codes to differentiate them from paragraphs.

    Content found here are quite different and educative.

    www.hunter4u.com

    ReplyDelete
  3. questios are very logical for basics
    answeers should b beside the questions

    ReplyDelete
  4. 2nd question:
    how y.b value is d?

    ReplyDelete
  5. give the answer for that questions

    ReplyDelete
  6. please give ans to the ques

    ReplyDelete
  7. C Interview Questions and Answers for campus placement preparation at gyantonic.com

    ReplyDelete
  8. amzing qestions...fully satisfied with answrs.....

    ReplyDelete
  9. plz give me answer of these questions

    ReplyDelete
  10. I enjoy this 25 questions on c interview questions, but I want some basic c interview questions along with answer like website
    programmerinterview

    ReplyDelete
  11. here i can improve my knowledge about c...this is very useful questions..thank you for the author...can u send me more questions and puzzles?

    ReplyDelete
  12. plz give me answer for those questions

    ReplyDelete
  13. BASIC C INTERVIEW QUESTIONS AND ANSWERS

    http://www.tecz.org/interview-questions/105-basic-c-interview-questines-and-answers.html

    ReplyDelete
  14. Hey, could you provide the answers to these question. Here is another site, with some interesting C interview questions along with their answers,

    http://www.codewithc.com/most-common-c-interview-questions-answers/

    ReplyDelete
  15. its simply nice

    Frequently Asked C Language Interview Questions and answers

    www.fresherventure.net/frequently-asked-c-language..

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Hi.frnds I want to learn C program easily ...please help me

    ReplyDelete
  18. Hi.frnds I want to learn C program easily ...please help me

    ReplyDelete
  19. Those interested to learn C programming or those who wanna brush up thr knowledge on C language, head to http://makethingseasy.in/pdfs1.html
    for a list of best C programming books in downloadable PDF format.
    Hope itl be helpful and useful as well..

    ReplyDelete
  20. Great work. Also check out the video on C Interview Questions. C Interview Questions - Video Guide

    ReplyDelete
  21. Thank you. If you have interest to work with Acccnture, then apply through the following link as soon as possible
    accenture jobs for freshers in bangalore

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. • best and useful sites and I like the sites

    unix training in chennai

    ReplyDelete
  24. Hey, very nice blog!!Hi there, I enjoy reading through your article post ->
    hire app developer

    ReplyDelete
  25. Wow..!! This is an adorable post as the information shared in this post is very helpful. I am thankful to get this post when i was searching Web Design And Development Company India

    ReplyDelete
  26. Hey Brother,

    I genuinely do look forward for the time where you post some new write ups. Your blog make me feel so educated! Continue soaring and writing please.

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    int A[3][2]={{1,2},
    {4,5},
    {7,8}};

    int B[3][1]=
    {{0},
    {4,},
    {7,}};

    i want to merge array A and B into a single array C ,which should appear like

    int C= 0 1 2
    4 4 5
    7 7 8

    Thanks a lot. This was a perfect step-by-step guide. Don’t think it could have been done better.

    Thanks,
    Irene Hynes

    ReplyDelete
  27. blog commenting : Thanks for sharing this information. I really Like Very Much.
    best angular js online training

    ReplyDelete
  28. wow this post is amazing .. thanks for sharing please see my post also here is my post for
    Top 10 best books to learn C Programming

    ReplyDelete
  29. Thank you for sharing such a really admire your post. Your post is great!.Agro Fertilizer Company in India

    ReplyDelete
  30. Thank you so much for sharing such a informative and useful blog post. I hope that you and your family will good. I really appreciate you instafasto

    ReplyDelete
  31. This comment has been removed by the author.

    ReplyDelete
  32. Thank You for sharing this valuable info.
    Keep sharing new Updates with us.
    Intrested guys check it out once our site also,

    ServiceNow Training

    ReplyDelete