In: Computer Science
Convert the following hexadecimal representations of 16-bit 2’s complement binary numbers to decimal.
a.FCAD
b.DEAD
c.1111
d.8000
e.FACE

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 hexadecimal to binary
a)
Converting FCAD to binary
F => 1111
C => 1100
A => 1010
D => 1101
So, in binary FCAD is 1111110010101101
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits. Flip all 0's to 1 and all 1's to 0.
1111110010101101 is flipped to 0000001101010010
II. Add 1 to above result
0000001101010010 + 1 = 0000001101010011
III. Now convert this result to decimal value
=> 1101010011
=> 1x2^9+1x2^8+0x2^7+1x2^6+0x2^5+1x2^4+0x2^3+0x2^2+1x2^1+1x2^0
=> 1x512+1x256+0x128+1x64+0x32+1x16+0x8+0x4+1x2+1x1
=> 512+256+0+64+0+16+0+0+2+1
=> 851
Answer: -851
b)
Converting DEAD to binary
D => 1101
E => 1110
A => 1010
D => 1101
So, in binary DEAD is 1101111010101101
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits. Flip all 0's to 1 and all 1's to 0.
1101111010101101 is flipped to 0010000101010010
II. Add 1 to above result
0010000101010010 + 1 = 0010000101010011
III. Now convert this result to decimal value
=> 10000101010011
=> 1x2^13+0x2^12+0x2^11+0x2^10+0x2^9+1x2^8+0x2^7+1x2^6+0x2^5+1x2^4+0x2^3+0x2^2+1x2^1+1x2^0
=> 1x8192+0x4096+0x2048+0x1024+0x512+1x256+0x128+1x64+0x32+1x16+0x8+0x4+1x2+1x1
=> 8192+0+0+0+0+256+0+64+0+16+0+0+2+1
=> 8531
Answer: -8531
c)
Converting 1111 to binary
1 => 0001
1 => 0001
1 => 0001
1 => 0001
So, in binary 1111 is 0001000100010001
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
=> 1000100010001
=> 1x2^12+0x2^11+0x2^10+0x2^9+1x2^8+0x2^7+0x2^6+0x2^5+1x2^4+0x2^3+0x2^2+0x2^1+1x2^0
=> 1x4096+0x2048+0x1024+0x512+1x256+0x128+0x64+0x32+1x16+0x8+0x4+0x2+1x1
=> 4096+0+0+0+256+0+0+0+16+0+0+0+1
=> 4369
Answer: 4369
d)
Converting 8000 to binary
8 => 1000
0 => 0000
0 => 0000
0 => 0000
So, in binary 8000 is 1000000000000000
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits. Flip all 0's to 1 and all 1's to 0.
1000000000000000 is flipped to 0111111111111111
II. Add 1 to above result
0111111111111111 + 1 = 1000000000000000
III. Now convert this result to decimal value
=> 1000000000000000
=> 1x2^15+0x2^14+0x2^13+0x2^12+0x2^11+0x2^10+0x2^9+0x2^8+0x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0
=> 1x32768+0x16384+0x8192+0x4096+0x2048+0x1024+0x512+0x256+0x128+0x64+0x32+0x16+0x8+0x4+0x2+0x1
=> 32768+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0
=> 32768
Answer: -32768
e)
Converting FACE to binary
F => 1111
A => 1010
C => 1100
E => 1110
So, in binary FACE is 1111101011001110
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits. Flip all 0's to 1 and all 1's to 0.
1111101011001110 is flipped to 0000010100110001
II. Add 1 to above result
0000010100110001 + 1 = 0000010100110010
III. Now convert this result to decimal value
=> 10100110010
=> 1x2^10+0x2^9+1x2^8+0x2^7+0x2^6+1x2^5+1x2^4+0x2^3+0x2^2+1x2^1+0x2^0
=> 1x1024+0x512+1x256+0x128+0x64+1x32+1x16+0x8+0x4+1x2+0x1
=> 1024+0+256+0+0+32+16+0+0+2+0
=> 1330
Answer: -1330