Part 2,Number Systems Questions This study guide is provided as an aid in helping you to study for the ECE Department s 18-240, Fundamentals of Computer Engineering. The guide is a collection of previous test and homework questions for which solutions were handed out. Thus some of these questions are indicative of questions you might find on a test. Since answers are provided for these questions, you can use this guide to get extra practice on course-related problems. The guide consists of several files covering different topics. Please don t infer that this guide is all inclusive in terms of course topics or possible test questions. Further, the topics are distributed among several files. Please don t infer that the first test corresponds to file number one. It probably doesn t. Check with the course announcements regarding topics to be covered on a test. Oh yes, you might find some errors. Please let us know so that we can fix them for others. This file was produced using FrameMaker and saved in PDF format for Adobe Acrobat readers. Acrobat Exchange was used to include hot links between questions and answers. 2.1 Signed Numbers Add the two 4-bit numbers shown below, assuming they are in the representation listed at the top of each box. Note: the numbers in each box are not all the same. Show the bits of the resulting sum, and circle each final answer. Write the decimal value of the final 4-bit sum in the ( If the sum cannot be represented as a 4-bit result, say so. In each of the boxes below: ) 10 space. perform the binary addition assuming the numbers are in the number representation shown provide the result in binary show the result in base 10, and 61/65
tell us if there was an overflow (or underflow). Two s comp: One s comp: Signed magnitude: Unsigned binary: 2.2 Signed Numbers Add the two 4-bit numbers shown below, assuming they are in the representation listed at the top of the box. Note: the numbers in each box are not all the same. Show the bits of the resulting sum. Write the decimal value of the final 4-bit sum in the ( ) 10 space. If the sum cannot be represented as a 4-bit result, say so. 62/65
Interpret as Unsigned Binary 1101 + 0101 Interpret as Signed Magnitude 1110 + 0010 Interpret as 2s Complement 1101 + 0101 Interpret as 1s Complement 1100 + 0100 63/65
2.1 Signed Numbers a. Two s Complement Answers (6) (-6) 10000 (0) In a 2 s complement number scheme, we are taught to ignore the carry. Therefore, we ignore the 1, and the final result of our addition is 0000, which is equal to 0 in base 10. To check ourselves, in 2 s complement form, the number corresponds to 6 in base 10. The number corresponds to -6 in base 10. The addition of 6 and -6 gives us 0. There is no overflow in this example. b. One s Complement (6) (-5) 10000 1 0001 (1) With a 1 s complement number scheme, we remove the carry, then add it back to the result. Our result, 0001, is equivalent to the number 1 in base 10. There is no overflow. c. Signed Magnitude In a 4 bit, signed magnitude number scheme, numbers with a 1 as the 4th bit, are negative. Therefore we are performing an addition between the numbers (+110) and (-010). Our addition now becomes a simple subtraction. +110 (6) -010 (-2) 100 (4) The result is 0100 in signed magnitude (don t forget to include the sign bit back), which equals 4 in base 10. There is no overflow here. d. Unsigned Binary (6) (10) 10000 (16) 64/65
For unsigned binary, we just add the two binary numbers as is. Our result, 10000, or 16 in base 10, is a 5-bit number, therefore we cannot represent this sum in a 4-bit result. There is overflow with the 4-bit result. 2.2 Signed Numbers a. Interpret as Unsigned Binary 1101 (13) 0101 (5) 10010 (18) For unsigned binary, we just add the two binary numbers as is. Our result, 10010, or 18 in base 10, is a 5-bit number, therefore we cannot represent this sum in a 4-bit result. b. Interpret as Signed Magnitude In a 4 bit, signed magnitude number scheme, numbers with a 1 as the 4th bit, are negative. Therefore we are performing an addition between the numbers (-110) and (+010). Our addition now becomes a simple subtraction. -110 (-6) +010 (2) 100 (-4) The result is 1100 in signed magnitude (don t forget to include the sign bit back), which equals -4 in base 10. c. Interpret as 2 s Complement 1101 (-3) 0101 (5) 10010 (2) In a 2 s complement number scheme, we ignore the carry. Therefore, we ignore the 1, and the final result of our addition is 0010, which is equal to 2in base 10. d. Interpret as 1 s Complement 1100 (-3) 0100 (4) 10000 1 0001 (1) With a 1 s complement number scheme, we remove the carry, then add it back to the result. Our result, 0001, corresponds to 1 in base 10. 65/65