CST8110 Intro to Computing - Assignment #2Answer Key
Always show the steps of your calculations for all conversions!
1. 01111010(2) => 01 111 010 => 0111 1010(2)
7A(16) = 7 x 16**1 + A x 16**0 = 122(10)
2. -125(10) is negative, so it cant be converted directly. We must convert the positive value first, then negate the bit pattern to make it a negative bit pattern.
125(10) = 7 x 16**1 rem 13
13 x 16**0 rem 0 => 7D(16) hexadecimal
Alternately convert +125(10) to hex by observing it is 3 larger than 122(10) from question 1:
125(10) = 122(10) + 3 = 7A(16) + 3 = 7D(16)
1) Invert the bits by subtracting 7D(16) from an 8-bit -1: (FF - 7D) => 82(16)
2) Add 1 to complete the negation of the bit pattern: 82(16) + 1 = 83(16)
Octal: regoup 83(16) by three bits -> 1000 0011(2) -> 10 000 011(2) -> 203(8)
3. -32,047(10) is negative, so it cant be converted directly. We must convert the positive value first, then negate the bit pattern to make it a negative bit pattern.
32,047(10) = 7 x 16**3 rem 3375
15 x 16**0 rem 0 => 7D2F(16) hexadecimal
1) Invert the bits by subtracting 7D2F(16) from a 16-bit -1: (FFFF - 7D2F) => 82D0(16)
2) Add 1 to complete the negation of the bit pattern: 82D0(16) + 1 = 82D1(16)
Octal: regoup 82D1(16) by three bits -> 1 000 001 011 010 001(2) -> 101321(8)
5. From -2**22 to +2**22-1, i.e. from -4,194,304 to + 4,194,303
6,7,8. See text and class notes.
9. a) float; needs decimal b) integer; small integral count c) float; large numberd) integer; small integral count e) float; needs decimal f) float; needs decimal.
10. The repeating binary fraction is either truncated after a certain number of bits, resulting in a stored value slightly smaller than the exact value, or it is rounded up, resulting in a stored value slightly larger than the exact value. In either case, the value stored is not the exact value.