🎓 BookMCQ
← Back to 17. Connecting Devices and Virtual LANs

📝 Link Layer Switches learning and forwarding (26 MCQs)

Layer 2 Switching Through MAC Address Learning

A data-link layer switch connects devices within a LAN and forwards Ethernet frames according to destination MAC addresses. It learns which devices are reachable through each port by recording the source MAC address of incoming frames. The resulting MAC address table allows the switch to send known unicast traffic only toward the required port instead of repeating every frame everywhere.

Building the MAC Address Table from Source Frames

When a frame arrives, the switch reads its source MAC address and associates that address with the receiving port and VLAN. It updates the entry when a device moves. The switch then checks the destination address: a known unicast is forwarded selectively, while an unknown unicast is flooded within the relevant VLAN on the same switch.

Filtering, Forwarding and Flooding Frame Traffic

For a known destination MAC address, the switch sends the frame through the mapped egress port. If the destination is on the same incoming port, it filters the frame rather than forwarding it. Broadcast frames and unknown unicasts are flooded to eligible ports in the same VLAN, excluding the incoming port.

Learning Two Computers on Different Switch Ports

A frame from computer A enters port 3 with source MAC address AA-AA-AA-AA-AA-AA. The switch records that address against port 3. When computer B replies, its source address is learned on port 7. Later frames between the computers can be forwarded directly between those ports without flooding other eligible ports.

Switching and the Separation of Collision Domains

Each full-duplex switch port provides a separate collision domain, allowing connected devices to transmit and receive simultaneously without Ethernet collisions on that link. However, a conventional Layer 2 switch does not automatically separate broadcast domains; ports in the same VLAN share broadcast traffic. VLAN configuration creates separate logical Layer 2 broadcast domains.

Misconceptions About MAC Learning and Flooding

'A switch learns the destination address from an outgoing frame' is incorrect because it learns source addresses on ingress. 'Unknown unicast traffic is always dropped' is incorrect because it is normally flooded within its VLAN. 'A Layer 2 switch separates all broadcasts' is incorrect because VLAN boundaries, not ordinary port switching, separate broadcast domains.

Tracing Switch Tables and Frame Forwarding

For exam problems, update the MAC table from each frame's source address and incoming port before deciding the destination action. Distinguish known unicast forwarding, same-port filtering, and flooding of broadcast or unknown unicast frames. Track VLAN membership as well, since learning and forwarding are scoped to the relevant VLAN on the same switch.

MAC Learning and Frame Forwarding Terms

  • MAC table - Maps addresses to ports.
  • Learning - Recording source MAC addresses on ingress.
  • Forwarding - Sending frames through selected ports.
  • Filtering - Suppressing frames on the receiving port.
  • Flooding - Sending frames to eligible VLAN ports.
  • VLAN - Defines a logical broadcast domain.
8
Easy
12
Medium
6
Hard

📝 All Link Layer Switches learning and forwarding MCQs

Q1. What layer of the OSI model does a link-layer switch operate in?

A.Physical
B.Data Link ✅
C.Network
D.Transport
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: A link‑layer switch functions at the Data Link layer (Layer 2) of the OSI model. It examines MAC addresses, learns source addresses, and forwards frames based on its MAC address table, distinguishing it from devices that operate at the Physical or Network layers.

Q2. Compare a broadcast domain to a collision domain. Which statement is accurate?

A.A broadcast domain groups devices that receive the same broadcast traffic, while a collision domain groups devices that can interfere with each other's frames.
B.A broadcast domain is the same as a collision domain; both refer to the set of devices that share a single MAC address space. ✅
C.A broadcast domain limits the spread of broadcast frames, whereas a collision domain limits where frames may collide.
D.Broadcast domains and collision domains are unrelated concepts and have no impact on network traffic.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: A broadcast domain defines the set of ports that receive broadcast frames, while a collision domain defines the set of ports where frames can collide. Switches create separate collision domains per port, but a single broadcast domain can span multiple ports unless VLANs partition it.

Q3. If a switch receives a frame with an unknown destination MAC address, what action does it take?

A.Flood the frame out all ports except the inbound port ✅
B.Drop the frame silently
C.Forward the frame to the default router
D.Send an ARP request for the unknown MAC
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: When the destination MAC address is not in the switch's forwarding table, the switch treats the frame as unknown and floods it out every other port in the same VLAN. This ensures delivery while the MAC address table learns the source location for future frames.

Q4. When two switches are connected without spanning‑tree, loops cause broadcast storms. What is the immediate effect on MAC address tables?

A.Entries become static and never age out
B.Entries age out faster than normal
C.Tables become corrupted and contain duplicate entries ✅
D.No effect on the tables
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: A loop creates continuous broadcast traffic, causing the switches to receive the same frames repeatedly. The rapid influx of frames can overwrite or duplicate entries in the MAC address table, leading to inconsistency and eventual corruption of the forwarding database.

Q5. Suppose a VLAN is configured on a switch but trunking is disabled on the connecting switch. What will happen to traffic between the VLANs?

