# Solution for Spring 2002 CSCI 255 Practice Homework 1

## Problem 1

Convert the following numbers from decimal into ten-bit
twos-complement notation.

431 | 0110101111 |

-500 | 1000001100 |

1 | 0000000001 |

-17 | 1111101111 |

## Problem 2

Convert the following ten-bit twos-complement numbers
into decimal numbers.

1011001110 | -306 |

0110101110 | 430 |

1000000010 | -510 |

0111111110 | 510 |

## Problem 3

What are the largest and smallest numbers that can be
expressed as a ten-bit twos-complement number?

The smallest is -512 (binary 1000000000) and the largest is 511
(binary 0111111111).
In general, if `n` is the width of the twos complement
number, the smallest possible number is -2^{n-1}
and the largest possible number is 2^{n-1}-1,

## Problem 4

Express the following decimal numbers in base 6:

## Problem 5

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

101000 + 111011 | 100011 |

011111 + 000111 | 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.