Brock

COSC 2P12
Assignment 1

Last Modified: Thursday, 28-Sep-2017 14:17:54 EDT

Fall
2017

Due: Friday, October 6, 2017, 5:30 pm
Accepted late until Tuesday, October 10, 2017, 5:30 pm, subject to a 25% penalty

Complete the following questions. Although there may be calculators and other tools to assist, you should complete the work manually in order to gain maximum familiarity. However after you have completed the work these tools can be used to confirm and reinforce your answers. Note that during tests or exams no external aids, such as calculators, will be permitted.

Text Questions

2.4 Given n bits, how many unsigned integers can berepresented with the n bits? What is the range of these integers.

2.8
a. What is the largest positive number one can represent in an 8-bit 2's complement representation? Write your result in binary and decimal.
b. What is the greatest magnitude negative number one can represent in an 8-bit 2's complement representation. Write your result in binary and decimal.
c. What is the largest positive number one can represent in an n-bit 2's complement representation?
d. What is the greatest magnitude negative number one can represent in an n-bit 2's complement representation?

2.12 If the last digit of a 2's complement binary number is 0, then the number is even. If the last two digits of a 2's complement number are 00 (eg. the binary number 01100) what does that tell you about the number?

2.14 Add the following bit patterns. Leave your results in binary form.
a. 1011 + 0001
b. 0000 + 1010
c. 0101 + 0110
d. 1111 + 0001

2.40 Write the decimal equivalents for these IEEE floating point numbers.
a. 0 10000000 00000000000000000000000
b. 1 10000011 00010000000000000000000
c. 0 11111111 00000000000000000000000
d. 1 10000000 10010000000000000000000

Number Systems

1. Convert each of the following base 10 numbers to base 2, 8, and 16.
a. 9355
b. 16094

2. Convert each of the following base 2 numbers to base 8, 10, and 16.
a. 1110001010001010110
b. 11010011011101111

3. Convert each of the following base 16 numbers to base 2, 8, and 10.
a. A2D
b. 1055

4. Convert 555 which is a number in base 6 to the same value expressed in the bases given below.
a. 4
b. 9
c. 12

Data Representation

5. Determine the data representation of each of the following integers assuming 16 bits are used for each of the representations of sign and magnitude, one’s complement, and two’s complement. Your answers must be expressed in hexadecimal.
a. 9355
b. -16094

6. Determine the data representation of each of the integers from question 5 again, but assume 32 bits are used and only show the representation for two’s complement. Your answers must be expressed in hexadecimal.

7. For each the following representations of 16 bit integers determine the integer values they represent assuming each of a sign and magnitude, one’s complement, and two’s complement representation.
a. FF4E
b. 70F1

8. Write the decimal value corresponding to each of these IEEE 32-bit floating point numbers as expressed in hexadecimal. Note that the associated bits are from left to right: sign, exponent, mantissa.
a. 40000000
b. C1880000
c. 40480000

9. For each of the following decimal values produce the 32-bit IEEE Floating Point representation. Display your answer in binary clearly identifying the sign, exponent and mantissa.
a. -1.2
b. 275.024


Submission:
You may either type or neatly print your solutions.
Staple your assignment answer sheets with a standard computer science cover sheet at the front and deposit in the handin box for COSC 2P12.

Late Penalties:
Late assignments will be accepted up to 3 days after the due date subject to a 25% penalty.

Note: Any suspected plagiarism will be dealt with harshly in accordance with departmental guidelines as outlined on the Computer Science web site. The page to visit for more information is found here.