631 views

1 Answer

1 votes
1 votes
as -1 will be represented as 2's complement form

therefore -1 = 1111 1111 in 2's complement (assuming 8 bit representation)

hence -1<<1 will shift above binary bits left by 1

i.e -1<<1 = 1111 1110

therefore result will be "fe" in hexadecimal

or you may also get fffe for 16 bit representation or  ffff fffe for 32 bit representation but hexadecimal value of last 4 least significant bits  will always be 'e' and remaining preceding value will be 'f'

Related questions

1 votes
1 votes
0 answers
1
Ashish Roy 1 asked Mar 16, 2019
1,698 views
In the above 4 Statements which would print 123 as output ? Explain also.
0 votes
0 votes
1 answer
2
Parshu gate asked Sep 26, 2017
605 views