第一 二章作业题(参考答案) 联系客服

发布时间 : 星期六 文章第一 二章作业题(参考答案)更新完毕开始阅读1f1e7a1a5022aaea988f0f71

2.4 What are the octal values of the four 8-bit bytes in the 32-bit number with octal representation 341250167328?

34125016732 8 = 11 100 001 010 101 000 001 110 111 011 010 2

1st Byte = 11100001 2 = 341 8 2nd Byte = 01010100 2 = 124 8 3rd Byte = 00011101 2 = 35 8 4th Byte = 11011010 2 = 332 8

2.5 Convert the following numbers into decimal: (1) 10100.11012=?10 (2) 15C.3816=?10

10100.1101 2 = 20.8125 10 15C.38 16 = 348.21875 10

2.6 Perform the following number system conversions: (1) 2385110=?16 (2) 125.1710=?2

23851 10 = 5D2B 16 125.17 10 = 1111101.0010110 2(应保留7位二进制小数)

2.7 Add the following pairs of binary numbers, showing all carries:

110101 ?11010

Carry:1100000

110101

?11010Sum: 1001111

2.8 Repeat Drill 2.7 using subtraction instead of addition, and showing borrows instead of carries. 110101

?11010

Borrow: 110100

110101

?11010Diff: 011011

2.9 Add the following pairs of octal numbers: 57734

?1066

Carry: 11110

57734

?1066Sum: 61022

2.10 Add the following pairs of hexadecimal numbers: F35B

?27E6

Carry: 11110

F35B

?27E6Sum: 11B41

2.11 Write the 8-bit signed-magnitude, two’s-complement, and ones’-complement representations for each of these decimal numbers: ?25, ?42.

Decimal:

?25

?42

Signed-magnitude: 00011001 10101010 Two’s-complement: 00011001 11010110 Ones’-complement: 00011001 11010101

2.12 Indicate whether or not overflow occurs when adding the following 8-bit two’s-complement numbers:

1011111101011101(1) (2)

?11011111?00110001 10011110

2.13 Each of the following arithmetic operations is correct in at least one number system. Determine possible

radices of the numbers in each operation.

(1) 41/3=13 (2) 23+44+14+32=223

(1) r = 8 (2) r = 5

2.14 The first expedition to Mars found only the ruins of a civilization. From the artifacts and pictures, the explorers deduced that the creatures who produced this civilization were four-legged beings with a tentacle that branched out at the end with a number of grasping “fingers”. After much study, the explorers were able to translate Martian mathematics. They found the following equation:

5x2?50x?125?0

10001110

Not overflow Overflow

with the indicated solutions x = 5 and x = 8. The value x = 5 seemed legitimate enough, but x = 8 required some explanation. Then the explorers reflected on the way in which Earth’s number system developed, and found evidence that the Martian system had a similar history. How many fingers would you say the Martians had ? (From The Bent of Tau Beta Pi, February, 1956)

【注】此题解法有多种,以下方法无需求解一元二次方程。

假设火星人的手指个数为 r,即使用 r 进制。 原r进制的方程为

?5x2?50x?125?0?r → ?5x250x125???0555?r

r进制方程转为十进制表示为:

?5r1?0r2?2r?5x?x??0552r2?2r?5?10 → ?x?rx??052?10

由题目已知的r进制方程的两个解可得,r进制方程转为十进制表示为:∴

?(x?5)(x?8)?0?r → ?x2?(5?8)x?5?8?0?r

132?2?13?55?x2?13x?40?0?10

r2?2r?55r?(5?8)r?1310 代入

??10???10?4010

满足方程

?x2?13x?40?0?10

2.15 Your pointy-haired boss says every code word has to contain at least one “zero”, because it “saves power”. So how many different 3-bit binary state encodings are possible for the traffic-light controller of Table X2-1?

Table X2-1 States in a traffic-light controller

N-S Green ON Off Off Off Off Off N-S Yellow Off ON Off Off Off Off Lights N-S E-W Red Green Off Off Off ON ON ON ON Off Off ON Off Off E-W Yellow Off Off Off Off ON Off E-W Red ON ON ON Off Off ON Code Word 000 001 010 100 101 110 State N-S go N-S wait N-S delay E-W go E-W wait E-W delay

由于秃头老板为了省电,要求码字至少包含一个0,因此,在3位二进制编码中可用的码字为7个(000 ~ 110),而交通灯控制状态有6个,即从7个码字中选择6个进行编码,共有 7×6×5×4×3×2 = 5040 种编码方案。

2.16 List all of the “bad” boundaries in the mechanical encoding disk of Figure X2-1,where an incorrect position may be sensed.

111000001001101100011010110

Figure X2-1 A mechanical encoding disk using a 3-bit binary code

当相邻两个码字中有1个以上的位数发生变化,则其边界就是“坏”边界。

所有坏边界是: 001 ~ 010边界、 011 ~ 100边界、 101 ~ 110边界、 111 ~ 000边界 。

2.17 On-board altitude transponders on commercial and private aircraft use Gray code to encode the altitude readings that are transmitted to air traffic controllers. Why?

首先,海拔高度是连续变化的。其次,格雷码的相邻码字只有一位发生变化,在两个相邻码字的边界处不会发生错误性的突变,也就保证了在海拔高度的连续变化中其数值不会发生错误性的突变。

2.18 An incandescent light bulb is stressed every time it is turned on, so in some applications the lifetime of the bulb is limited by the number of on/off cycles rather than the total time it is illuminated. Use your knowledge of codes to suggest a way to double the lifetime of 3-way bulbs in such applications.

【注】所谓3-way灯泡,即有“低-中-高”三种亮度档位,内部有两根灯丝,如 50-100-150W 3-way bulb,内部有50W和100W两根灯丝,可分别实现50W、100W、150W三种功率。

由于灯泡档位突变会缩短使用寿命,为此,应采用格雷码来对其档位开关进行编码,如下:

编码 00 01 11 10

Options

2.19 Suppose a 4n-bit number B is represented by an n-digit hexadecimal number H. Prove that the two’s complement of B is represented by the 16’s complement of H. Make and prove true a similar statement for octal representation.

The modul of 4n-bit number B is (24n )10. The modul of n-digit hexadecimal number H is (16n )10 = (24n )10. So, they have a same modul M.

∵B = H ∴ B 2’s = M -B = M –H = H 16’s

For octal, suppose a 3n-bit number B is represented by an n-digit octal number O.

The modul of 3n-bit number B is (23n )10 . The modul of n-digit octal number O is (8n )10 = (23n )10 . So, they have a same modul M as well. ∵B = O ∴ B 2’s = M -B = M -O= O 8’s

2.20 Prove that a two’s-complement number can be multiplied by 2 by shifting it one bit position to the left, with a carry of 0 into the least significant bit position and disregarding any carry out of the most significant bit position, assuming no overflow. State the rule for detecting overflow.

设B2’S = bn-1 bn-2 …b1 b0 则 B2’S×2 = B2’S + B2’S

= bn-1 bn-2 …b1 b0 + bn-1 bn-2 …b1 b0

档位 OFF L (50W) M (100W) H (50W+100W)

Sn-1 Sn-2 …S1 S0

若bi为0,则 若bi为1,则 0 + 0

+

1 1

0 1 0

如上,可以假设0为“空位”,当bi为1时,相当于该“1”左移一位,并在原处留下“空位”。 因此,B2’S×2,相当于所有的1左移一位,“空位”0也随之左移一位,且最低位留下了新的“空位”。

检测溢出的原则是:如果符号位发生改变,则可以认为发生了溢出。