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.)
Unsigned binary
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.
- 00000000
- 11111111
- (*) 10010101
- 00000100
Convert the following decimal numbers to 8-bit unsigned
binary. Again, try to do without them without a calculator.
- 0
- 127
- 16
- (*) 55
Signed binary
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.
- 00000000
- 11111111
- (*) 10010101
- (*) 01010000
- 11000000
- 01000000
Convert the following decimal numbers to 8-bit signed
binary.
- 127
- -1
- 60
- (*) -15
- (*) 30
- (*) -30
Hexadecimal and octal
Convert the following 16-bit hexadecimal values to
binary, and then to decimal. Assume that the values are signed.
- 000F
- (*) FFFF
- 8000
- 7FFF
- (*) 03A1
Convert the following 15-bit octal values to
binary, and then to decimal. Assume that the values are signed.
- 17400
- 00100
- 00077
- 40000
Convert the following decimal values to 16-bit signed
binary, and then to hexadecimal and octal.
- 31
- (*) -1
- (*) -15
- 16385
- (*)
Word size
- Convert the decimal number 42 into the following:
- 8-bit unsigned binary
- 16-bit unsigned binary
- 32-bit unsigned binary
What do you notice about your answers?
- Convert the decimal number 42 into the following:
- 8-bit signed binary
- 16-bit signed binary
- 32-bit signed binary
What do you notice about your answers?
- Convert the decimal number -42 into the following:
- 8-bit signed binary
- 16-bit signed binary
- 32-bit signed binary
What do you notice about your answers?
What does this tell you about converting values between different
word sizes?
- (*) 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.
- (*) 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.
Addition and subtraction
- 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.
- (*) 01100101 + 01011100
- 10000001 + 01111111
- 00101010 + 00101010
- (*) 01000110 + 10001011
- 11111111 + 11111111
- 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.
- (*) 01100101 + 01011100
- 10000001 + 01111111
- 00101010 + 00101010
- (*) 01000110 + 10001011
- 11111111 + 11111111
- 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.
- (*) 17 + 16
- (*) 17 - 16
- 16 - 17
- 96 - 62
- (*) 62 - 96
[ Top |
Home ]
Last modified 2002-07-03