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

Find the largest number in a binary tree

7 Answers   Infosys,


Write a complete program that consists of a function that can receive two numbers from a user (M and N) as a parameter. Then print all the numbers between the two numbers including the number itself. If the value of M is smaller than N, print the numbers in ascending flow. If the value of M is bigger than N, print the numbers in descending flow. may i know how the coding look like?

2 Answers  


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,


write a program to Insert in a sorted list

4 Answers   Microsoft,


main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }

2 Answers  






#include<stdio.h> main() { const int i=4; float j; j = ++i; printf("%d %f", i,++j); }

1 Answers  


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

1 Answers  


#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d..%d",*p,*q); }

1 Answers  


How to read a directory in a C program?

4 Answers  


Print an integer using only putchar. Try doing it without using extra storage.

2 Answers  


posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come

2 Answers   GATE,


main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O

4 Answers   HCL,


Categories