CSc 252 — Homework 1
Version 1.0
1 of 9
Homework 1
Due:
10am Tuesday, Sep. 06, 2011
Turnin:
Four
solutions:
1 iv, 1 v
,
5
and
9
. To receive credit for your solutions, you must show
your work
where applicable. Solutions to the remaining problems are attached.
1. —
Assume that 16-bit, two’s complement, binary numbers are being used in this problem.
Some binary arithmetic and conversions. For each of the pairs of numbers below, compute:
a.) hexadecimal (base 16) equivalents for both a and b, assume unsigned numbers
b.) octal (base 8) equivalents for both a and b, assume unsigned numbers
c.) decimal (base 10) equivalents for both a and b, assume two’s complement numbers
d.) a + b and indicate if overflow occurs, assume two’s complement numbers
e.) a - b by negating b and adding, indicate if overflow occurs, assume two’s complement
numbers
i.)
a = 0100 0111 0101 1000
b = 1000 0000 1100 0110
ii.)
a = 0001 0000 0011 1000
b = 0111 0010 0100 1011
iii.)
a = 0000 0000 0110 1100
b = 0000 0001 1010 1001
iv.)
turnin this one
(15 points, 3 points each part)
a = 0110 1001 1000 1101
b = 1010 0011 0001 1100
v.)
turnin this one
(15 points, 3 points each part)
a = 0110 1010 1100 1000
b = 0101 1011 0011 1110
2. —
Given the bit pattern:
1100 0011 1010 0000 0000 0000 0000 0000
what does it represent, assuming that it is
a.) a two’s complement integer?
b.) an unsigned integer?
c.) a floating-point number?
3. —
This exercise is similar to the previous one, but this time, use the bit pattern:
0000 0000 0000 0000 0000 0000 0000 0000
4. —
This exercise is similar to the previous one, but this time, use the bit pattern:
0011 1100 0011 0000 0000 0000 0000 0000
5. turnin this one
(20 points, 5 points for b) and c) each, 10 points for c)) —
This exercise is similar to the previous one, but this time, use the bit pattern:
1100 1000 0001 1011 1000 1001 0111 0101
6. —
Based on problem 3.10.4, page 292. Show the IEEE754 binary representation for the
floating-point number 10.0
ten
.
7. —
This exercise is similar to the previous one, but this time use 1,024.5
ten
.
8. —
This exercise is similar to the previous two, but this time use -42.3125
ten
.