CS 110: Elements of Computing. Instructor: Jim Aspnes


Homework Two Solutions

Due Friday, September 27th, 2002, at 5:00pm.

Original assignment.

Your task

Do problems 5, 39, and 42 from the end of Chapter 1 of Brookshear. For problem 42, you may provide for each answer either a decimal expansion (e.g. 5.125) or a fraction (5 1/8).

Write up an email message containing your full name and the answer to these problems in plain text format (this means no HTML or Microsoft word documents), and send it to aspnes+110-02-2@cs.yale.edu. (Note: this is not the same email address as for previous homework.)

Solution:

5.

00 02
01 53
02 01
03 53

39.

a. 0001100
b. 1110100
c. 1111111
d. 0000000
e. 0001000

42.

a. 3 1/8    or  3.125
b. 4 13/16  or  4.8125
c. 5/16     or  0.3125
d. 1
e. 2 1/4    or  2.25

Clarifications

Moving values in memory

When moving values from one memory location to another, the move operation is really a copy. The new location gets the value of the old location, and the value of the old location is unchanged.

For example: Suppose the contents of the memory are

AddressValue
001C
01AF
02E1
0342

And now we do a move of the contents of 00 to 03. The new contents of the memory will be

AddressValue
001C
01AF
02E1
031C

Fri 20 Dec 2002 16:31:35 EST hw2.solutions.tyx Copyright © 2002 by Jim Aspnes