In: Computer Science
7.What is the hexadecimal equivalent of the 16-bit signed
integer -32,760 ? *Note: answer in two's complement*
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 32760 successively by 2 until the quotient is 0
32760/2 = 16380, remainder is 0
16380/2 = 8190, remainder is 0
8190/2 = 4095, remainder is 0
4095/2 = 2047, remainder is 1
2047/2 = 1023, remainder is 1
1023/2 = 511, remainder is 1
511/2 = 255, remainder is 1
255/2 = 127, remainder is 1
127/2 = 63, remainder is 1
63/2 = 31, remainder is 1
31/2 = 15, remainder is 1
15/2 = 7, remainder is 1
7/2 = 3, remainder is 1
3/2 = 1, remainder is 1
1/2 = 0, remainder is 1
Read remainders from the bottom to top as 111111111111000
So, 32760 in normal binary is 0111111111111000
Step 2: flip all the bits
0111111111111000 is flipped to 1000000000000111
Step 3:. Add 1 to above result
1000000000000111 + 1 = 1000000000001000
so, -32760 in 2's complement binary is 1000000000001000
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Use this table to convert from binary to hexadecimal
1000 => 8
0000 => 0
0000 => 0
1000 => 8
So, in hexadecimal 1000000000001000 is 0x8008