Assignment 2, due Sept 5

Part of the homework for 22C:60, Fall 2008
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated (usually a Friday). The only exceptions to this rule will be by advance arrangement unless there is what insurance companies call "an act of God" - something outside your control. Homework must be turned in on paper and in class! Late work may be turned in to the teaching assistant's mailbox, but see the late work policy. Never push late work under someone's door!

Homework

  1. Problem: Throw coins to get two random 8-bit numbers (one coin toss per bit). Add them (0.2 points), convert them to decimal (0.2 points each), add the decimal equivalents (0.2 points), and convert the decimal sum to binary to check the your binary sum (0.2 points). Show your work!

  2. Problem: Express the value 10010 in each of the following number bases, using the SMAL notation for numbers in that base: (0.2 points each)

    a) Base 2
    b) Base 4
    c) Base 8
    d) Base 16
    e) Base 5

    (Note: You can use the SMAL assembler to check your work, but how to do this is left as an exercise.)

  3. Problem: Consider the 8-bit number 10010101. What is the (not necessarily negative) decimal interpreation of this value in each of the following number systems: (0.2 points each)

    a) Unsigned binary
    b) Signed magnitude binary
    c) One's complement binary
    d) Two's complement binary
    e) Biased, with the natural bias for 8 bits