Uploaded by Vũ Mặc

Answer for the questions in NWC203c Practical Exam Test

advertisement
Solutions to Chapter 3 1.
Suppose the size of an uncompressed text file is 1 megabyte. Solutions
follow questions: [4 marks – 1 mark each for a & b, 2 marks c]
a. How long does it take to download the file over a 32 kilobit/second
modem?
T32k = 8 (1024) (1024) / 32000 = 262.144 seconds
b. How long does it take to take to download the file over a 1
megabit/second modem?
T1M = 8 (1024) (1024) bits / 1x106 bits/sec = 8.38 seconds
c. Suppose data compression is applied to the text file. How much do the
transmission times in parts (a) and (b) change? If we assume a maximum
compression ratio of 1:6, then we have the following times for the 32
kilobit and 1 megabit lines respectively:
T32k = 8 (1024) (1024) / (32000 x 6) = 43.69 sec
T1M = 8 (1024) (1024) / (1x106 x 6) = 1.4 sec
2. A scanner has a resolution of 600 x 600 pixels/square inch. How many
bits are produced by an 8-inch x 10-inch image if scanning uses 8
bits/pixel? 24 bits/pixel? [3 marks – 1 mark for pixels per picture, 1
marks each representation]
Solution:
The number of pixels is 600x600x8x10 = 28.8x106 pixels per picture.
With 8 bits/pixel representation, we have: 28.8x106 x 8 = 230.4 Mbits per
picture.
With 24 bits/pixel representation, we have: 28.8x106 x 24 = 691.2 Mbits
per picture.
6. Suppose a storage device has a capacity of 1 gigabyte. How many 1minute songs can the device hold using conventional CD format? using
MP3 coding? [4 marks – 2 marks each]
Solution:
A stereo CD signal has a bit rate of 1.4 megabits per second, or 84
megabits per minute, which is approximately 10 megabytes per minute.
Therefore a 1 gigabyte storage will hold 1 gigabyte/10 megabyte = 100
songs.
An MP3 signal has a lower bit rate than a CD signal by about a factor of
14, so 1 gigabyte storage will hold about 1400 songs.
7. How many HDTV channels can be transmitted simultaneously over the
optical fiber transmission systems in Table 3.3? [2 marks]
Solution:
Suppose that an optical fiber carries 1600 x 109 bps, and an HDTV
channel is about 38 Mbps, then the fiber can carry about 1600000/38 =
40,000 HDTV channels.
60. Let g(x)=x3 +x+1. Consider the information sequence 1001.
Solutions follow questions:
a. Find the codeword corresponding to the preceding information
sequence. Using polynomial arithmetic we obtain: [3 marks]
1010
-------------------1011| 1001000
| 1011
-------------------01000
1011
-------------------00110
=>Codeword = 1001110
b. Suppose that the codeword has a transmission error in the first bit.
What does the receiver obtain when it does its error checking? [2 marks]
0001
-------------------1011 | 0001110
|
1011
--------------------
101
CRC calculated by Rx = 101 => error
61. Suppose a header consists of four 16-bit words: (11111111 11111111,
11111111 00000000, 11110000 11110000, 11000000 11000000). Find
the Internet checksum for this code. [3 marks]
Solution:
b0 = 11111111 11111111 = 2^16 – 1 = 65535
b1 = 11111111 00000000 = 65280
b2 = 11110000 11110000 = 61680
b3 = 11000000 11000000 = 49344
x = b0 + b1 + b2 + b3 modulo 65535 = 241839 modulo 65535 = 45234
b4 = −x modulo 65535 = 20301
So the Internet checksum = 01001111 01001101
62. Let g1(x) = x + 1 and let g2(x) = x3 + x2 + 1. Consider the
information bits (1,1,0,1,1,0).
a. Find the codeword corresponding to these information bits if g1(x) is
used as the generating polynomial. [2 marks]
100100 11 1101100 11 0011 11 0000 Codeword = 1101100
b. Find the codeword corresponding to these information bits if g2(x) is
used as the generating polynomial. [2 marks]
100011 1101 110110000 1101 01000 1101 1010 1101 111
Codeword = 110110111
c. Can g2(x) detect single errors? double errors? triple errors? If not, give
an example of an error pattern that cannot be detected. [2 marks – 0.5
each]
Single errors can be detected since g2(x) has more than one term.
Double errors cannot be detected even though g2(x) is primitive because
the codeword length exceeds 2n-k-1=7.
An example of such undetectable error is 1000000010.
Triple errors cannot be detected since g2(x) has only three terms.
d. Find the codeword corresponding to these information bits if g(x) =
g1(x) g2(x) is used as the generating polynomial. Comment on the errordetecting capabilities of g(x). [4 marks – 2 marks for the codeword and 2
for the comment]
111101 10111 1101100000 10111 11000 10111 11110 10111 10010
10111 010100 10111 0011
Codeword = 1101100011
The new code can detect all single and all odd errors. It cannot detect
double errors.
It can also detect all bursts of length n – k = 4 or less. All bursts of length
5 are detected except for the burst that equals g(x).
The fraction 1/2^(n-k) = 1/16 of all bursts of length greater than 5 are
detectable.
67. Consider the m = 4 Hamming code.
a. What is n, and what is k for this code? [2 marks]
n = 2^m − 1 = 15; k = n − m = 11
(15,11) Hamming code
b. Find parity check matrix for this code. [2 marks – 0.5 for each]
[000011111111000]
H=[111000011110100]
[011101100110010]
[101110101010001]
c. Give the set of linear equations for computing the check bits in terms
of the information bits. [2 marks – 0.5 for each]
b12 = b5 + b6 + b7 + b8 + b9 + b10 + b11
b13 = b1 + b2 + b3 + b8 + b9 + b10 + b11
b14 = b2 + b3 + b4 + b6 + b7 + b10 + b11
b15 = b1 + b3 + b4 + b5 + b7 + b9 + b11
Ans:
(a) 135.46.63.10
If we consider the first 22 bits of 135.46.63.10 as network address, then we will have 135.46.60.0.
Where 135.46.63.10 = 10000111.00101110.00111111.00001010 in bit pattern.
Take the previous bit pattern and perform bit AND operation with 22 bits of 1's from the left and 10 bits of 0's from
the right and the result will be equal to 10 bits as 0's from the left.
The resultant network address bit parrtern will be: 10000111.00101110.00111100.00000000.
Here the first two octates are still the same (i.e. 135.46.x.x). While the 3rd octates changes to 60 from 63 and the 4th
octate becomes zero (i.e. 135.46.60.0)
The result matches with the 2nd network address in the routing table. Hence the router will forward the packet to
Interface 1.
(b) 135.46.57.14
By following the similar procedure as in the first part, consider the first 22 bits of 135.46.57.14 as network address and
we will have 135.46.56.0 which matched the 1st network address given in the routing table. Hence the router will
forward the packet to Interface 0.
2)
In three-way handshake, there are three messages transmitted by TCP to establish connection between computer.
1. SYN: Client sets the segment sequence number to a random value (say X) and send SYN message to server.
2. SYN-ACK: Server sends SYN-ACK in response to client. Set acknowledgment number to one more than the recieved
sequence number (X+1) and sequence number of the packet to another random value (say Y)
3. ACK- Finally, Client sends an ACK back to the server and set sequence number to the recieved acknowledgment
number (X+1) and acknowledgment number to one more than recieved sequence number (Y+1).
In this process, one must ensure that first sequence number(i.e. X) is always unique.
Now, if station B recieves an old SYN segment from station A, station B will acknowledge request based on old
sequence number and send acknowledgment to station A by adding one more to the recieved old sequence number.
A will find out that B had recieved wrong sequence number. Hence, A will discard the acknowledgment and reject the
connection.
Yes, the connection will get rejected if an old SYN segment from station A arrives at station B followed a bit later by
an old ACK segment from A to a SYN segment from B. Initially when B recieves an old SYN segment from A, B will
send a SYN segment with its own unique sequence number. Now, if B recieves an old ACK from A, B will identify that
the old ACK sequence number doesnot match with the sequence number send by B previously and notify A that the
connection is invalid. That is why the connection will be rejected.
3. A repetition code is an (n,1) code in which the n − 1 parity bits
are repetitions of the information bit. What is the minimum distance
of the code?
The code is a linear code in which: c2 = c1 , c3 = c1 , …, cn = c1 ,
where c1 is the information bit.
This code has two codewords: (0,0,…,0) and (1,1,…,1) so the minimum
distance is dmin = n.
Flow Control: ARQ
4. In Stop-and-Wait ARQ why should the receiver always send an
acknowledgment message each time it receives a frame with the wrong
sequence number?
Solution:
The sender cannot send the next frame until it has received the ACK
for the last frame so, if the receiver gets a frame with the wrong
sequence it has to be a retransmission of the previous frame received.
This means that the ACK was lost so the receiver has to ACK again to
indicate the sender that it has received the frame.
5. Discuss the factors that should be considered in deciding whether
an ARQ protocol should act on a frame in which errors are detected.
Solution:
If a frame is in error, then all of the information contained in it
is unreliable. Hence any action taken as a result of receiving an
erroneous frame should not use the information inside the frame. A
viable option when an erroneous frame is received is to do nothing,
and instead to rely on a timeout mechanism to initiate retransmission.
However error recovery will be faster if we use a NACK message to
prompt the sender to retransmit. The inherent tradeoff is between the
bandwidth consumed by the NACK message and the faster recovery.
6. A 64-kilobyte message is to be transmitted from the source to the
destination. The network limits packets to a maximum size of two
kilobytes, and each packet has a 32-byte header. The transmission
lines in the network have a bit error rate of 10−6 , and Stop-andWait ARQ is used in each transmission line. How long does it take on
the average to get the message from the source to the destination?
Assume that the signal propagates at a speed of 2 x 105 km/second.
Solution:
Message Size 65536 bytes
Max Packet Size 2048 bytes
Packet Header 32 bytes
Available for info 2016 bytes
# of packets needed 32.51 packets
Total 33 packets
bit error rate 1E-06
bits/packet 16384
Probability of error in packet 0.016251 1 – (1– bit_error_rate) ^
(bits/packet)
Propagation speed 2E+05 Km/s
Distance 1000 Km
Bandwidth 1.5 Mb/s
We assume that the ACK error, the ACK time, and processing time are
negligible.
Tprop = distance / propagation speed = 0.0050 s
Tf = packet size / bandwidth = 0.0109 s
T0 = Tprop + Tf = 0.0159 s
Pf = probability of error in packet = 0.016251
E[Ttotal]= T0/ (1 - Pf) = 0.0162
The time to send every packet over two links is then the initial
packet transmission time + 33 additional packet times, and so the
average time is E[Ttotal] * 34 = 0.522 seconds.
7. A telephone modem is used to connect a personal computer to a host
computer. The speed of the modem is 56 kbps and the one-way
propagation delay is 100 ms.
Solutions follow questions:
a. Find the efficiency for Stop-and-Wait ARQ if the frame size is 256
bytes; 512 bytes. Assume a bit error rate of 10−4 .
First we have the following:
Pf = 1 – (1 – 10–4)nf
nf = 256 × 8 = 2048 or nf = 512 × 8 = 4096 tprop = 100 ms
no = 0 na = 64 bits tproc = 0
Using the results in Equation 5.4,
= 0.125 (nf = 2048)
= 0.177 (nf = 4096)
b. Find the efficiency of Go-Back-N if three-bit sequence numbering
is used with frame sizes of 256 bytes; 512 bytes. Assume a bit error
rate of 10−4 .
Given that WS = 7, we can calculate that the window size is:
Nf*Ws/R=256ms
Since this is greater than the round trip propagation delay, we can
calculate the efficiency by using the results in Equation 5.8.
Download