COS 111, Fall 2000 - Problem Set 2

Due by 5pm, Tuesday Oct. 3

Problem 1
From Brookshear, Chapter One Review Problem 41b:
Solve by translating into two's complement notation (using patterns of 5 bits). Check your work by converting your answer into base ten notation: 7 + (-1)

Convert 7 into base-2: 00111

Convert -1 into base-2: 11111 (since 11111 + 00001 = 00000, in 5-bit addition)

Add the two values:

	00111
      + 11111
	-----
	00110     (carry bits were 11110)

Check work: 00110 has a 1 in the 2's place and the 4's place, so it equals 2+4 in base-ten, or 6. Since 7+(-1) = 6, we got the right answer.


Problem 2
From Brookshear, Chapter One Review Problem 41d:
Solve by translating into two's complement notation (using patterns of 5 bits). Check your work by converting your answer into base ten notation: 8 + (-7)

Convert 8 into base-2: 01000

Convert -7 into base-2: 11001 (since 11001 + 00111 = 00000, in 5-bit addition)

Add the two values:

	01000
      + 11001
	-----
	00001    (carry bits were 10000)

Check work: 00001 has a 1 in the 1's place and zeroes everywhere else, so it equals 1 in base ten. Since 8+(-7) = 1, we got the right answer.


Problem 3
From Brookshear, Chapter One Review Problem 41f:
Solve by translating into two's complement notation (using patterns of 5 bits). Check your work by converting your answer into base ten notation: 4 + 11

Convert 4 into base-2: 00100

Convert 11 into base-2: 01011

Add the two values:

	00100
      + 01011
	-----
	01111     (carry bits were 00000)

Check work: 01111 has ones in the 1's, 2's, 4's, and 8's places, so it equals 1+2+4+8 in base-ten, or 15. Since 4+11 = 15, we got the right answer.


Problem 4 Give the truth table for the following logical expression

  not ((not x) or (not y))
Do you recognize this function?

Here is the truth table:

	x | y | not(x) | not(y) | (not x) or (not y) | not ((not x) or (not y))
	-----------------------------------------------------------------------
	0 | 0 |   1    |   1    |         1          |            0
	0 | 1 |   1    |   0    |         1          |            0
	1 | 0 |   0    |   1    |         1          |            0
	1 | 1 |   0    |   0    |         0          |            1

This function is the same as (x and y); you can verifying this by comparing the truth table of this function to the truth table for (x and y).


Problem 5
The truth table below shows the value of the carry bit resulting from the addition of three input bits: x, y, and z. Write an expression (using AND, OR, and NOT), or, if you prefer, draw a circuit (using AND, OR, and NOT gates) to represent the carry bit function.

           x y z | carry(x,y,z)
          -------|-------------
           0 0 0 |    0
           0 1 0 |    0
           1 0 0 |    0
           1 1 0 |    1
           0 0 1 |    0
           0 1 1 |    1
           1 0 1 |    1
           1 1 1 |    1

There are several ways to write this function. Here is one:
(x and y and not z) or (y and z and not x) or (x and z and not y) or (x and y and z)

Here is a simpler one:
(x and y) or (x and z) or (y and z)
You can verify that it is the same function by comparing truth tables.

Back to Schedule and Assignments