Question
main()
{
int x=5;
clrscr();
for(;x<= 0;x--)
{
printf("x=%d ", x--);
}
}
a. 5, 3, 1
b. 5, 2, 1,
c. 5, 3, 1, -1, 3
d. –3, -1, 1, 3, 5
Question Submitted By :: Guest
I also faced this Question!!
Rank
Answer Posted By
Re: main()
{
int x=5;
clrscr();
for(;x<= 0;x--)
{
printf("x=%d ", x--);
}
}
a. 5, 3, 1
b. 5, 2, 1,
c. 5, 3, 1, -1, 3
d. –3, -1, 1, 3, 5
Answer
# 1
prints nothing, as condition in loop is false.
Guest
Other C Code Interview Questions
Question Asked @ Answers What is "far" and "near" pointers in "c"...? 3 main()
{
main();
} 1 main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%d\n", bit = (bit >> (i - (i -1))));
}
}
a. 512, 256, 128, 64, 32
b. 256, 128, 64, 32, 16
c. 128, 64, 32, 16, 8
d. 64, 32, 16, 8, 4 HCL 1 main()
{
float f=5,g=10;
enum{i=10,j=20,k=50};
printf("%d\n",++k);
printf("%f\n",f<<2);
printf("%lf\n",f%g);
printf("%lf\n",fmod(f,g));
} 1 How to swap two variables, without using third variable ? HCL 47 main()
{
char p[ ]="%d\n";
p[1] = 'c';
printf(p,65);
} 1 main()
{
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
} 1 main(){
char a[100];
a[0]='a';a[1]]='b';a[2]='c';a[4]='d';
abc(a);
}
abc(char a[]){
a++;
printf("%c",*a);
a++;
printf("%c",*a);
} 1 #include<stdio.h>
main()
{
int i=1,j=2;
switch(i)
{
case 1: printf("GOOD");
break;
case j: printf("BAD");
break;
}
} 1 main()
{
char *p="hai friends",*p1;
p1=p;
while(*p!='\0') ++*p++;
printf("%s %s",p,p1);
} 1 Is this code legal?
int *ptr;
ptr = (int *) 0x400; 1 main()
{
char a[4]="HELLO";
printf("%s",a);
} 1 Write out a function that prints out all the permutations of
a string.
For example, abc would give you abc, acb, bac, bca, cab,
cba. You can assume that all the characters will be unique. Microsoft 4 #include <stdio.h>
#define a 10
main()
{
#define a 50
printf("%d",a);
} 1 main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
} 1 program to find magic aquare using array HCL 3 what will be the position of the file marker?
a: fseek(ptr,0,SEEK_SET);
b: fseek(ptr,0,SEEK_CUR); 1 main()
{
int a=10,*j;
void *k;
j=k=&a;
j++;
k++;
printf("\n %u %u ",j,k);
} 1 void main()
{
int i=5;
printf("%d",i++ + ++i);
} 1 main()
{
unsigned int i=10;
while(i-->=0)
printf("%u ",i);
} 1 For more C Code Interview Questions Click Here