CHAPTER 20 BINARY, OCTAL AND HEXADECIMAL

CHAPTER 20 BINARY, OCTAL AND HEXADECIMAL
EXERCISE 84 Page 177
1. Convert the following binary numbers to decimal numbers:
(a) 110 (b) 1011 (c) 1110 (d) 1001
(a) 1102 = 1× 22 + 1× 21 + 0 × 20
= 4 + 2 + 0 = 610
(b) 10112 = 1× 23 + 0 × 22 + 1× 21 + 1× 20
= 8 + 0 + 2 + 1 = 1110
(c) 11102 = 1× 23 + 1× 22 + 1× 21 + 0 × 20
= 8 + 4 + 2 + 0 = 1410
(d) 10012 =1× 23 + 0 × 22 + 0 × 21 + 1× 20
= 8 + 0 + 0 + 1 = 910
2. Convert the following binary numbers to decimal numbers:
(a) 10101 (b) 11001 (c) 101101 (d) 110011
(a) 101012 = 1× 24 + 0 × 23 + 1× 22 + 0 × 21 + 1× 20
= 16 + 0 + 4 + 0 + 1 = 2110
(b) 110012 = 1× 24 + 1× 23 + 0 × 22 + 0 × 21 + 1× 20
= 16 + 8 + 0 + 0 + 1 = 2510
(c) 1011012 = 1× 25 + 0 × 24 + 1× 23 + 1× 22 + 0 × 21 + 1× 20
= 32 + 0 + 8 + 4 + 0 + 1 = 4510
(d) 1100112 = 1× 25 + 1× 24 + 0 × 23 + 0 × 22 + 1× 21 + 1× 20
= 32 + 16 + 0 + 0 + 2 + 1 = 5110
311
© 2014, John Bird
3. Convert the following binary numbers to decimal numbers:
(a) 101010
(b) 111000 (c) 1000001 (d) 10111000
(a) 1010102 =1× 25 + 0 × 24 + 1× 23 + 0 × 22 + 1× 21 + 0 × 20
= 32 + 0 + 8 + 0 + 2 + 0 = 4210
(b) 1110002 =1× 25 + 1× 24 + 1× 23 + 0 × 22 + 0 × 21 + 0 × 20
= 32 + 16 + 8 + 0 + 0 + 0 = 5610
(c) 10000012 =1× 26 + 0 × 25 + 0 × 24 + 0 × 23 + 0 × 22 + 0 × 21 + 1× 20
= 64 + 0 + 0 + 0 + 0 + + 0 + 1 = 6510
(d) 101110002 =1× 27 + 0 × 26 + 1× 25 + 1× 24 + 1× 23 + 0 × 22 + 0 × 21 + 0 × 20
= 128 + 0 + 32 + 16 + 8 + 0 + 0 + 0 = 18410
4. Convert the following binary numbers to decimal numbers:
(a) 0.1101 (b) 0.11001 (c) 0.00111 (d) 0.01011
(a)
0.1101 2 = 1 × 2–1 + 1 × 2–2 + 0 × 2–3 + 1 × 2–4
=1×
=
1
1
1
1
+1×
+0×
+1×
22
24
23
2
1
1
1
+ +
2
4 16
= 0.5 + 0.25 + 0.0625
= 0.8125 10
(b)
0.11001 2 = 1 × 2–1 + 1 × 2–2 + 0 × 2–3 + 0 × 2–4 + 1 × 2–5
=1×
=
1
1
1
1
1
+1×
+0×
+0×
+1×
23
22
2
24
25
1
1
1
+ +
2
4
32
= 0.5 + 0.25 + 0.03125
= 0.7812510
(c)
0.00111 2 = 0 × 2–1 + 0 × 2–2 + 1 × 2–3 + 1 × 2–4 + 1 × 2–5
312
© 2014, John Bird
=0×
=
1
1
1
1
1
+0×
+1×
+1×
+1×
3
2
4
2
2
2
2
25
1
1
1
+
+
8 16 32
= 0.125 + 0.0625 + 0.03125
= 0.2187510
(d)
0.01011 2 = 0 × 2–1 + 1 × 2–2 + 0 × 2–3 + 1 × 2–4 + 1 × 2–5
=0×
=
1
1
1
1
1
+1×
+0×
+1×
+1×
23
2
22
24
25
1
1
1
+
+
4 16 32
= 0.25 + 0.0625 + 0.03125
= 0.3437510
5. Convert the following binary numbers to decimal numbers:
(a) 11010.11 (b) 10111.011 (c) 110101.0111 (d) 11010101.10111
(a) 11010.112 = 1× 24 + 1× 23 + 0 × 22 + 1× 21 + 0 × 20 + 1× 2−1 + 1× 2−2
= 16 + 8 + 0 + 2 + 0 +
1 1
+ = 26.7510
2 4
(b) 10111.0112 = 1× 24 + 0 × 23 + 1× 22 + 1× 21 + 1× 20 + 0 × 2−1 + 1× 2−2 + 1× 2−3
= 16 + 0 + 4 + 2 + 1 +
1 1
+ = 23.37510
4 8
(c) 110101.01112 = 1× 25 + 1× 24 + 0 × 23 + 1× 22 + 0 × 21 + 1× 20 + 0 × 2−1 + 1× 2−2 + 1× 2−3 + 1× 2−4
= 32 + 16 + 0 + 4 + 0 + 1 +
1 1 1
= 53.437510
+ +
4 8 16
(d) 11010101.101112 = 1× 27 + 1× 26 + 0 × 25 + 1× 24 + 0 × 23 + 1× 22 + 0 × 21 + 1× 20 + 1× 2−1 + 0 × 2−2
+ 1× 2−3 + 1× 2−4 + 1× 2−5
= 128 + 64 + 16 + 4 + 1 +
1 1 1 1
= 213.7187510
+ + +
2 8 16 32
313
© 2014, John Bird
EXERCISE 85 Page 179
1. Convert the following decimal numbers to binary numbers:
(a) 5
(a)
(b) 15
(c) 19
(d) 29
2
5
Remainder
2
2
1
2
1
0
2
0
1
(most significant bit) → 1 0 1 ← (least significant bit)
Thus,
(b)
5 10 = 101 2
2 15
Remainder
2
7
1
2
3
1
2
1
1
2
0
1
1 1 1 1
Thus,
(c)
1510 = 1111 2
2
19
Remainder
2
9
1
2
4
1
2
2
0
2
1
0
2
0
1
1 0 0 1
1
314
© 2014, John Bird
Thus,
(d)
19 10 = 100112
2 29
Remainder
2
14
1
2
7
0
2
3
1
2
1
1
2
0
1
1 1 1 0
Thus,
1
29 10 = 111012
2. Convert the following decimal numbers to binary numbers:
(a) 31 (b) 42
(a)
(c) 57
2
31
Remainder
2
15
1
2
7
1
2
3
1
2
1
1
0
1
(most significant bit) →
Thus,
(d) 63
1 1 1 1 1 ← (least significant bit)
3110 = 111112
315
© 2014, John Bird
(b)
2
42
Remainder
2
21
0
2
10
1
2
5
0
2
2
1
2
1
0
0
1
1 0 1 0 1 0
Thus,
4210 = 101010 2
(c)
2 57
Remainder
2
28
1
2
14
0
2
7
0
2
3
1
2
1
1
0
1
1 1 1 0 0 1
Thus,
(d)
57 10 = 111001 2
2
63
Remainder
2
31
1
2
15
1
2
7
1
2
3
1
2
1
1
0
1
1 1 1 1 1 1
316
© 2014, John Bird
Thus,
63 10 = 1111112
3. Convert the following decimal numbers to binary numbers:
(a) 47 (b) 60
(a)
(c) 73
(d) 84
2
47
Remainder
2
23
1
2
11
1
2
5
1
2
2
1
2
1
0
0
1
1 0 1 1 1 1
Thus,
(b)
4710 = 101111 2
2
60
Remainder
2
30
0
2
15
0
2
7
1
2
3
1
2
1
1
0
1
1 1 1 1 0 0
Thus,
6010 = 111100 2
317
© 2014, John Bird
(c)
2
73
Remainder
2
36
1
2
18
0
2
9
0
2
4
1
2
2
0
2
1
0
0
1
1 0 0 1 0 0 1
Thus,
(d)
7310 = 1001001 2
2
84
Remainder
2
42
0
2
21
0
2
10
1
2
5
0
2
2
1
2
1
0
0
1
1 0 1 0 1 0 0
Thus,
8410 = 1010100 2
4. Convert the following decimal numbers to binary numbers:
(a) 0.25 (b) 0.21875 (c) 0.28125 (d) 0.59375
318
© 2014, John Bird
(a)
0.25 × 2 =
0. 50
0.50 × 2 =
1. 00
(most significant bit) . 0
Hence,
(b)
1 (least significant bit)
0.2510 = 0.01 2
0.21875 × 2 =
0. 4375
0.4375 × 2 =
0. 875
0.875
×2=
1. 75
0.75
× 2=
1. 50
0.50
× 2=
1.00
. 0 0
0.21875 10 = 0.00111 2
i.e.
(c)
0.28125 × 2 =
0. 5625
0.5625 × 2 =
1. 125
0.125
×2=
0. 25
0.25
× 2=
0. 50
0.50
× 2=
1.00
. 0 1
0.59375 × 2 =
1. 1875
0.1875 × 2 =
0. 375
0.375
×2=
0. 75
0.75
× 2=
1. 50
0.50
× 2=
1.00
. 1 0
i.e.
0 0 1
0.28125 10 = 0.01001 2
i.e.
(d)
1 1 1
0 1 1
0.59375 10 = 0.10011 2
319
© 2014, John Bird
5. Convert the following decimal numbers to binary numbers:
(a) 47.40625 (b) 30.8125 (c) 53.90625 (d) 61.65625
(a)
2
47
Remainder
2
23
1
2
11
1
2
5
1
2
2
1
2
1
0
0
1
1 0 1 1 1 1
0.40625 × 2 =
0. 8175
0.8175 × 2 =
1. 625
0.625
×2=
1. 25
0.25
× 2=
0. 50
0.50
× 2=
1.00
. 0 1
1 0 1
Thus, 47.4062510 = 101111.011012
(a)
2 30
Remainder
2
15
0
2
7
1
2
3
1
2
1
1
2
0
1
1 1 1 1 0
320
© 2014, John Bird
0.8125 × 2 =
1. 625
0.625 × 2 =
1. 25
×2=
0. 50
0.50 × 2 =
1. 00
0.25
. 1 1
0 1
Thus, 30.812510 = 11110.11012
(c)
2
53
Remainder
2
26
1
2
13
0
2
6
1
2
3
0
2
1
1
0
1
1 1 0 1 0 1
0.90625 × 2 =
1. 8125
0.8125 × 2 =
1. 625
0.625
×2=
1. 25
0.25
× 2=
0. 50
0.50
× 2=
1.00
. 1 1
1 0 1
Thus, 53.9062510 = 110101.111012
321
© 2014, John Bird
(d)
2
61
Remainder
2
30
1
2
15
0
2
7
1
2
3
1
2
1
1
0
1
1 1 1 1 0 1
0.65625 × 2 =
1. 3125
0.3125 × 2 =
0. 625
0.625
×2=
1. 25
0.25
× 2=
0. 50
0.50
× 2=
1.00
. 1 0
1 0 1
Thus, 61.6562510 = 111101.101012
322
© 2014, John Bird
EXERCISE 86 Page 180
1. Determine in binary form: 10 + 11
10
+ 11
sum
101
carry
1
2. Determine in binary form: 101 + 110
+
sum
carry
101
110
1011
1
3. Determine in binary form: 1101 + 111
+
sum
carry
1101
111
10100
1111
4. Determine in binary form: 1111 + 11101
1111
+ 11101
sum 101100
carry 1 1 1 1 1
5. Determine in binary form: 110111 + 10001
110111
+ 10001
sum 1001000
carry 1 1 1 1 1
6. Determine in binary form: 10000101 + 10000101
323
© 2014, John Bird
10000101
+ 10000101
sum 100001010
carry 1
1 1
7. Determine in binary form: 11101100 + 111001011
11101100
+ 111001011
sum 1010110111
carry 1 1 1
1
8. Determine in binary form: 110011010 + 11100011
110011010
+ 11100011
sum 1001111101
carry 11
1
9. Determine in binary form: 10110 + 1011 + 11011
+
sum
carry
10110
1011
11011
111100
111 1
10. Determine in binary form: 111 + 10101 + 11011
+
sum
carry
111
10101
11011
110111
11111
11. Determine in binary form: 1101 + 1001 + 11101
+
sum
carry
1101
1001
11101
110011
1 111
324
© 2014, John Bird
12. Determine in binary form: 100011 + 11101 + 101110
100011
11101
+ 101110
sum 1101110
carry
111111
325
© 2014, John Bird
EXERCISE 87 Page 182
1. Convert the following decimal numbers to binary numbers, via octal:
(a) 343
(a)
(b) 572
8
343
8
42
7
8
5
2
8
0
5
(c) 1265
Remainder
5
From Table 20.1,
7
4
6
326
1
34310 = 101010111 2
8
572
Remainder
8
71
4
8
8
7
8
1
0
0
1
1
From Table 20.1,
0
10748 = 001 000 111 100 2
i.e.
(c)
7
5278 = 101 010 111 2
i.e.
(b)
2
572 10 = 1000111100 2
8
1265
Remainder
8
158
1
8
19
6
8
2
3
0
2
2
3
© 2014, John Bird
From Table 20.1,
12658 = 010 011 110 001 2
i.e.
572 10 = 10011110001 2
2. Convert the following decimal numbers to binary numbers, via octal:
(a) 0.46875
(b) 0.6875
(c) 0.71875
(a) Multiplying repeatedly by 8, and noting the integer values, gives:
0.46875 × 8 =
3.75
×8=
6.00
0.75
. 3 6
Thus,
0.46875 10 = 0.36 8
From Table 20.1,
0.36 8 = 0.011 1102
0.46875 10 = 0.01111 2
i.e.
(b) Multiplying repeatedly by 8, and noting the integer values, gives:
0.6875 × 8 =
5.50
×8=
4.00
0.50
. 5 4
Thus,
0.6875 10 = 0.548
From Table 20.1,
i.e.
0.54 8 = 0.101 1002
0.6875 10 = 0.1011 2
(c) Multiplying repeatedly by 8, and noting the integer values, gives:
0.71875 × 8 =
5.75
×8=
6.00
0.75
. 5 6
Thus,
From Table 20.1,
i.e.
0.71875 10 = 0.56 8
0.56 8 = 0.101 1102
0.71875 10 = 0.10111 2
327
© 2014, John Bird
3. Convert the following decimal numbers to binary numbers, via octal:
(a) 247.09375
(a)
(b) 514.4375
8
247
8
30
7
8
3
6
8
0
3
(c) 1716.78125
Remainder
3
6
7
367 8 = 011 110 111 2
From Table 20.1,
i.e.
367 10 = 11110111 2
0.09375 × 8 =
0.75
×8=
6.00
0.75
. 0 6
Thus,
0.09375 10 = 0.06 8
From Table 20.1,
0.09375 10 = 0.00011 2
i.e.
247.09375
=
367.06
=
11110111.000112
10
8
Hence,
(b)
0.06 8 = 0.000 110 2
8
514
Remainder
8
64
2
8
8
0
8
1
0
0
1
1
From Table 20.1,
0
0
2
514 8 = 001 000 000 010 2
328
© 2014, John Bird
i.e.
514 10 = 10000000102
0.4375 × 8 =
3.50
×8=
4.00
0.50
. 3 4
Thus,
0.437510 = 0.34 8
From Table 20.1,
i.e.
0.34 8 = 0.011 100 2
0.4375 10 = 0.0111 2
Hence, 514.4375
=
=
1002.34
1000000 010.01112
10
8
(c)
8 1716
Remainder
8
214
4
8
26
6
8
3
2
0
3
3
6
4
1716 8 = 011 010 110 100 2
From Table 20.1,
i.e.
1716 10 = 110101101002
0.78125 × 8 =
6.25
×8=
2.00
0.25
2
. 6 2
Thus,
From Table 20.1,
i.e.
0.78125 10 = 0.62 8
0.628 = 0.110 010 2
0.7812510 = 0.110012
Hence, 1716.78125
=
3264.62
=
11010110100.110 012
10
8
329
© 2014, John Bird
4. Convert the following binary numbers to decimal numbers via octal:
(a) 111.011 1
(b) 101 001.01
(c) 1 110 011 011 010.001 1
(a) 111.0111 = 111.011 100 2
= 7 . 3
3 4
= 7.437510
48 = 7 × 80 + 3 × 8−1 + 4 × 8−2 = 7 + +
8 82
(b) 101001.01 = 101 001.010 2
=
5
1 . 28 = 5 × 81 + 1× 80 + 2 × 8−1 = 40 + 1 +
2
= 41.2510
8
(c) 1110011011010.0011 = 001 110 011 011 010.001 100 2
= 1 6 3 3 2 . 1 48
= 1× 84 + 6 × 83 + 3 × 82 + 3 × 81 + 2 × 80 + 1× 8−1 + 4 × 8−2
= 4096 + 3072 + 192 + 24 + 2 +
330
1 4
= 7386.187510
+
8 64
© 2014, John Bird
EXERCISE 88 Page 184
1. Convert E7 16 into its decimal equivalent.
E 716 = E×161 + 7×160 = 14×16 + 7×1 = 224 + 7 = 23110
2. Convert 2C 16 into its decimal equivalent.
2 C16 = 2×161 + C×160 = 32 +12 = 4410
3. Convert 98 16 into its decimal equivalent.
9816 = 9 ×161 + 8 ×160 = 9 ×16 + 8 ×1 = 144 + 8 = 15210
4. Convert 2F1 16 into its decimal equivalent.
2 F116 = 2×162 + F×161 +1×160 = 2×162 +15×161 +1×160
= 512 + 240 + 1 = 75310
5. Convert 54 10 into its hexadecimal equivalent.
16 54
16
Remainder
3
6 ≡ 6 16
0
3 ≡ 3 16
most significant bit → 3
Hence,
6 ← least significant bit
54 10 = 36 16
6. Convert 200 10 into its hexadecimal equivalent.
331
© 2014, John Bird
16 200
Remainder
16
12
8 ≡ 8 16
0
12 ≡ C 16
C
8
20010 = C816
Hence,
7. Convert 91 10 into its hexadecimal equivalent.
16 91
16
Remainder
5
11 ≡ B 16
0
5 ≡ 5 16
5
Hence,
B
91 10 = 5B 16
8. Convert 238 10 into its hexadecimal equivalent.
16 238
16
Remainder
14
14 ≡ B 16
0
14 ≡ E 16
E E
Hence,
23810 = EE16
332
© 2014, John Bird
EXERCISE 89 Page 185
1. Convert 11010111 2 into its hexadecimal equivalent.
110101112 = 1101 0111 grouping in 4s
=
D
7 16
from Table 20.2
i.e. 110101112 = D 716
2. Convert 11101010 2 into its hexadecimal equivalent.
111010102 = 1110 1010 grouping in 4s
= E
A 16
from Table 20.2
i.e. 111010102 = EA16
3. Convert 10001011 2 into its hexadecimal equivalent.
100010112 = 1000 1011 grouping in 4s
=
8
B 16
from Table 20.2
i.e. 100010112 = 8B16
4. Convert 10100101 2 into its hexadecimal equivalent.
101001012 = 1010 0101 grouping in 4s
=
A
5 16
from Table 20.2
i.e. 101001012 = A 516
5. Convert 37 16 into its binary equivalent.
3716 = 0011 0111 2 = 110111 2
from Table 20.2
6. Convert ED 16 into its binary equivalent.
ED16 = 1110 1101 2
from Table 20.2
333
© 2014, John Bird
7. Convert 9F 16 into its binary equivalent.
9F16 = 1001 1111 2
from Table 20.2
8. Convert A21 16 into its binary equivalent
A2116 = 1010 0010 0001 2
from Table 20.2
334
© 2014, John Bird