國立暨南國際大學 97 學年度第一學期小考試卷
科目名稱:計算機網
路 |
開課系所:資訊工程
學系 |
任課教師
|
吳坤熹
|
系所別:
|
年級:
|
學號:
|
姓名:
|
考試日期
|
2008.10.16
|
(考試時間: 14:10-14:30)
- (20%) Spell out the following terminologies in data transmission
and give brief
explanations.
- AM
- RF
- TDM
- UV
- (10%) When using even parity, what is the parity bit for the
character 'P', whose binary representation is 1010000 in ASCII code?
- (10%) Draw a figure to illustrate the multiplex mechanism, and
use an example to explain how a demultiplexor determines the
destination of a data packet.
- (10%) Consider the following figure which shows the wave that
results from phase shift modulation (PSM). Suppose a sine wave
completes a cycle in 2π radians, what are the values of the 2 shifts
indicated by the arrows?
- (10%) Consider the following source code (/usr/src/usr.bin/cksum/sum2.c)
which shows the algorithm to compute the cksum of a file on UNIX.
uint32_t cksum;
int
nr;
u_char *p;
u_char buf[8192];
/*
* Draft 8 POSIX 1003.2:
*
* s = sum of all bytes
* r = s % 2^16 + (s % 2^32) / 2^16
* cksum = (r % 2^16) + r / 2^16
*/
cksum = 0;
while ((nr = read(fd, buf, sizeof(buf))) > 0)
for (p = buf; nr--; ++p)
cksum += *p;
if (nr < 0)
return (1);
cksum = (cksum & 0xffff) + (cksum >> 16);
cksum = (cksum & 0xffff) + (cksum >> 16);
Note that this algorithm compute the summation of every character as an
8-bit integer (instead of every pair of characters as a 16-bit integer
shown in Figure 7.6 in the textbook). Apply this algorithm to a
file containing the following string
H
|
e
|
l
|
l
|
o
|
|
w
|
o
|
r
|
l
|
d
|
.
|
\n
|
48
|
65
|
6C
|
6C
|
6F
|
20
|
77
|
6F
|
72
|
6C
|
64
|
2E
|
0A
|
and predict the final checksum.