# Homework 6: number systems, text, and logic gates

## Learning Objective

 In this assignment, you practice working with binary numbers, converting between decimal and binary, converting between binary and hexadecimal, binary to hexadecimal, and ASCII text decoding. The theme of this homework is "the only way to learn is by doing," so please keep that in mind when it gets tedious, and if you feel you do not understand part of it, make up another similar problem for extra practice.

## Assignment

The following questions/problems should be worked out long-hand (e.g. pen and paper or typed in MS Word document), not with a calculator tool -- use the calculator from lab 06 to check your work. The answers should be typed up in a MS Word (1997-2003 format) document, with the file name `username-hw06.doc`, replacing `username` with your BU username.

Perhaps you would prefer to type your work directly so as to avoid writing it out on paper and re-copying -- you choose.

## Binary, Hexadecimal, and Decimal conversions.

• Convert the following decimal integer `1001001` to binary. Show your work.

• How many bits would you need to represent the population of humans on the planet earth? What about if the population doubles in the next 50 years? Show how you arrived at this number.

• Convert the following 16-bit binary number `1010 1100 1011 1111` to decimal. Show your work.

• Suppose you want to be the most popular person at the next party you go to, and give your phone number to everyone in hexadecimal.

• Treat your 10-digit phone number as a 10-digit decimal integer (not as 10 separate 1-digit numbers). Convert this number to binary using the algorithm shown in class, and show your work.
Here's a hint: start by converting it to binary, and then (working right-to-left) convert each 4-bits of the binary number to hexdecimal.

• Next, using the binary-to-hexadecimal chart to covert each four bits to their respective hexadecimal digit. Write out the complete hexadecimal number. Show all your work.

• Here's my phone number: `0x17041BFE5`.
Convert it to binary, and then to decimal. Show your work.

## ASCII characters

• Encode your first and last names into ASCII codes. Write out the answer as a sequence of 2-digit hexadecimal numbers (no need to show binary, thank goodness!).
You can give this hex code out along with your phone number. :)
• Now open this URL: http://cs-webapps.bu.edu/cs101/decodeThis.py

Decode the message (song title) from binary to hexadecimal to ASCII, showing you work.

## What to Submit

 Save your answers in a MS word document with the file name `username-hw06.doc`, replacing `username` with your BU username.