CS140 Lab 2 - Exploring number systems

Objective

  • Experiment with number systems.
  • Once you finish these tasks, use this time to get help with HW01 or get started on HW02.

Background

Everything you need for this lab is explained in the lecture slides posted online.

We will also be using some online resources, including the binary number converter at http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html.

Required Tasks

    Binary Number Conversion


    In this section, assume all numbers are regular binary numbers (not two's compliment)

  1. Open the binary number converter, which is available online at http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html.
    This site provides three fields, for binary (base 2) numbers, decimal (base 10) numbers, and hexadecimal (base 16 numbers). Enter a number into any one of the fields, and its value will be given automatically in the other two. Try out some different numbers in each of the fields to familiarize yourself with the tool.

  2. Convert the binary number 11110001 to decimal by hand, showing all steps. Use scrap paper from the recycling bin if needed. Write the final result, i.e. the decimal representation.

  3. Convert decimal number calculated in the previous step back to binary number. Show your work.

  4. Also convert the number 01111101 to hexadecimal (base 16). Remember that to do this, take each 4-bit part of the number, starting with the least significant bits (the right), and figure out what number from 0 to 15 those 4 bits equals. That number or letter will be the next digit (starting from the right) for the hexadecimal number.

  5. Convert "FCB1" from hexadecimal to binary.
  6. Binary Math


  7. Add the binary numbers 01001011 and 00000101
  8. Two's Compliment


  9. Convert the decimal number -5 into an 8-bit two's compliment number.
  10. Use your answer above to help you calculate 32 - 5.

What to Submit

Save your answer document with the file name Lastname-Firstname-lab02.doc,
  • Use Moodle to upload the Word document to the homework repository location. no need to submit this.