CIS-2010 Homework #1: Number Systems

Due: Friday, January 27, 2017

Read in Chapter 2 of the text. The book is very detailed so I encourage you to skip around. If it looks like something we talked about in class, give the material more attention. Section 2.4 covers floating point numbers.

I strongly recommend that you memorize the bit patterns associated with each hexadecimal digit. Although asking you to memorize something sounds barbaric, it will greatly simplify your life as a computer professional if you can easily visualize the binary representation of a hex number (and vice-versa).

  1. Consider the following 8 bit values (written in hex). Show the two's complement of each value (that is, the negative), also using 8 bits in hex. Note that C expects hex numbers to be prefixed with "0x" which is why I'm doing that here.

            0x3C  0xBB  0x81  0x04
          
  2. What is the largest and smallest possible value of a signed, 24 bit number (using two's complement notation)? Show the values both in decimal and in hex. For full credit, show how you arrived at your answer.

  3. What is the sum of the two 8 bit values 0x52 and 0x6F? Show your answer as a two digit hex number. Is the answer correct? This is tricky because it depends on if you treat the numbers as signed or unsigned. Explain.

  4. Some environments use octal (base 8) rather than hex to display binary numbers compactly. Convert the 8 bit binary number 10010111 into octal (there's a quick way to do it. If you don't see how at first, convert the number the long way and then compare what you get with the original binary). Can you see the advantage of using octal (as opposed to hex)? What disadvantages to it do you see?

  5. Exactly how many normalized single precision floating point numbers are there using IEEE format?


Last Revised: 2017-01-13
© Copyright 2017 by Peter C. Chapin <PChapin@vtc.vsc.edu>