Computer Sciences Dept.

CS/ECE 252 Introduction to Computer Engineering

Spring 2007 Sections 1 and 2
Instructor Mark D. Hill and TAs Marc de Kruijf & Sanghamitra Roy
URL: http://www.cs.wisc.edu/~markhill/cs252/Spring2007/

Homework 2 // Due at Lecture Wed Feb 07

This page lists the same problems as Homework #2, but explicitly contains the questions from ItCS for those who do not yet have the textbook's second edition.

You may do this homework in a group of two students from the same 252 section and turn in one solution at lecture with BOTH students names at the top.

First contact for questions to TA Marc de Kruijf at: dekruijf@cs.wisc.edu

Problem 1

a. Assume that there are about 150 students in your class. If every student is to be assigned a unique bit pattern, what is the minimum number of bits required to do this?

b.How many more students can be admitted to the class without requiring additional bits for each student's unique bit pattern? (P 2.3)

Problem 2

Consider all 16 distinct 4-bit combinations. In a table, show what decimal number each pattern corresponds to in unsigned, signed magnitude, and 2's complement.

Problem 3

What are the 8-bit patterns used to represent each of the characters in the string "CS/ECE 252"? (Only represent the characters between the quotation marks.)

Problem 4

a. What is the largest positive number one can represent in an 8-bit 2's complement code? 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 code? Write your result in binary and decimal.

c. What is the largest positive number one can represent in n-bit 2's complement code?

d. What is the greatest magnitude negative number one can represent in n-bit 2's complement code? (P 2.8)

Problem 5

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

  1. 0110
  2. 1001
  3. 11100110
  4. 1000110011111000

Problem 6

Express the negative value -21 as a 2's complement integer, using eight bits. Repeat, using 16 bits. Repeat, using 32 bits. What does this illustrate with respect to the properties of sign extension as they pertain to 2's complement representation? (P 2.19)

Problem 7

The following binary numbers are 4-bit 2's complement binary numbers. Which of the following operations generate overflow? Justify your answers by translating the operands and results into decimal.(P 2.20)

  1. 0110 + 1001
  2. 0100 + 1100
  3. 0101 + 0011
  4. 1001 - 0010
  5. 1011 + 0101

Problem 8

Describe what conditions indicate overflow has occured when two 2's complement numbers are added. (P 2.21)

 
Computer Sciences | UW Home