main()

{

printf("%x",-1<<4);

}

Answers were Sorted based on User's Feedback



main() { printf("%x",-1<<4); }..

Answer / susie

Answer :

fff0

Explanation :

-1 is internally represented as all 1's. When
left shifted four times the least significant 4 bits are
filled with 0's.The %x format specifier specifies that the
integer value be printed as a hexadecimal value.

Is This Answer Correct ?    119 Yes 22 No

main() { printf("%x",-1<<4); }..

Answer / sourab

thts ans is ture 4 16 bit compiler ,for 32 bit ans is fffffff0.

Is This Answer Correct ?    40 Yes 9 No

main() { printf("%x",-1<<4); }..

Answer / aruna

-16

Is This Answer Correct ?    4 Yes 15 No

Post New Answer

More C Code Interview Questions

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 Answers  


Is this code legal? int *ptr; ptr = (int *) 0x400;

1 Answers  


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

0 Answers  


main() { static int var = 5; printf("%d ",var--); if(var) main(); }

1 Answers  


main() { int i=5,j=6,z; printf("%d",i+++j); }

2 Answers  






struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above

2 Answers   HCL,


&#8206;#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }

2 Answers  


main() { main(); }

1 Answers  


main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

2 Answers   Wipro,


void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }

1 Answers  


What is your nationality?

1 Answers   GoDB Tech,


How do I write a program to print proper subset of given string . Eg :input: abc output:{},{a},{b},{c},{a,b},{a,c},{b,c}, {a,b,c}.I desperately need this program please mail me to saravana6m@gmail.com

11 Answers   Deshaw, Infosys,


Categories