main()

{

signed int bit=512, i=5;

for(;i;i--)

{

printf("%d\n", bit >> (i - (i -1)));

}

}

a. 512, 256, 0, 0, 0

b. 256, 256, 0, 0, 0

c. 512, 512, 512, 512, 512

d. 256, 256, 256, 256, 256

Answers were Sorted based on User's Feedback



main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n"..

Answer / guest

d) bit's value is not changed

Is This Answer Correct ?    27 Yes 1 No

main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n"..

Answer / shanker

Query : When bits cant be changed, then option c is also
correct?

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Code Interview Questions

#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }

1 Answers  


String copy logic in one line.

11 Answers   Microsoft, NetApp,


#define SQR(x) x * x main() { printf("%d", 225/SQR(15)); } a. 1 b. 225 c. 15 d. none of the above

3 Answers   HCL,


main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }

4 Answers   CSC,


Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,






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

2 Answers  


main() { int c=- -2; printf("c=%d",c); }

1 Answers   TCS,


struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }

1 Answers  


print numbers till we want without using loops or condition statements like specifically(for,do while, while swiches, if etc)!

11 Answers   Wipro,


main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s",names[i]); }

2 Answers  


#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }

2 Answers  


main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,


Categories