Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is output of the following statetment?Printf(“%x”,
-1<<4); ?

Answer Posted / arupananda

Question is -1<<4
Answer to 16bit compiler
As -1 is a negative number,so compiler first convert this number with removing negative sign to 2's complement
Here -1 is given
so compiler first removes the -ve sign and then convert to 2's complement
Binary form of 1 for 16 bit compiler is 0000 0000 0000 0001
1's complement of 1 is 1111 1111 1111 1110
2's complement of 1 is 1111 1111 1111 1111(1+1's complement)
now do the left shift operation
1111 1111 1111 1111 << 4
which results 1111 1111 1111 0000
i.e equivalent to FFF0 in hex format
So the answer is FFF0 for 16 bit compiler
And for 32 bit compiler it is FFFF FFF0 (do same operation as 16 bit compiler)

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why isnt there a numbered, multi-level break statement to break out

1045


How can you increase the size of a dynamically allocated array?

1187


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

3715


What is the -> in c?

1009


Explain what is a 'locale'?

1082


What is LINKED LIST? How can you access the last element in a linked list?

1070


What is scope rule of function in c?

1096


What is meant by inheritance?

1090


Tell us bitwise shift operators?

1091


What do mean by network ?

1162


What are c header files?

990


What is the general form of #line preprocessor?

994


When can a far pointer be used?

1021


What are logical errors and how does it differ from syntax errors?

1300


What are loops in c?

997