A.It will be forwarded normally
B.It will be dropped at the link ✅
C.It will be broadcast to all ports
D.It will be encapsulated in a different protocol
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Without an active trunk, the VLAN tag cannot be carried across the link. Consequently, frames from the VLAN cannot be recognized on the opposite side and are discarded, preventing inter‑VLAN communication until trunking is enabled on both ends.

Q6. If a switch implements port security limiting MAC addresses to 2 per port, and three devices connect to the same port, what is the likely result after the third device attempts communication?

A.The switch will shut down the port ✅
B.The switch will drop frames from the third MAC only
C.The switch will replace the oldest MAC entry with the new one
D.The switch will allow all three devices to communicate
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Port‑security violations trigger the configured security action. When the maximum number of allowed MAC addresses is exceeded, the switch typically places the port into an error‑disable state, effectively shutting it down until an administrator re‑enables it.

Q7. Compare a hub and a switch in terms of collision domains. Which statement is true?

A.Hub creates multiple collision domains, switch creates a single one
B.Hub creates a single collision domain, switch creates multiple collision domains ✅
C.Both devices create a single collision domain
D.Both devices create multiple collision domains
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: A hub repeats incoming signals to all ports, placing every attached device in the same collision domain. A switch, however, provides a dedicated collision domain per port, isolating traffic and preventing collisions between separate ports.

Q8. Which of the following best differentiates a managed switch from an unmanaged switch?

A.Managed switches have higher port counts
B.Managed switches support PoE while unmanaged do not
C.Managed switches provide a configuration interface and monitoring capabilities ✅
D.Managed switches operate at Layer 3 only
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Managed switches include a management plane that allows administrators to configure VLANs, set security policies, monitor traffic, and perform diagnostics via CLI, web GUI, or SNMP, whereas unmanaged switches lack any such configurability and operate purely as plug‑and‑play devices.

Q9. When evaluating network performance, which factor is most directly improved by replacing a hub with a switch?

A.Overall latency of the network
B.Aggregate bandwidth available to each host
C.Ability to broadcast traffic network‑wide
D.Probability of collisions on the segment ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: A hub shares a single collision domain among all ports, so every transmission risks colliding. Replacing it with a switch isolates each port into its own collision domain, dramatically reducing the chance of collisions and thereby improving effective bandwidth per host.

Q10. A network engineer must decide between using a layer‑2 switch with VLANs versus a layer‑3 switch with routing capabilities for inter‑VLAN traffic. Which consideration is most critical?

A.Cost of the equipment
B.Number of VLANs required
C.Need for routing between VLANs ✅
D.Power consumption of the devices
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: If inter‑VLAN communication is required, a layer‑3 switch can perform routing internally, eliminating the need for an external router and reducing latency. When routing is essential, the routing capability becomes the primary factor influencing the equipment choice.

Q11. Apply the principle of MAC learning: after a switch receives a frame from MAC X on port 1, what entry is added to its table?

A.X → port 1 ✅
B.X → broadcast address
C.X → unknown port
D.X → port 2
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The switch records the source MAC address and the inbound port in its MAC address table, mapping MAC X to port 1. This learning enables the switch to forward future frames destined for X directly to port 1 without flooding.

Q12. Explain why a switch can prevent loops using the Spanning Tree Protocol (STP). Which mechanism does STP use?

A.Blocking selected ports to break loops ✅
B.Forwarding duplicate frames to detect loops
C.Changing MAC addresses of frames
D.Increasing the TTL field of frames
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: STP elects a root bridge and calculates the shortest path to it for each switch. Ports that would create a loop are placed in a blocking state, ensuring that only a single active path exists between any two switches and eliminating broadcast storms.

Q13. In a VLAN trunk, what tag is added to Ethernet frames to identify VLAN membership?

A.MAC tag
B.IP tag
C.VLAN tag (802.1Q) ✅
D.TCP tag
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: 802.1Q tagging inserts a four‑byte VLAN header between the source MAC and EtherType fields. This header carries the VLAN identifier, allowing switches to keep traffic for different VLANs separate even when it traverses a common trunk link.

Q14. Synthesize a scenario where a switch's MAC address aging timer must be adjusted. What network condition justifies decreasing the timer value?

A.High mobility of devices ✅
B.Static hosts with fixed addresses
C.Low traffic volume on the network
D.Redundant links providing backup paths
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: In environments such as wireless networks or roaming laptops, devices frequently change attachment points. Reducing the MAC address aging timer ensures stale entries are removed quickly, allowing the switch to relearn new port locations and maintain accurate forwarding.

Q15. If a switch port is set to “trunk” mode but the connected device is a host, what is the most likely outcome?

A.Frames will be tagged with a VLAN ID ✅
B.Frames will be sent untagged
C.The port will error‑disable
D.No traffic will pass through the port
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A host that does not understand VLAN tags will receive tagged frames, which it cannot interpret. Consequently, the host will discard the frames, leading to communication failures unless the port is reconfigured to access mode or the host is VLAN‑aware.

Q16. Which statement correctly contrasts broadcast domains of a switch and a router?

