Bits and Bytes Binary Hex Float Ex Solutions
Bits and Bytes Binary Hex Float Ex Solutions
1.
a) 4 numbers can be represented with 2 bits, 8 with 3 bits, 16 with 4 bits.
b) With each additional bit, the number of numbers that can be represented is multiplied by 2, so 5
bits can represent 32 numbers. We notice the pattern :
2 bits 4 = 22 numbers
3 bits 8 = 23 numbers
4 bits 16 = 24 numbers
5 bits 32 = 25 numbers
8 bits 28 = 256 numbers
n bits 2n numbers
8 bits can represent 256 numbers and n bits can represent 2n numbers.
2. The binary representations of odd numbers end with a 1 and that of even numbers end with a 0.
3. In the right-most column (unit column) the 0 and 1 alternate (0, 1, 0, 1, 0, 1…). In the next column
(2’s column) two 0’s are followed by two 1’s, followed by two 1’s, etc. (0, 0, 1, 1, 0, 0, 1, 1, 0, 0, …). In
the four’s column the 0 and 1 alternate by block of 4 (0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 ,1, 1, 1, 1…).
Finally in the eights’ columns the 0 and 1 alternate in block of eight (8 0’s followed by 8 one, etc…)
8 9 10 11 16 17 18 19
12 13 14 15 20 21 22 23
24 25 26 27 24 25 26 27
28 29 30 31 28 29 30 31
6. Find the decimal values of the following binary numbers. (Note: to make them more readable we
often write the digits of a binary numbers by groups of four.)
a) 1000 00002 = 128 (27 = 128 or use table below)
b) 1111 11112 The number before 1 0000 0000 which is 28 = 256. So 1111 111 is
255. Or use table below.
c) 0010 11102 = 46(from table below: 32 +8 + 4 + 2 = 46)
d) 1011 00002 = 176 (from table below: 128 + 32 + 16 = 176)
128 64 32 16 8 4 2 1
a) 1 0 0 0 0 0 0 0
b) 1 1 1 1 1 1 1 1
c) 0 0 1 0 1 1 1 0
d) 1 0 1 1 0 0 0 0
7.
a) 64 = 26 so 64 = 100 00002
b) 65 = 64 + 1 so 65 = 100 00012
c) 43 43 – 32 = 11 11 – 8 = 3 3 – 2 = 1 1- 1 = 0 43 = 10 10112
d) 213 213 – 128 = 85 85 – 64 = 21 21 – 16 = 5 5 – 4 = 1 1 – 1 = 0 so 213 = 1101 01012
128 64 32 16 8 4 2 1
64 1 1
65 1 1
43 1 1 1 1
213 1 1 1 1 1
8. 28 = 256 nonnegative integers can be represented with a byte. The largest integer that can be
written with one byte is 1111 11112 = 255.
14. Give the 10-digit floating- point representations with a 6-digit mantissa and 3-digit exponent of the
following numbers:
a. 3892 +389200-02
b. .93452 +934520-06
c. 4,231,123 +423112+01
d. -0.0023012 -230120-08
15. In this problem we consider the same10-digit floating- point representation as in question 16.
Consider the number 0.234211.
a. What is its floating-point representation?
+234211-06
b. What is the smallest number larger than 0.234211 that has a floating-point representation
different from 0.234211 without loss of precision?
(Hint: increase the mantissa you found in a) by 1 and convert the number back to decimal.)
Add one to mantissa: +234212-06 0.234212
c. Give a number that would have same floating-point representation as 0.234211 and a
number that would have same floating-point representation as the number you found in
b). Choose the 2 numbers so that they are between 0.234211 and the number found in b).
0.2342113 has the same representation as 0.234211 (replace the last 3 by any digit
between 1 and 4 and it would work).
0.2342116 has the same representation as 0.234212 (replace the 6 by any digit between 5
and 9 and it would work).
The two given numbers are between 0.234211 and 0.234212.