EGRE 254 - Virginia Commonwealth University



EGRE 254

Homework #2

Due

February 2, 2008

Solutions

1. Work problem 2.17. You must show algebraically how you got the answer! Solution: Unless indicated otherwise base 10 is used. The problem can be expressed as shown below.

[pic]

We are given two values of x, 5 and 8, which satisfy this equation. Substituting 5 into the equation yields:

[pic]

Substituting 8 into the equation yields:

[pic]

We see that b = 13 satisfies both equations; therefore, the Martians have 13 fingers.

2. Convert 5678.987610 to base 16. Give the result to 5 digits past the radix point.

Solution: Break the problem into integer and fractional parts, and treat each part separately.

[pic][pic][pic]

[pic] [pic]

Combining the integer and fractional parts give 5678.987610 ( 162E.FCD3516

3. Convert 5678.987610 to base 8. Give the result to 6 digits past the radix point.

[pic] [pic][pic] Therefore, 567810 = 130568

8 X .9876 = 7.9008, I = 7

8 X .9008 = 7.2064, I = 7

8 X .2064 = 1.6512, I = 1

8 X .6512 = 5.2096, I = 5

8 X .2096 = 1.6768, I = 1

8 X .6768 = 5.4144, I = 5 Therefore, .986710 = .771515….8

Combining the integer and fractional parts give 5678.987610 ( 13057.7715158

4. Convert your result in 2 to binary (base 2).

162E.FCD3516 = 0001,0110,0010,1110.1111,1100,1101,0011,01012

5. Convert your result in 3 to binary.

13057.7715158 = 001,011,000,101,110.111,111,001,101,001,1012

6. Convert your result in 2 to octal (base 8). Compare your answer with the value obtained in problem 3.

The results are identical.

7. Convert your result in 5 to hexadecimal (base 16). Compare your answer with the value given in 2.

001,0110,0010,1110.1111,1100,1101,0011,01002 = 162E.FCD3416

The least significant digit is different because the result in 2 was only computed to six decimal places.

8. Convert the 16-bit hexadecimal value ABCD16 to the 16-bit Gray code. (a) Give the Gray code result in binary. (b). Then express the result in hexadecimal.

ABCD16 = 1010,1011,1100,11012

1010101111001101

( 01010101111001101

(a)1111111000101011 = (b)FE2B16

9. Convert 567810 to a 16-bit BCD value. Express the BCD result in:

a. binary.

0101,0110,0111,1000

b. hexadecimal.

567816

10. Problem 2.7(d).

1 1 0 0 0 0 0

1110010

+ 1101101

11011111

11. Problem 2.11 for +79 and –49. The answer for +18 is shown below. Put your answer in the same form.

|Number in decimal |+18 |+79 |-49 |

|Number in Binary |+ 10010 |+1001111 |- 110001 |

|Stored in Sign-magnitude |00010010 |01001111 |10110001 |

|Stored in Two’s complement |00010010 |01001111 |11001111 |

|Stored in 0ne’s complement |00010010 |01001111 |11001110 |

12. Work problem 2.12 (b), (c), and (d). Check your work by converting each value to a signed decimal value and doing the arithmetic in decimal. Indicate if overflow occurs.

Example using part (a)

11010100 = 001011002 = - 44

+10101011 = 010101012 = - 85

101111111 = 127 -129

Overflow occurred (not because of the carry from the most significant bit, but because we added two negative numbers and obtained a positive result); thus, the answer is wrong.

|(b) | 10111001 |(c) | 01011101 |(d) | 00100110 |

| |+11010110 | |+00100001 | |+01011010 |

| |110001111 | | 01111110 | | 10000000 |

| |No Overflow | |No overflow | |Overflow |

13. The ASCII character set can be encoded using 7-bit code words. However, 8-bit codes words are typically used where the 8th bit is either set to 0 or used for parity.

a). If the 8th bit is set to 0, what is the minimum Hamming distance between the 8-bit ASCII character code words? HD = 1

For example consider the characters “A” and “C”, the ASCII of “A” is 4116 = 0100 00012, and the ASCII of “C” is 4316 = 0100 00112. Thus, since the code for “A” and “C” differ in only one bit the Hamming distance between “A” and “C” is 1.

b). If the 8th bit is used for parity, what is the minimum Hamming distance between the 8-bit ASCII character code words? HD = 2. Considering the above example of “A” and “C” and using even parity (i.e. the parity is chosen so that the number of 1’s in a code word is even) the binary code with even parity for “A” and “C” is shown below.

A – 0100 0001

C – 1100 0011

Now the code for “A” and “C” differ by two bit and indeed with parity no two code words will differ by less than two bits; therefore, with parity the minimum Hamming distance is 2.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download