C programming Questions

Last Updated on Tuesday, 3 May 2011 05:35 Written by EditorFriday, 7 September 2007 02:49

C programming For Recent college graduates and professionals for job interview.:
————-
some small C programs are given asked to tell the function/errors etc.
one of the question(last in the paper) is an invalid statement. finish of all these very fast and think about those others. they are simple only.

1.

int a=2,b=3,c=4;
printf("a=%d,b=%d\n",a,b,c);

ANS:2,3

2.for(i=1;i<10;++i,printf("%d",i));+-
ANS:compiling error.

3.whole logic is given in func s but they are working properly. the main logic is :

char *string;

string=malloc(5*sizeof(char));
strcpy(string,"hello");
printf("%s",string); /* func to print */

ANS: hello and some extra characters until uccerence of .

4. in a system integer takes 3bytes and char takes 1byte …….
struct smthing{

int a;
char b[4];
};

ANS : sizeof struct smithing is 7 bytes.

Post to Twitter


Submit Interview Questions at intr[at]freshershome.com




9 Comments
  1. l need topicwise interview questions of c for freshers

  2. for easy storage and retrieval of data wat method is used in data structure and and write a program regarding that?
    if any one know the ans plz reply

  3. Thanks….

    I need some more questions…

    It will be more helpful if u post topic wise question & answers…

  4. i needsmall question & answers

  5. i need topic wise question&answers

  6. hai,
    gud questions.it will b helpfull to me.

    Thank u.

  7. Left some comment in this link.

  8. nice,more usefull that candidates like me thank u

  9. it will be helpful to me

Leave a Reply