CST8110 Intro to Computing - Assignment #1Answer Key I
Always show the steps of your calculations for all conversions!
1. A x 0 = 00 A x 1 = 0A A x 2 = 14 A x 3 = 1E
A x 4 = 28 A x 5 = 32 A x 6 = 3C A x 7 = 46
A x 8 = 50 A x 9 = 5A A x A = 64 A x B = 6E
A x C = 78 A x D = 82 A x E = 8C A x F = 96
All digits and numbers above are Base 16.
2. 32,047(10) => 7 x 8**4 rem 3375
7 x 8**0 rem 0 => 76457(8) octal
32,047(10) => 7 x 16**3 rem 3375
15 x 16**0 rem 0 => 7D2F(16) hexadecimal
32,047(10) => 7D2F(16) => 0111 1101 0010 1111(2) binary
3. Re-group the 16 binary bits by threes and by fours:
1 001 001 001 010 101(2) 1001 0010 0101 0101(2)
1 1 1 1 2 5(8) octal 9 2 5 5(16) hexadecimal
The number is negative, since the sign bit is set; but, that doesnt affect conversions between bases 2, 8, and 16 where we simply group the bits differently. Only the conversion of a signed negative bit pattern to decimal needs the signed conversion method. We can convert the negative bit pattern to a negative decimal starting with any of binary, octal, or hexadecimal; lets pick hexadecimal since its the shortest:
a) Invert the bits by subtracting 9255(16) from a 16-bit -1: (FFFF - 9255) => 6DAA(16)
b) Add 1 to complete the negation of the bit pattern: 6DAA + 1 = 6DAB(16)
c) Convert 6DAB(16) to decimal: B x 16**0 + A x 16**1 + D x 16**2 + 6 x 16**3 giving 28,075(10)
d) Changing the sign gives the correct negative decimal answer -28,075(10)