# Spring 2001 CSCI 255 Homework 2 Solution

## Problem 1

Add the following six-bit twos-complement number.
Which, if any, of the additions result in an overflow?

111000 + 101010 | 100010 |

010111 + 001111 | 100110 |

In the first problem, two negative numbers are added and
a negative number is the result. This is *not*
an overflow.
In the second problem, two postive numbers are added
and a negative number is the result. This is an overflow.

## Problem 2

Compute the following bit-wise logical operations on six-bit
binary numbers.

011011 AND (101000 OR 000001) | 001001 |

NOT(001100) AND NOT(011110) | 100001 |

## Problem 3

Translate the first four characters of your last name
into an ASCII hexadecimal string.

Use the table of page 514 to look up the ASCII codes
of the four characters.

## Problem 4

The following 32-bit strings represent IEEE
floating point numbers. Translate the bits into
their "normal" floating point representation.
This is *not* an easy problem.

01000001001010000000000000000000 | 10.5 |

11000100110000000000000000000000 | -1536 |

Hopefully, you used the spreadsheet from the
January 24 lecture to solve this problem.
If not, go look at it now. It explains IEEE floating point better than
words.

## Problem 5

Draw a circuit that implements the truth table shown below.
The "inputs" to the truth table are A, B, and C.
The output is Z.
Review section 3.3.4 before attempting this problem.

input | output |

A | B | C | Z |

0 | 0 | 0 | 0 |

0 | 0 | 1 | 0 |

0 | 1 | 0 | 1 |

0 | 1 | 1 | 1 |

1 | 0 | 0 | 0 |

1 | 0 | 1 | 0 |

1 | 1 | 0 | 1 |

1 | 1 | 1 | 0 |

There are three 1's in the output. They are in the rows for
A' B C', A' B C, and A B C'.
Consequently the Boolean expression is
A' B C' + A' B C + A B C'.
If you've taken MATH 261, you should be able to determine
that this expression can be simplified to
A' B + B C'.

## Problem 6

Complete a truth table to describe the logic circuit shown below.

input | output |

A | B | C | X |

0 | 0 | 0 | 0 |

0 | 0 | 1 | 0 |

0 | 1 | 0 | 0 |

0 | 1 | 1 | 1 |

1 | 0 | 0 | 0 |

1 | 0 | 1 | 1 |

1 | 1 | 0 | 0 |

1 | 1 | 1 | 1 |

You can solve the problem in a couple of ways. First, you can just
"plug in" all eight input combinations and see what they
produce on the output. Or, you can determine what the function
is algebraicly, in this case
it simplifies to A C + B C, and then complete a truth table.
Unless you are particularly good in Boolean algebra, you'll
find the first method easier.