ITC161/544 Computer Systems/Computer Organisation and

SCM, CSU201530
Page |1
ITC161/544 Computer Systems/Computer Organisation and Architecture
Topic 2 Tutorial Solutions (Data Representation)
1. Convert the following decimal numbers into binaries:
i) 54, ii) 255, iii) 1026
Answer:
i) 110110
ii) 11111111
iii) 10000000010
2. Convert the following binary numbers into decimals:
i) 11001011, ii) 10001001, iii) 11001100
Answer:
i) 203
ii) 137
iii) 204
3. Convert the following decimal fractions to binaries:
i) 237.25, ii) 32.32, iii) 100.11
Answer:
i) 11101101.01
ii) 100000.010100011...
iii) 1100100.000111000010...
4. Convert the following binary fractions into decimals
i) 1101.11, ii) 101.001, iii) 0.0110
Answer:
i) 13.75
ii) 5.125
iii) 0.375
5. Represent the number -92 and -256 in 8-bit 2's complement
Answer:
i) 10100100
ii) Not possible
6.1 Represent the following decimal numbers in binary using 8-bit signed magnitude,
one's complement and two's complement:
a. 77
b. −42
c. 119
d. −107
ITC161/544 Topic 2 Tutorial Solutions
SCM, CSU201530
Page |2
Ans.
a.
Signed magnitude: 01001101
One's complement: 01001101
Two's complement: 01001101
b.
Signed magnitude: 10101010
One's complement: 11010101
Two's complement: 11010110
c.
Signed magnitude: 01110111
One's complement: 01110111
Two's complement: 01110111
d.
Signed magnitude: 11101011
One's complement: 10010100
Two's complement: 10010101
6.2 Generalize the range of values (in decimal) that can be represented in any given x
number of bits using:
a. Signed magnitude
b. One's complement
c. Two's complement
Ans.
a. −(2x−1−1) to +(2x−1 − 1)
b. −(2x−1 − 1) to +(2x−1 − 1)
c. −(2x−1) to +(2x−1 − 1)
7. What is the highest and lowest values can be stored using 6 bits 2’s complement
method?
Answer:
Highest= 31 Lowest=-32
8. Convert the following numbers from unsigned binary notation to decimal notation,
and from 6-bit 2's complement notation to decimal notation:
i) 110011, ii) 001101, iii) 101101
Answer:
Unsignedi) 51 ii) 13 iii) 45
2’s complementi) -13 ii) 13 iii) -19
9. Convert the following numbers from hexadecimal to binary and decimal notations:
i) 6AB2, ii) FF9A, iii) FACE
Answer:
i) 110101010110010, 27314
ii) 1111111110011010, 65434
iii) 1111101011001110, 64206
ITC161/544 Topic 2 Tutorial Solutions
SCM, CSU201530
Page |3
10. Using a "word" of 4 bits, list all of the possible signed binary numbers and their
decimal equivalents that are representable in:
a. Signed magnitude b. Two's complement
Answer:
a. 0111 to 1111, or +7 to −7
b. 0111 to 1000, or +7 to −8
11. Show how each of the following floating point values would be stored using IEEE-754
single precision (be sure to indicate the sign bit, the exponent, and the significand fields):
a. 12.5
b. −1.5
c. 0.75
d. 26.625
Answer:
a.
12.5 = 1.1001x23
3+127 = 130 = 10000010
0
10000010
1001000...0
b.
−1.5 = −1.1x20
0 + 127 = 127 = 01111111
1
01111111
1000000...0
c.
0.75 = 1.1x2−1
−1 + 127 = 126 = 01111110
0
01111110
1000000...0
d.
26.625 = 1.1010101x24
4 + 127 = 131 = 10000011
0
10000011
1010101...0
12. Given the following two binary numbers: 11111100 and 01110000.
a. Which of these two numbers is the larger unsigned binary number?
b. Which of these two is the larger when it is being interpreted on a computer using
signed-two’s complement representation?
c. Which of these two is the smaller when it is being interpreted on a computer using
signed-magnitude representation?
Answer:
a. 11111100
b. 01110000
c. 11111100
13. What is the most common representation used in most computers to store signed
integer values and why?
Answer:
2’s complement representation. The algorithm for adding and subtracting numbers
is easier, it has the best representation for zero, it has a larger range of negative
numbers, and it easily extends to larger numbers.
ITC161/544 Topic 2 Tutorial Solutions
SCM, CSU201530
Page |4
14. The following is a representation of a decimal floating value using IEEE-754 single
precision. Find out the value in decimal.
0 10000011 10101000000...0
Answer:
S=0 => this is a positive number
10000011 = 131
e = 131 – 127 = 4
mantissa = .10101 = 0.5+0.125+.03125 = 0.65625
Thus,
1.65625 X 24 = 26.5
ITC161/544 Topic 2 Tutorial Solutions