Number Systems Practice Problems (do enough until you are comfortable) -------------------------------- Section 2.5: 1, 3, 5, 9, 36, 37 (Rosen, 5th edition) Section 3.6: 1, 3, 5, 9, 38, 39 (Rosen, 6th edition) Section 4.2: 1, 3, 7, 11, 40, 41 (Rosen, 7th edition) Here are the actual problems: 1. Convert these integers from decimal notation to binary notation: a) 231 b) 4532 c) 97644 3. Convert these integers from binary notation to decimal notation: a) 1 1111 b) 10 0000 0001 c) 1 0101 0101 d) 110 1001 0001 0000 5/7. Convert these integers from hexadecimal notation to binary notation: a) 80E b) 135AB c) ABBA d) DEFACED 9/11. Convert 1011 0111 1011 from binary to its hexadecimal expansion. 36/38/40. Find the two's complement expansion using bit strings of length six. a) 22 b) 31 c) -7 d) -19 37/39/41. What integer does each of the following two's complement expansion of length five represent? a) 11001 b) 01101 c) 10001 d) 11111 One way to represent a number as a negative value is to use a "two's complement" technique. An algorithm to find the representation is to first represent the number in base 2, then switch the bits (all zeros become one, ones become zeros) and add one. For example 12 base 10 as a 6-bit string: 13 (base 10) = 001101 (base 2) -13 (base 10) = 110011 (twos complement) Alternatively to find the representation for a negative number, for a 6-bit string, 2^5 - |-13| = 32-13 = 19 which is 010011. The first bit indicates negative, so -13 is 110011. This is the technique shown in lecture and is discussed above problem 36 or 38. Problem: Convert 4598 (base 10) to base 8. ------------------------------------------ Figure out the largest power of 8 which divides our number by successively dividing by 8. Stop when it divides zero times. Divide 4598 by 8: 4598/8 = 574 R 6 ==> 4598 = 8*574 + 6 Divide 574 by 8: 574/8 = 71 R 6 ==> 574 = 8*71 + 6 Divide 71 by 8: 71/8 = 8 R 7 ==> 71 = 8*8 + 7 Divide 8 by 8: 8/8 = 1 R 0 ==> 8 = 8*1 + 0 Divide 1 by 8: 1/8 = 0 R 1 ==> 1 = 8*0 + 1 Because I could divide by 8 four times until I got to zero with a remainder of one, this tells you is that 8^4 (8 raised to 4) which equals 4096 goes into 4598 one time. (Dividing by 8^4 = 4096 would tell you the same thing.) Similarly, looking at the remainder, 8^3 goes in once with a remainder of zero, and so on. So, in base 8, the value is 10766.