ENEE 244 (01**). Spring 2006

Homework 1 solutions

1.  Convert the following binary numbers to decimal: (a) 1101; (b) 10111001.

(a) 1101 = 1.23 + 1.22 + 0.21 + 1.20 = 8 + 4 + 0 + 1 = (13)10.

(b) 10111001 = 1 + 8 + 16 + 32 + 128 (written in backwards order) = 185.

2.  Convert the following decimal numbers to binary: (a) 23; (b) 498.

(a) By repeated division by radix 2:

23
11    1
5    1
2    1
1    0
0    1

Answer from above, bottom to top: (10111)2 .

(b) By repeated division, as above (steps not shown) = (111110010)2.

3. Convert the following numbers to decimal: (a) (34)7; (b) (76)8.

(a) (34)7= 3.71 + 4.70 = 21 + 4 = 25.

(b) (76)8 = 7.81 + 6.80 = 56 + 6 = 62.

4. Convert (a) (47)10 to radix 8; (b) (63)10 to base 16.

(a) By repeated division by radix 8:

47
5    7
0    5

Answer from above, bottom to top: (57)8.

(b) By repeated division by radix 16:

63
3    F
0    3

Answer from above, bottom to top: (3F)16     /* Also written as 0x3F */

5. Convert (a) (11010110111)2 to hexadecimal; (b) (4532)8 to binary.

(a) Grouping into groups of 4 bits from right: 0x6B7.

(b) Converting each digit separately: (100 101 011 010)2.

6. Convert the following decimal numbers to binary: (a) 0.75; (b) 5.3.

(a) 0.75 X 2 = 1 + 0.5
0.50 X 2 = 1 + 0.0

Answer from above, top to bottom: (0.11)2.

(b) 5 is 101.

0.3 X 2 = 0 + 0.6
0.6 X 2 = 1 + 0.2
0.2 X 2 = 0 + 0.4
0.4 X 2 = 0 + 0.8
0.8 X 2 = 1 + 0.6    /* We stop here since 0.6 repeats */

Answer: (101.01001)2 /* Last four digits of fraction repeat forever */

7. Add the binary numbers (a) 0101 and 1001; (b) 01101.01 and 1001011.101.

(a)    01101
+10  01
11 10

(b)       101111101.01
+10  0  1  0  11.101
10 1  1  0  00.111

8. Do the following subtractions: (a) 1100 - 1001; (b) 101101 - 11010.

(a)   Answer: 0011.  (See book for workings for similar problems).

9. Multiply: 10100×101.

10100
101
10100
00000
10100

10.  Find the diminished radix complement of (a) (76)8; (b) (10010)2.

(a) 7's complement = 77-76 = (01)8.

(b) 1's complement = (01101)2.  /* Obtained by switching all the bits */

11.  Find the radix complement of (445)10.

9's complement = 999-445 = 554.

Þ 10's  complement = 554 + 1 = 555.

12.  Represent the following binary numbers in an 8-bit signed-magnitude scheme: (a) +1001; (b) -1011.

(a) 00001001.

(b) 10001011.    /* First bit is sign bit */

13.  A 6-bit computer uses the signed 2's complement representation.  It adds 10011 + 11101.  State the answer.  How is the overflow detected?   /* Hint: In such a representation, negative numbers are stored as 2's complement of their absolute value. Positive numbers are represented just like in the sign-magnitude scheme. */

10111010111
+ 0  1  1  1  01
1  1  0  0  00

Since carry into sign bit (1) ≠ carry out of sign bit (0) Þ Overflow is detected.

14.  An 8-bit computer uses the signed 2's complement representation.  Show how this computer performs (a) 111010 - 1100; (b) 101 - 10110.

(a) 111010 - 1100 = 111010 + (-1100)
-1100 = 2's complement of 00001100 = 11110011+ 1= 11110100
Expression = 00111010 + 11110100 = 100101110.
Discarding carry out of sign bit (left most digit) = 00101110.  /*Answer */
In doing this calculation, carry into sign bit (1) = carry out of sign bit (1)