Saturday, August 20, 2016

What will be the output of -1<<4 in C language?
Ans: The binary equivalent of -1 in 2 Byte is 1111 1111 1111 1111.
So after 4 left shift the result will be 1111 1111 1111 0000.
Hence the output will be fff0  in Hexadecimal format.

This question is very common for the placement exams of various company.

No comments:

Post a Comment