A.Switches separate broadcast domains, routers do not
B.Routers separate broadcast domains, switches do not ✅
C.Both devices separate broadcast domains
D.Neither device separates broadcast domains
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Routers operate at Layer 3 and do not forward broadcast frames, effectively dividing the network into separate broadcast domains. Switches, operating at Layer 2, forward broadcasts within the same VLAN, keeping the broadcast domain intact unless VLANs are used.

Q17. Apply the concept of VLAN tagging: when a frame from VLAN 10 traverses a trunk link, what identifier is added?

A.VLAN ID 10 in an 802.1Q header ✅
B.VLAN ID 10 in the IP header
C.No tag is added, the frame remains unchanged
D.VLAN ID 10 in the MAC address field
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The 802.1Q standard inserts a four‑byte tag containing the VLAN identifier (10 in this case) into the Ethernet frame, allowing the receiving switch to associate the frame with the correct VLAN after it leaves the trunk.

Q18. When a switch receives a broadcast frame on a VLAN, how does it forward the frame?

A.Flood to all ports in the VLAN except the inbound port ✅
B.Flood to all ports on the switch regardless of VLAN
C.Drop the broadcast frame
D.Forward only to the default gateway
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Broadcast frames are replicated and sent out every port that belongs to the same VLAN, except the port on which the frame was received. This ensures all devices in that VLAN receive the broadcast while limiting propagation to other VLANs.

Q19. Evaluate the impact of enabling PortFast on edge ports in a network with STP. Which risk is introduced?

A.Increased chance of temporary loops ✅
B.Faster convergence of the spanning tree
C.Reduced BPDU processing overhead
D.No risk; PortFast is always safe
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: PortFast bypasses the listening and learning states, allowing a port to transition to forwarding immediately. If a switch is inadvertently connected to another switch on an edge port, the rapid transition can create a loop before STP has time to block the offending link.

Q20. Synthesize how MAC address table overflow (CAM table overflow) can be used as a security attack. What is the effect on switch behavior?

A.The switch starts flooding all frames ✅
B.The switch blocks the offending port
C.The switch sends security alerts to the admin
D.The switch drops all incoming frames
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: An attacker can flood the switch with forged source MAC addresses, exhausting the CAM table. Once full, the switch can no longer make forwarding decisions and defaults to flooding, effectively turning the switch into a hub and exposing traffic to eavesdropping.

Q21. If a switch implements IEEE 802.1X port‑based authentication and a device fails authentication, what is the state of that port?

A.Authorized and forwarding traffic
B.Unauthorized and not forwarding traffic ✅
C.Blocked and disabled
D.Disabled and powered off
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: When 802.1X authentication fails, the port remains in an unauthorized state. In this state, the port does not forward any user traffic, though it may still allow limited EAPOL frames for re‑authentication attempts.

Q22. Compare the effect of enabling VLAN pruning on trunk links versus disabling it. Which statement is true?

A.Pruning reduces unnecessary traffic on trunk links ✅
B.Pruning increases traffic on trunk links
C.Pruning has no effect on traffic patterns
D.Pruning changes MAC address values
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: VLAN pruning removes VLANs that have no active ports on the far side of a trunk, preventing frames for those VLANs from being sent across the link. This conserves bandwidth and reduces processing load on both switches.

Q23. Apply the principle of full‑duplex communication in switches. What is a direct benefit?

A.Elimination of collisions on the link ✅
B.Higher latency due to acknowledgments
C.Shared bandwidth among all ports
D.Requirement for CSMA/CD protocol
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Full‑duplex allows simultaneous transmission and reception on a link, removing the possibility of collisions and negating the need for collision‑detection mechanisms such as CSMA/CD, thereby improving efficiency and throughput.

Q24. A switch has a MAC address table entry that maps MAC Y to port 3. If the same MAC Y sends a frame out of port 5, what will the switch do with the old entry?

A.Update the entry to map MAC Y to port 5 ✅
B.Keep both entries for MAC Y
C.Delete the entry for MAC Y
D.Ignore the new frame and keep the old mapping
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When a switch observes a source MAC address on a different port, it refreshes the MAC table entry to reflect the new location. This dynamic update ensures subsequent frames destined for MAC Y are correctly forwarded to port 5.

Q25. When designing a campus network, an engineer must decide between using multiple layer‑2 switches with a single core router versus using a hierarchical layer‑3 switch architecture. Which factor most strongly influences the decision?

A.Number of VLANs required
B.Need for inter‑VLAN routing performance ✅
C.Cable length between buildings
D.Overall power budget of the equipment
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: If high‑performance inter‑VLAN routing is required, a hierarchical layer‑3 switch design provides faster routing within the fabric, reducing latency compared to sending all inter‑VLAN traffic to a single router.

Q26. What acronym does VLAN stand for?

A.Virtual Local Area Network ✅
B.Virtual Link Access Node
C.Variable LAN
D.Very Large Area Network
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: VLAN stands for Virtual Local Area Network, a technology that allows a single physical switch to be partitioned into multiple logical broadcast domains, improving traffic segmentation and security.

🔗 Related Topics (MCQs)