CS 111: Introduction to Computer Science

Data representation

Hand in via Moodle (as pdf, docx, txt, jpg, png...)

Feel free to work with classmates on this assignment, but write up your own solutions.

  1. For each of the following positive binary integers, what are the decimal (base ten) and hexadecimal (base sixteen) equivalents?
    1. 10111
    2. 10101011
    3. 1
  2. Add the binary integers 10011 to 1011 without converting to decimal. Show your work (in particular, show where you get carries, and where you don't). You can check your work by translating the numbers into decimal, but I want to see you do the usual gradeschool addition algorithm in base 2 instead of base ten.
  3. The number 1.398 is equal to 1 + 3/10 + 9/100 + 8/1000. If we move to binary, and use a "binary point" instead of a decimal point, what will the following numbers equal? That is, what are the base ten equivalents of the following binary numbers?
    1. 0.11
    2. 110.011
  4. When you multiply a decimal number by 10, you shift the decimal point to the right one place. How can you shift a binary point to the right?
  5. Rewrite the following base-ten numbers as 8-bit two's complement integers: -1, 17, -17, and -107.
  6. What does the bit pattern 01000101 represent if you interpret it as an 8-bit two's complement integer? What if you interpret it as a character using ASCII?
  7. What is the base ten equivalent of the hexadecimal number BAD?
  8. What is the hexadecimal equivalent of the base ten number 999?
  9. Some questions about Unicode.
    1. What is the Unicode value for the lower-case beta in the Greek alphabet?
    2. What character is represented by the Unicode code point 0x2663? (That's hexadecimal 2663, also known as decimal 9827. The "0x" as a marker of hexadecimal numbers is yet another programming detail that came from the early days of Unix and C.)
    3. Name two languages that you have never heard of before whose alphabets are included in Unicode.
    4. What is Tengwar? What is its status with respect to Unicode?

Start early, ask questions, and have fun!