Monash University > School of Computer Science and Software Engineering > CSE1303 > Part B > Tutorials > Tutorial B1

CSE1303 Computer Science
Semester 3 (summer), 2003
Part B
Tutorial B1

This tute covers material from lectures B01 to B03.

There will not be time in the tutorial to cover all of these questions. Attempt at least the ones marked (*) like this, before the tutorial; these are the ones that will be focussed on during the class. If you have specific questions about unmarked questions, you can ask the tutor about them during the tutorial.


Note: The purpose of tutorials is not simply to give you the answers to these questions! (Solutions will be released in about a week online, so if all you want is the answers, there are easier ways.)


  1. Unsigned binary

    1. Convert the following 8-bit unsigned binary numbers to decimal. Try doing them by hand first, without a calculator, and then check them with a calculator afterwards.

      1. 00000000
      2. 11111111
      3. (*) 10010101
      4. 00000100
    2. Convert the following decimal numbers to 8-bit unsigned binary. Again, try to do without them without a calculator.

      1. 0
      2. 127
      3. 16
      4. (*) 55
  2. Signed binary

    1. Convert the following 8-bit signed binary numbers to decimal. Try both methods for converting, as seen in lectures; one method may be easier than the other for a given number.

      1. 00000000
      2. 11111111
      3. (*) 10010101
      4. (*) 01010000
      5. 11000000
      6. 01000000
    2. Convert the following decimal numbers to 8-bit signed binary.

      1. 127
      2. -1
      3. 60
      4. (*) -15
      5. (*) 30
      6. (*) -30
  3. Hexadecimal and octal

    1. Convert the following 16-bit hexadecimal values to binary, and then to decimal. Assume that the values are signed.

      1. 000F
      2. (*) FFFF
      3. 8000
      4. 7FFF
      5. (*) 03A1
    2. Convert the following 15-bit octal values to binary, and then to decimal. Assume that the values are signed.

      1. 17400
      2. 00100
      3. 00077
      4. 40000
    3. Convert the following decimal values to 16-bit signed binary, and then to hexadecimal and octal.

      1. 31
      2. (*) -1
      3. (*) -15
      4. 16385
  4. (*) 

    Word size

    1. Convert the decimal number 42 into the following:
      1. 8-bit unsigned binary
      2. 16-bit unsigned binary
      3. 32-bit unsigned binary

      What do you notice about your answers?

    2. Convert the decimal number 42 into the following:
      1. 8-bit signed binary
      2. 16-bit signed binary
      3. 32-bit signed binary

      What do you notice about your answers?

    3. Convert the decimal number -42 into the following:
      1. 8-bit signed binary
      2. 16-bit signed binary
      3. 32-bit signed binary

      What do you notice about your answers?

    What does this tell you about converting values between different word sizes?

  5. (*) Write an algorithm which accepts a string of binary digits, and outputs the unsigned integer it represents. For instance, if given 110011, it should output 51.
  6. (*) Write an algorithm which accepts an integer, and outputs an unsigned binary representation of the integer. For instance, if given 123, it should output 01111011. You may assume a fixed word size of 8 bits.
  7. Addition and subtraction

    1. Perform the following binary additions. Assuming the values are in an 8-bit unsigned representation, determine if overflow has occurred in each case. Verify your result by performing the same addition in decimal.
      1. (*) 01100101 + 01011100
      2. 10000001 + 01111111
      3. 00101010 + 00101010
      4. (*) 01000110 + 10001011
      5. 11111111 + 11111111
    2. Perform the following binary additions. Assuming the values are in an 8-bit signed representation, determine if overflow has occurred in each case. Verify your result by performing the same addition in decimal.
      1. (*) 01100101 + 01011100
      2. 10000001 + 01111111
      3. 00101010 + 00101010
      4. (*) 01000110 + 10001011
      5. 11111111 + 11111111
    3. Convert the numbers in the following expressions in 8-bit signed binary, then calculate the result. (Turn subtractions into additions by negating the right hand side using the flip-and-add-1 technique.) Convert your result back to decimal to verify it.
      1. (*) 17 + 16
      2. (*) 17 - 16
      3. 16 - 17
      4. 96 - 62
      5. (*) 62 - 96

[ Top | Home ]

Last modified 2002-07-03