Winter 2014
Assignment # 2
Answers and Solutions
1)
a) Convert 124 to its binary representation: 12410 = 011111002. Positive numbers are always represented by themselves. The answer: 01111100 b) Convert -124 to its binary representation: -12410 = -011111002. Using the second method for negative numbers, invert and then add 1. The answer: 10000100 c) Convert 53 to its binary representation: 5310 = 001101012. Positive numbers are always represented by themselves. The answer: 00110101
2) Yes. The four least significant digits of the ASCII code match the four bits of BCD.
3) Between -7999 and +7999. This is because 16 bits provide four four-bit locations. The lowest (right most) and two middle 4 bits can each store any number from 0 to 9. In the highest (left most) 4 bits, one bit is used for the sign, leaving 3 bits for digits. These 3 bits can accommodate numbers between 0 and 7.
4)
a) 15675 is a positive number and is represented by itself 99999 - 8741 = 91258 b) 15675 +91258 106933 add the carry into the result + 1 6934 c) There was no overflow condition because the numbers have opposite signs and overflow cannot occur. There was a carry condition because in the result, the number of digits exceeded the specified number (i.e., five) and the carry was added to the result. d) 15675 is a positive number and is represented by itself 100000 - 8741 = 91259 e) 15675 +91259 106934 Ignore the carry and the result is: 6934 f) Diminished radix complement arithmetic requires an additional step of adding the carry bit to the result (in 9’s compliment). Radix complement