CS 321

advertisement

CS 321

Details on the exam itself:

Review for Final

 Mon, Dec 12, 4:00 - 6:00 pm

 Open book, open notes exam. Bring these items with you.

 Bring a calculator if you wish to use one.

 Covers chapters 6 through 11 in the text and the supplementary items that were added. (The added items included topics such as error detection, error correction, the spanning tree algorithm, Nyquist formula, Shannon-Hartley law, Dijkstra's algorithm, digital signal encoding with schemes such as

B8ZS, etc.) The various course projects are not directly included in the exam.

Review Questions:

1) Show the encoding of the bit string 1 1 0 1 0 1 1 1 0 0 1 using Bipolar-AMI.

2) Show the encoding of the bit string 1 1 0 1 0 1 1 1 0 0 1 using Manchester encoding.

3) Show the encoding of the bit string 0 1 0 0 0 0 0 0 0 0 0 1 using the B8ZS scheme.

4) Run the spanning tree algorithm on the following. S indicates a switch, H indicates a host. Assume that all of the switches have the default priority of 32,768. The number inside each switch is an

(abbreviated) MAC address. The numbers on the links are the costs.

H H H H H H H H H H

55

S

100

100

80

S

100

100

12

S

19

19

73

S

100

30

S

19

20

S

100 18

S

100

5) In a communications link with essentially no noise, what is the channel capacity (in bps, Kbps, or

Mbps) if there are 4 signal levels and the bandwidth is 2000 Hz?

6) Suppose that the spectrum of a noisy communications channel runs from 1 to 1.5 MHz, so that the bandwidth is 0.5 MHz. Also suppose that the decibel version of the signal-to-noise ratio, SNR dB

, is

21. What is the channel capacity (in bps, Kbps, or Mbps)?

7) Run Dijkstra's algorithm on the graph below to find the least cost path from a to z. Each link has the same cost in both directions. Show each step (where you circle one new vertex) in a new drawing.

Remember to record both the cost and the path at each vertex. b 4 e

3 5

1

7

1 f a d z

3

4

2 g

2

1

2 c

5 h

8) Use our Hamming code to show the bits used to add error correction to the ASCII letter given by the

7 bits 0 1 1 0 1 1 1. Then flip the next to the last bit of the data and show how this would be located and corrected.

9) Calculate the CRC (also called a FCS) for the data string 1 1 0 1 1 1 0 0 when the divisor is 1 0 0 1 1.

Then suppose that when we transmit the data string followed by the FCS, the first (leftmost) data bit gets flipped. Show how this is detected.

Answers:

1) Show the encoding of the bit string 1 1 0 1 0 1 1 1 0 0 1 using Bipolar-AMI.

1 1 0 1 0 1 1 1 0 0 1

You could also have started at the negative voltage and then alternated between positive and negative for the

1 bits.

2) Show the encoding of the bit string 1 1 0 1 0 1 1 1 0 0 1 using Manchester encoding.

1 1 0 1 0 1 1 1 0 0 1

3) Show the encoding of the bit string 0 1 0 0 0 0 0 0 0 0 0 1 using the B8ZS scheme.

0 1 0

0

0

0

0

0

0

+

0

-

0

0

0

-

0

+

0 1

V V

Refer to your handout on encoding schemes for the details on the encodings used in questions 1, 2, and 3.

4) First we choose the root switch. Since the priority numbers are all the same, it is the one with the lowest MAC address.

H H H H H H H H H H

55

S

100 80

S

100 73

S

100 18

S

100

100 root switch

12

S

19

19

100

30

S

100

19

20

S

Next, we figure out the root port costs and use these to determine the root port for each switch (other than the root switch).

H H H H H H H H H H

55

S

RPC

100

RP

RPC

200

100

100

RPC

200 root switch

80

S

RPC

100

RP

100

12

S

RPC

219

100

19

RPC

200

RP

RPC

19

73

S

RP RPC

RPC

119

100

300

RPC

219

100

RPC

219

RPC

RP

119

100

18

S

RPC

400

30

S

19

RP

RPC

19

38

RPC

19

RPC

38

20

S

Then we find the designated port costs and use these to determine the designated port for each link. All ports on the root switch are automatically designated ports, so don't bother to figure out costs there. Also, since a root port cannot be a designated port, that helps in finding some of the DP's without looking at costs. When the 2 ends of a link have the same DPC's, choose as DP the port on the switch with the lower ID number.

H H H H H H H H H H

55

S

RP

DPC

100

100

100

DP

DPC

100

DP root switch

80

S

RP

100

DP

DP

DPC

100

100

DPC

119

12

S

DP 19

73

S

RP

DPC

119

RP

DP

100

DP

30

S

100 DP

DPC

119

100

RP

18

S

DP

19

RP

DPC

DP

19

DPC

19

19

20

S

Finally, we block each port that is not a DP or RP. Each blocked port is marked with an X below.

H H H H H H H H H H

55

S

X

100 DP 80

S

DP 100

X

73

S

X

100 DP 18

S

RP

RP

100

DP 100

DP root switch

12

S

DP

DP

19

19

RP DP

RP

RP

DP

100

DP

30

S

X

19

20

S

100

RP

5) In a communications link with essentially no noise, what is the channel capacity (in bps, Kbps, or

Mbps) if there are 4 signal levels and the bandwidth is 2000 Hz?

Use the Nyquist formula: C = 2 B log

2

(M), where B is bandwidth and M is the number of signalling levels. Note that log

2

(4) = 2 since 2 is the power you put on the base, 2, to get 4.

C = 2(2000) log

2

(4) = 4000(4) = 16,000 bps = 16 Kbps

