Sei sulla pagina 1di 2

ELE 107 Computers and Programming I Homework-1 (2010)

1) In a certain number system, the equation x2 -10 x + 47 = 0 is satisfied by x = 6 and x = 9. Determine the radix. 2) Perform the conversion (12AC)15 = (?)12 3) Perform the conversion (744.14)8 = (?)2 4) Perform the conversion (111011.11111)2 = (?)H 5) Perform the conversion (234.567)8 = (?)H 6) Perform the conversion (24.24)8 = (?)4 7) Find the decimal value of the number which is represented by C0200000 IEEE745 floating point standard in Hex.

Number systems

Binary codes
8) A fixed length binary code which encodes the all the cities (ehir) in Turkey is to be designed. What is the minimum number of bits required? With this minimum number of bits, how many bit combinations are invalid codewords? 9) Encode the decimal digits by using the weighted code 6 3 1 1. Is this code self-complementing? 10) The symbols {a, b, c, d, e} with the expected frequencies {0.4, 0.2, 0.2, 0.1, 0.1} are to be encoded. Design a variable length binary code which minimizes the expected code length. What is the expected code length for this code? 11) The symbols {a, b, c, d, e} with the expected frequencies {0.4, 0.2, 0.2, 0.1, 0.1} are to be encoded. Design a fixed length binary code which minimizes the expected code length. What is the expected code length for this code? 12) The symbols {a, b, c, d, e} are to be encoded. Design a binary code which can correct 1 bit-flip error with the minimum code length. 13) Construct a variable length binary prefix code with 5 codewords and the following codeword lengths: {2,2,2,3,3} 14) The 1-out-of-10 code can be used to represent decimal digits as discussed in lecture notes. How many unused codewords are there? How many bit errors can this code detect? How many bit errors can it correct? 15) Consider a binary code with Hamming distance 5. How many bit errors can this code detect? How many bit errors can it correct? 16) Encode your last name using two-dimensional parity format.

Arithmetic operations
17) Perform the operations of the following unsigned integers. a) (EC39)H + (DE)H = (?)H b) (527)8 + (632)8 = (?)8 c) (101101101)2 + (110111)2 = (?)2 d) (100110)2 x (1100)2 = (?)2 e) (110010011010)2 / (1000)2 = (?)2 Remainder = (?)2 18) Perform the subtraction of the following 6-bit signed-magnitude numbers. Express the results in decimal. Determine if there is an overflow. a) (001010) - (101001) = (?) b) (001000) - (010011) = (?) c) (110101) - (100100) = (?) d) (111100) - (101000) = (?)

19) Perform the subtraction of the following 6-bit signed 2s-complement numbers. Express the results in decimal. Determine if there is an overflow. a) (001010) - (101001) = (?) b) (001000) - (010011) = (?) c) (110101) - (100100) = (?) d) (111100) - (101000) = (?) 20) Perform the subtraction of the following 6-bit signed 1s-complement numbers. Express the results in decimal. Determine if there is an overflow. a) (001010) - (101001) = (?) b) (001000) - (010011) = (?) c) (110101) - (100100) = (?) d) (111100) - (101000) = (?) 21) Consider the addition A+B in 6-bit signed 2s-complement binary. If A=(-5)10, list all values of B for which there is no overflow and no end carry. List all values of B for which there is no overflow and there is an end carry. 22) Using signed 2s complement representation, perform the multiplication 11001 x 1010. Express the result in decimal. 23) Apply the following shifts to the 16-bit binary signed number 1101000110011101: LSR, LSL, ROR, ROL, ASR, ASL. Give your answers in hex notation. 24) Perform the following subtractions in 4-digit BCD using the 10s complement method: a) (38)10 - (23)10 = (?)10 in BCD b) (92)10 - (100)10 = (?)10 in BCD