Networks · GCSE · OCR J277 1.3.1, AQA 8525 3.5, Edexcel 1CP2 4.1.4 · about 15 min
NICs, switches, routers and access points; copper, fibre and wireless; Wi-Fi, Ethernet and Bluetooth.
[1 mark]Which device connects different networks together, such as a LAN to the internet?
[1 mark]How does a switch decide where to send a frame?
[1 mark]What does a wireless access point do?
[1 mark]Which is an advantage of fibre optic cable over copper?
[1 mark]Why must Wi-Fi be encrypted?
[1 mark]What does this program print?
table = {}
for port, src in [(1, "AA"), (3, "CC"), (2, "AA")]:
table[src] = port
print(table){'AA': 2, 'CC': 3}AA is learned on port 1, then updated to port 2 when it appears there.
Complete the switch. For each frame in frames, learn which port its source is on. Then print frame to <destination>: port <n> if the destination is known, or frame to <destination>: every port if not. At the end, print learned <n> addresses.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
# (port it came in on, source MAC, destination MAC)
frames = [
(1, "AA-01", "BB-02"),
(2, "BB-02", "AA-01"),
(3, "CC-03", "AA-01"),
(1, "AA-01", "CC-03"),
(4, "DD-04", "BB-02"),
]
table = {}The hint students can ask for: For each frame, first note which port its sender came in on. Then look the destination up in the table: send it to that port if you know it, and to every port if you do not. The count at the end is how many addresses the table holds.
from bugbot import *
connect()
frames = [
(1, "AA-01", "BB-02"),
(2, "BB-02", "AA-01"),
(3, "CC-03", "AA-01"),
(1, "AA-01", "CC-03"),
(4, "DD-04", "BB-02"),
]
table = {}
for port, source, destination in frames:
table[source] = port
if destination in table:
print(f"frame to {destination}: port {table[destination]}")
else:
print(f"frame to {destination}: every port")
print("learned", len(table), "addresses")
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.