Wednesday, August 26, 2009

Huawei C programming Interview questions

Find the Output of the following programs.
1.
void checkA()
{
int a=2;
if(a=3!=3)
printf(" 3 ");
else
printf(" 2 ");
return;
}


2.
main()
{
char P[]={"Hello World"};
printf(" %s \n",p);
main();
}


3.
#define TRUE 0
main()
{
int i=0;
while(TRUE)
{
printf(" %d \n",i);
i++;
}
printf(" %d \n",i);
}


4.
CHAR j;
for(j=0;j<2000;j++);


5.
main()
{
int a[5];
a[0]=0;
a[1]=1;
for(i=2 ; i<4>

6.
INT i,j;
i = j = 0;
i = ( i++ > ++j ) ? i++ : i--;


7.
# define D 10
# define Y D+10
# define D 30
main(int argc, char *arc[])
{
printf(" %d \n",D);
}


If this post has helped you Click on the google ads

1 comment: