0% found this document useful (0 votes)
19 views

Bits and Bytes Binary Hex Float Ex Solutions

This document provides examples and explanations of binary number representations and binary-decimal conversions. Some key points covered include: - Each additional bit in a binary number doubles the number of values it can represent - Binary numbers use a pattern of 0s and 1s to represent values in the ones, twos, fours, eights, etc columns - 8-bit binary numbers can represent 256 values from 0 to 255 - Common binary operations include converting between binary, decimal, and hexadecimal numbers.

Uploaded by

Akshat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Bits and Bytes Binary Hex Float Ex Solutions

This document provides examples and explanations of binary number representations and binary-decimal conversions. Some key points covered include: - Each additional bit in a binary number doubles the number of values it can represent - Binary numbers use a pattern of 0s and 1s to represent values in the ones, twos, fours, eights, etc columns - 8-bit binary numbers can represent 256 values from 0 to 255 - Common binary operations include converting between binary, decimal, and hexadecimal numbers.

Uploaded by

Akshat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

BITS and BYTES- Exercises 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…)

4. The pattern above will continue.

Binary Number Decimal Value Binary Number Decimal Value


00000 0 10000 16
00001 1 10001 17
00010 2 10010 18
00011 3 10011 19
00100 4 10100 20
00101 5 10101 21
00110 6 10110 22
00111 7 10111 23
01000 8 11000 24
01001 9 11001 25
01010 10 11010 26
01011 11 11011 27
01100 12 11100 28
01101 13 11101 29
01110 14 11110 30
01111 15 11111 31
5. Magic cards from 0 to 31.
1 3 5 7 2 3 6 7 4 5 6 7
9 11 13 15 10 11 14 15 12 13 14 15
17 19 21 23 18 19 22 23 20 21 22 23
25 27 29 31 26 27 30 31 28 29 30 31

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.

9. Convert the following hexadecimal numbers to decimals.


a) 3A16 = 3⋅16 + 10 = 58
b) 61216 = 6⋅162 + 1⋅16 + 2 = 1554
c) FEB216 = 15⋅163 + 14⋅162 + 11⋅16 + 2 = 65,202

10. Convert the following binary numbers to hexadecimals.


a) 101100101= 0001 0110 0101 = 16516
b) 10001001111 = 0100 0100 1111 = 44F16

11. Convert the hexadecimal numbers from question 9 . to binary.


a) 3A16 = 0011 10102
b) 61216 = 0110 0001 00102
c) FEB216 = 1111 1110 1011 00102
Exercises
12. Write the following numbers in scientific notation.
a. 231 = 2.31 ⋅ 102
b. 34.212 = 3.4212 ⋅ 10
c. – 3409992 = -3.409992 ⋅ 106
d. 0.01023 = 1.023 ⋅ 10-2

13. Write the following numbers in their decimal form.


a. – 9.86 ⋅ 102 = -986
b. 1.24 ⋅ 103 =1,240
c. 6.9087 ⋅ 10-5 = 0.000069087
d. – 8.349E+2 = -834.9

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.

You might also like