Data Types Worksheet 3
Data Types Worksheet 3
Data types
Task 1
Carry out the following binary sums showing your working out:
a) 1012 + 1112
1 0 1
1 1 1
b) 101102 + 101112
1 0 1 1 0
1 0 1 1 1
1 1
1 0 0 0 0 1
1 0 1
Show how the following values can be stored as binary bytes within a computer system and
determine the answer that would be calculated and stored:
e) 1210 + 1310
128 64 32 16 8 4 2 1
1
Worksheet 3 Binary arithmetic
Data types
f) 17410 + 25510
h) A computer has been designed to work only in single bytes of data. Describe the
problem that will be encountered when carrying out the sum 011110012 + 111110012 if
the answer is only allocated one byte of storage.
2
Worksheet 3 Binary arithmetic
Data types
a) -5010
b) -12010
c) 12710
d) -12810
e) Show that -5010 gives the same result as in (a) above using the following alternative
method:
Assume the left-most bit represents -128. Start at -128 and then add the remaining
values:
-128 64 32 16 8 4 2 1
1 1 0 0 1 1 1 0
1 1 1 0 0 0 1 0
g) -6610 + 3410
h) -8810 - 1210
i) 2210 - -1410
3
Worksheet 3 Binary arithmetic
Data types
a) 8.510
b) 14.2510
c) 0.12510
d) 5.562510
e) 1.937510
f) 0.062510
Convert these fixed-point binary bytes to decimal where the first 3 bits represent the whole
number part and the the last 5 bits represent the fractional part:
g) 101010102
h) 101110112
i) 001110112
j) 111110002
k) 000111112
l) 111111112