Handout of Quiz One 1.Convert the binary numbers into decimal numbers assuming they represent unsigned integers. All these binary numbers represent non-negative integers, so an-1 an-2 … a1 a0 = an-1 2n-1+ an-22n-2+…+ a1 21 + a0 20 . The range of 8 bits of binary number for unsigned integer is from 0(00000000) to 28-1(11111111), i.e. from 0 to 255. 2.Convert the binary numbers into decimal numbers assuming they represent signed integers. A= an-1 an-2 … a1 a0 (in 2’s complement representation) If A is positive, it should be like A = 0 an-2 … a1 a0 = an-22n-2+…+ a1 21 + a0 20. The sign bit an-1 is 0, the remaining bits represent the magnitude of the number in the same way as in the first problem. The range of 8 bits of binary number for positive integer is from 0(00000000) to 27-1(01111111), i.e. from 0 to 127. If A is negative, it should be like A = 1 an-2 … a1 a0. The sign bit an-1 is 1. The range of 8 bits of binary number for negative integer is from –1 (11111111) to –27(10000000), i.e. from -1 to -128. So the whole range of 8 bits of binary number for signed integer in 2’s complement representation is –128 to 127. In 2’s complement notation, the negation of an integer can be formed using following rules: 1) Take the Boolean complement of each bit of the integer (including the sign bit. 2) Treating the result as an unsigned binary integer, add 1. For example: -18 = 11101110 (2’s complement) bitwise complement 00010001 + 1 ---------------------00010010 =18 3.Perform the binary addition. Note that, in some instances, there is a carry that beyond the end of the word. This is ignored! On any addition, the result may be larger than can be held in the word size being used. This condition is called overflow. When overflow occurs, the ALU must signal this fact so that no attempt is made to use the result. To detect overflow, the following rule is observed. OVERFLOW RULE: If two numbers are added, and they are both positive or both negative, then overflow occurs if and only if the result has the opposite sign.