The worksheetDownload the PDF
Answers

F10.2 Network hardware and connections

Networks · GCSE · OCR J277 1.3.1, AQA 8525 3.5, Edexcel 1CP2 4.1.4 · about 15 min

BugBotLab

What this lesson is about

NICs, switches, routers and access points; copper, fibre and wireless; Wi-Fi, Ethernet and Bluetooth.

Questions 6 marks in all

  1. [1 mark]Which device connects different networks together, such as a LAN to the internet?

    1. ARouter
    2. BSwitch
    3. CNIC
    4. DWireless access point
    Answer: A. Routers forward packets between networks using IP addresses.
  2. [1 mark]How does a switch decide where to send a frame?

    1. AIt reads the destination MAC address
    2. BIt reads the destination IP address
    3. CIt sends it to every device
    4. DIt asks the router
    Answer: A. Switches work within a LAN, using MAC addresses.
  3. [1 mark]What does a wireless access point do?

    1. ALets devices connect to a wired network by radio
    2. BConnects a LAN to the internet
    3. CGives each device a MAC address
    4. DEncrypts files on a server
    Answer: A. A WAP provides Wi-Fi.
  4. [1 mark]Which is an advantage of fibre optic cable over copper?

    1. AIt carries data further without interference
    2. BIt is cheaper
    3. CIt is easier to bend
    4. DIt carries electrical signals
    Answer: A. Fibre carries light over many kilometres.
  5. [1 mark]Why must Wi-Fi be encrypted?

    1. AIts signals can be picked up by anyone in range
    2. BEncryption makes it faster
    3. CWi-Fi cannot work without it
    4. DIt stops interference
    Answer: A. Radio waves travel beyond the building.
  6. [1 mark]What does this program print?

    table = {}
    for port, src in [(1, "AA"), (3, "CC"), (2, "AA")]:
        table[src] = port
    print(table)
    Answer:
    {'AA': 2, 'CC': 3}

    AA is learned on port 1, then updated to port 2 when it appears there.

The task: a learning switch

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.

A solution

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.