main()

{

int x=5;

clrscr();

for(;x==0;x--) {

printf("x=%d\n”", x--);

}

}

a. 4, 3, 2, 1, 0

b. 1, 2, 3, 4, 5

c. 0, 1, 2, 3, 4

d. none of the above

Answers were Sorted based on User's Feedback



main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", ..

Answer / guest

d) prints nothing, as condition x==0 is False

Is This Answer Correct ?    11 Yes 0 No

main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", ..

Answer / ana

nothing

Is This Answer Correct ?    4 Yes 0 No

main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", ..

Answer / ranjith v

d:None of the above
Explanation:
In for loop the condition x==0,i.e;x0 is assigned to
zero.which means x value will be 0 not the 5.so it causes error.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Code Interview Questions

Link list in reverse order.

8 Answers   NetApp,


main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }

1 Answers  


what is variable length argument list?

2 Answers  


There were 10 records stored in “somefile.dat” but the following program printed 11 names. What went wrong? void main() { struct student { char name[30], rollno[6]; }stud; FILE *fp = fopen(“somefile.dat”,”r”); while(!feof(fp)) { fread(&stud, sizeof(stud), 1 , fp); puts(stud.name); } }

1 Answers  


In the following pgm add a stmt in the function fun such that the address of 'a' gets stored in 'j'. main(){ int * j; void fun(int **); fun(&j); } void fun(int **k) { int a =0; /* add a stmt here*/ }

1 Answers  






Printf can be implemented by using __________ list.

3 Answers  


how to return a multiple value from a function?

5 Answers   Wipro,


Is the following code legal? struct a { int x; struct a *b; }

2 Answers  


main( ) { void *vp; char ch = ‘g’, *cp = “goofy”; int j = 20; vp = &ch; printf(“%c”, *(char *)vp); vp = &j; printf(“%d”,*(int *)vp); vp = cp; printf(“%s”,(char *)vp + 3); }

1 Answers  


typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }

1 Answers  


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }

1 Answers  


Categories