C Interview Questions


Questions by Rejinpaul.com


1. void main()
{
int const * p=5;
printf("%d",++(*p));
}
a)Compiler error
b)error
c)5
d)it will compile but not run


◊ View answer     ◊ Share This In FB _____________________________________________________________________________________________________________________


2. main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[
i ],*(s+i),*(i+s),i[s]);
}
a)mmmm aaaa nnnn
b)error
c)nnna aaan mmmm
d)runtime error


◊ View answer     ◊ Share This In FB _____________________________________________________________________________________________________________________


3. main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}
a)I love u
b)I hate u
c)error
d)a and b


◊ View answer     ◊ Share This In FB _____________________________________________________________________________________________________________________


4. main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
a)Compiled error
b)1 2 3 5 4
c)1 2 3 4 5
d)5 4 3 2 1


◊ View answer     ◊ Share This In FB _____________________________________________________________________________________________________________________


5. main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5 data-blogger-escaped-br="" data-blogger-escaped-j=""> printf(" %d ",*c);
++q; }
for(j=0;j<5 data-blogger-escaped-br="" data-blogger-escaped-j=""> printf(" %d ",*p);
++p;
}
}
a)Compiled error
b)2 2 2 2 2 2 3 4 6 5
c)2 2 2 2 2 2 2 4 6 5
d)2 2 2 2 2 2 3 3 6 5


◊ View answer     ◊ Share This In FB _____________________________________________________________________________________________________________________

Pages:
1 2 3 4

Ad Inside Post

Comments system

Disqus Shortname