6) Suppose that the spectrum of a noisy communications channel runs from 1 to 1.5 MHz, so that the bandwidth is 0.5 MHz. Also suppose that the decibel version of the signal-to-noise ratio, SNR dB

, is

21. What is the channel capacity (in bps, Kbps, or Mbps)?

First find the regular SNR:

SNR dB

= 10 log

10

(SNR)

21 = 10 log

10

10

2.1

= SNR

(SNR)

2.1 = log

10

(SNR)

SNR = 125.89

Then use the Shannon-Hartley law:

C = B log

2

(1 + SNR)

C = 0.5 * 10 6 * log

2

(1 + SNR)

C = 0.5 * 10

6

* log

2

(126.89) = 0.5 * 10

6

* log

10

(126.89) / log

10

(2)

C = 0.5 * 10

6

* 2.1034 / .3010 = 3,494,000 = 3.494 Mbps

7) Run Dijkstra's algorithm on the graph below to find the least cost path from a to z. Each link has the same cost in both directions. Show each step (where you circle one new vertex) in a new drawing.

Remember to record both the cost and the path at each vertex. b

3(a)

4 e

3

5 a

1 d

7

1 f z

3

0 2 2

4 g

1 2

4(a) c

5 h

a

0 b

3(a)

4

7(a,b) e

3

4

4(a) c

1 d

4(a,b)

7

2

1 f g

2

1

5 h

5

3

2 z

At the next step either d or c could be circled: b

3(a)

4

7(a,b) e

3

1 1 f a d

4(a,b)

7

0 2 2

4 g

1

4(a) c

5

11(a,b,d) 3

5 h

2 z

a

0

3

4

4(a) b

3(a)

1

2

4 d

4(a,b)

7(a,b) e

1

7

5

1 f

11(a,b,d) 3

2 g

5(a,c)

2 c

5 h

9(a,c) z a

0

3

4

4(a) b

3(a)

1

2

4 d

4(a,b)

7(a,b) e

1

7

5

1 f

7(a,c,g) 3

2 g

5(a,c)

2 c

5 h

9(a,c) z

At the next stage we can either circle e or f:

a

0

3

4

4(a) b

3(a)

1

2

4 d

4(a,b)

7(a,b) e

1

7

5

1 f

7(a,c,g) 3

2 g

5(a,c)

2 c

5 h

9(a,c) z

12(a,b,e) a

0

3

4

4(a) b

3(a)

1

2

4 d

4(a,b)

7(a,b) e

1

7

5

1 f

7(a,c,g) 3

2 g

5(a,c)

2 c

5 h

9(a,c) z

10(a,c,g,f)

a

0

3

4

4(a) b

3(a)

1

2

4 d

4(a,b)

7(a,b) e

1

7

5

1 f

7(a,c,g) 3

2 g

5(a,c)

2 c

5 h

9(a,c) z

10(a,c,g,f)

There was no change in the cost or path info at z at the above step. In the last picture we would simply circle z, which is trivial, so we leave that out.

Final result: The lowest cost path from a to z that we found was a, c, g, f, z and it had cost 10.

8) Use our Hamming code to show the bits used to add error correction to the ASCII letter given by the

7 bits 0 1 1 0 1 1 1. Then flip the next to the last bit of the data and show how this would be located and corrected. bit # data bits

1

2

3

4

0 check bits

1

1

0

5

6

7

1

1

0

8

9

10

11

1

1

1

1

Thus the string that we transmit would be 1 1 0 0 1 1 0 1 1 1 1.

Flipping the next to the last bit gives 1 1 0 0 1 1 0 1 1 0 1.

The error is detected and corrected as follows:

bit # received bits new check bits

1

2

1

1

0

1

6

7

8

3

4

5

1

0

1

0

0

1

0

1

9

10

11

1

0

1

The fact that the new check bits are not all zeros indicates an error.

Writing the new check bits in reverse order gives the binary number 1010, which is ten in decimal.

Flip bit 10 and the data is corrected! The entire string is now 1 1 0 0 1 1 0 1 1 1 1. Taking out the 4 check bits leaves us with the original data: 0 1 1 0 1 1 1.

9) Calculate the CRC (also called a FCS) for the data string 1 1 0 1 1 1 0 0 when the divisor is 1 0 0 1 1.

Then suppose that when we transmit the data string followed by the FCS, the first (leftmost) data bit gets flipped. Show how this is detected.

A 5-bit divisor yields a 4-bit FCS, so begin by adding 4 zeros to the right end of the data string.

Then divide (modulo 2) by the divisor.

1 1 0 0 0 0 0 0

---------------------------------------

1 0 0 1 1 | 1 1 0 1 1 1 0 0 0 0 0 0

1 0 0 1 1

--------------

1 0 0 0 1 Remember to use exclusive OR, not ordinary subtraction! 1 0 0 1 1

--------------

1 0 0 0 0

1 0 0 1 1

---------------

1 1 0 0 0

As long as the leading 1 matches, the divisor goes into it.

1 0 0 1 1

--------------

1 0 1 1 The 4-bit remainder is the FCS.

The transmitted string is thus 1 1 0 1 1 1 0 0 1 0 1 1, the original data followed by the FCS.

The received string, with the flipped bit, is 0 1 0 1 1 1 0 0 1 0 1 1

We check for error(s) by doing another division:

1 0 1 0 0 1 1

---------------------------------------

1 0 0 1 1 | 0 1 0 1 1 1 0 0 1 0 1 1

1 0 0 1 1

--------------

1 0 0 0 0

1 0 0 1 1

--------------

1 1 1 0 1

1 0 0 1 1

--------------

1 1 1 0 1

1 0 0 1 1

--------------

1 1 1 0

Not all zeros indicates an error!

Download