Computer Sciences Dept.

CS/ECE 252 Introduction to Computer Engineering

Fall 2011 Section 1
Instructor Guri Sohi
TAs Newsha Ardalani and Rebecca Lam

URL: http://www.cs.wisc.edu/~sohi/cs252/Fall2011/

Homework 2 // Due at lecture Fri, Sep 16

Primary contact for this homework: Newsha Ardalani [newsha at cs dot wisc dot edu]

You must do this homework in groups of two. Please write the full name and the student id of each member on every pages and staple multiple pages together.

Problem 1 (4 points)

Find the 2's complement of the following binary numbers.

  1. 0110 0010
  2. 0011 1011
  3. 1001 1101
  4. 0011 1111

Problem 2 (4 points)

Convert the following 2's complement binary numbers to decimal numbers.

  1. 0111
  2. 1101
  3. 01110
  4. 111010

Problem 3 (8 points)

Using 1 byte (8 bits) to represent each number, write the binary representations of 28 and -28 in unsigned, sign-magnitude, 1's complement, and 2's complement.

NumberUnsignedSign-Magnitude1's Complement2's Complement
28
-28

Problem 4 (6 points)

  1. Assume that there are exactly 503 occupants in a village. If every person is to be assigned a unique bit pattern, what is the minimum number of bits required to do this?
  2. How many more people can be added to the city population without requiring additional bits for each person's unique id?
  3. Suppose that for village A, we need 8 bits to represent everyone uniquely. Similarly for village B, we need 9 bits. If both villages are combined into one big village, how many bits are required to represent everyone uniquely?

Problem 5 (4 points)

  1. What is the largest positive number one can represent in a 8-bit 2's complement code? Write your result in binary and decimal.
  2. What is the greatest magnitude negative number one can represent in a 8-bit 2's complement code? Write your result in binary and decimal.
  3. What is the largest positive number one can represent in a 8-bit 1's complement code? Write your result in binary and decimal.
  4. What is the greatest magnitude negative number one can represent in a 8-bit 1's complement code? Write your result in binary and decimal.

Problem 6 (2 points)

Compute the followings:

  1. NOT(1101) OR NOT(1100)
  2. NOT(1000 AND (1100 OR 0101))

Problem 7 (1 points)

Describe what conditions indicate overflow has occurred when two 2's complement numbers are added.

Problem 8 (1 points)

Convert the following bit sequence into hexadecimal
1111101011001110000011111111

 
Computer Sciences | UW Home