Spanning Tree practice questions with answers
Fifteen free Spanning Tree practice questions with explained answers, written for CCNA candidates. Spanning Tree Protocol (STP) prevents Layer 2 loops in switched networks with redundant links by electing a root bridge and blocking the ports that would create a second path; Cisco switches typically run the rapid version, Rapid PVST+. The topic is tested in the Network Access domain of CCNA 200-301. All questions are original and use Cisco IOS behavior.
How to use these questions
Attempt each question before opening the explanation, and commit to one letter. Note the constraint word in the stem, such as “lowest”, “per VLAN”, “host-facing” or “rogue switch”, because it usually points at the right rule or feature. Work election questions out on paper in the order root bridge, root ports, designated ports, then blocked ports. The theory is in the Spanning Tree topic guide.
Warm-up: bridge IDs, states and roles
Question 1. The command show spanning-tree vlan 30 on a Catalyst switch running Rapid PVST+ displays Bridge ID Priority 24606 (priority 24576 sys-id-ext 30). Which statement is correct?
- A. The configured priority is 24606
- B. The configured priority is 24576 and the VLAN number is added to it
- C. The value 30 is the path cost to the root
- D. This switch is the root bridge for VLAN 30
Show answer
Answer: B
The bridge priority is the configured value 24576 plus the VLAN number 30 as the extended system ID, which gives the 24606 shown. The configured priority is therefore 24576, not 24606. The value 30 is the VLAN ID, not a path cost. The output does not show whether this switch is the root, since that depends on the other switches in the VLAN.
Question 2. In classic 802.1D, a port that does not forward frames and does not learn MAC addresses is in the blocking state. Which Rapid PVST+ state corresponds to it?
- A. Listening
- B. Disabled
- C. Learning
- D. Discarding
Show answer
Answer: D
Rapid STP merges the disabled, blocking and listening states into one state, discarding, so a blocked port is discarding in Rapid PVST+. The remaining states are learning and forwarding. Listening and disabled are 802.1D state names that no longer exist as separate states, and learning would mean the port already builds its MAC table.
Question 3. SW3 reaches the root bridge SW1 over a direct 100 Mb/s link (path cost 19 using the short cost method) and also through SW2 over two 1 Gb/s links (cost 4 each). Which port on SW3 becomes the root port?
- A. The port toward SW2
- B. The port on the direct link to SW1
- C. Both ports, as load balancing
- D. Neither, because both are designated
Show answer
Answer: A
The root port is the port with the lowest total path cost to the root. Through SW2 the cost is 4 + 4 = 8, lower than the direct link at 19, so the port toward SW2 becomes the root port and the direct 100 Mb/s port becomes an alternate port. Fewer hops do not matter, only total cost. Both ports cannot be root ports, and a non-root switch always has exactly one.
Question 4. A distribution switch port faces an access switch. If that access switch ever sends superior BPDUs, the port must stop forwarding but must not be shut down, and it must recover automatically when the superior BPDUs stop. Which feature is needed?
- A. PortFast
- B. BPDU guard
- C. Root guard
- D. Loop guard
Show answer
Answer: C
Root guard places a port that receives superior BPDUs into the root-inconsistent state, which blocks traffic, and returns it to normal automatically when the BPDUs stop. BPDU guard puts the port into err-disabled state, which needs manual or timer recovery. PortFast skips the listening and learning delay and does not protect the root. Loop guard protects against a port that stops receiving BPDUs, the opposite situation.
Question 5. A network is stable and every switch has agreed on the root bridge. What is the role of the ports on the root bridge?
- A. Root ports
- B. Designated ports
- C. Alternate ports
- D. Backup ports
Show answer
Answer: B
All ports on the root bridge are designated ports, because the root offers the lowest root path cost (zero) onto every segment. Root ports exist only on non-root switches. Alternate ports are standby paths to the root on non-root switches, and backup ports are redundant paths to a segment where the switch already has a designated port.
Scenarios: elections, features and convergence
Question 6. Four switches run Rapid PVST+ for VLAN 10. SW-A has priority 32768 and MAC 0c00.0000.0001. SW-B has priority 28672 and MAC 0c00.0000.00ff. SW-C has priority 28672 and MAC 0c00.0000.0002. SW-D has priority 32768 and MAC 0c00.0000.0000. Which switch is the root bridge for VLAN 10?
- A. SW-A
- B. SW-B
- C. SW-C
- D. SW-D
Show answer
Answer: C
The lowest bridge ID wins, and priority is compared before the MAC address. SW-B and SW-C have the lowest priority, 28672, so SW-A and SW-D are out even though SW-D has the lowest MAC. Between SW-B and SW-C the priorities tie, so the lower MAC decides: …0002 is lower than …00ff, making SW-C the root.
Question 7. A server connected to an access port needs about 30 seconds after link-up before its network works, which causes DHCP timeouts at boot. The port is an access port connected to a single server and never to another switch. Which command should be applied to the port?
- A. spanning-tree portfast
- B. spanning-tree vlan 1 priority 61440
- C. spanning-tree guard root
- D. spanning-tree bpduguard enable
Show answer
Answer: A
spanning-tree portfast puts an edge port into forwarding immediately instead of waiting through the spanning tree transition, which is correct for a port connected to a single end device. Raising the priority changes root election, not port delay. BPDU guard protects a PortFast port but does not remove the delay. Root guard is for ports facing other switches.
Question 8. An administrator wants PortFast enabled by one global command on all access ports of a switch, leaving trunk ports unchanged. Which command does this?
- A. spanning-tree mode rapid-pvst
- B. spanning-tree vlan 1 root primary
- C. spanning-tree loopguard default
- D. spanning-tree portfast default
Show answer
Answer: D
spanning-tree portfast default in global configuration mode enables PortFast on all access ports and does not affect trunks. spanning-tree mode rapid-pvst only selects the spanning tree version. spanning-tree vlan 1 root primary affects root election. spanning-tree loopguard default enables loop guard on point-to-point links, a different feature.
Question 9. In a Rapid PVST+ network, the link between SW3 and the root bridge fails. SW3 has an alternate port to the root through another switch. What happens to that alternate port?
- A. It waits for the max age timer and then passes through listening and learning
- B. It becomes the new root port and moves to forwarding quickly
- C. It stays discarding until an administrator enables it
- D. It becomes a designated port and starts a new root election
Show answer
Answer: B
In Rapid STP the alternate port is a prepared replacement for the root port, so when the root port fails the alternate port becomes the new root port and moves to forwarding quickly, typically within about a second or less. The 20-second max-age wait followed by 15 seconds each of listening and learning describes classic 802.1D. Manual intervention is not needed.
Question 10. In Rapid PVST+, which port role describes a port that gives a redundant path to a segment on which the same switch already has a designated port?
- A. Backup
- B. Alternate
- C. Root
- D. Designated
Show answer
Answer: A
The backup role is a redundant path to the same segment, for example when two ports of one switch are connected to the same shared segment. An alternate port is a standby path to the root through a different switch. The root port is the single best path to the root, and a designated port is the one forwarding onto the segment.
Edge cases and traps
Question 11. A fiber link between two switches fails in one direction only. The blocked alternate port on one side stops receiving BPDUs, assumes the path is gone, and starts forwarding, creating a loop. Which spanning tree feature prevents this?
- A. BPDU guard
- B. Root guard
- C. PortFast
- D. Loop guard
Show answer
Answer: D
Loop guard stops a root or alternate port from transitioning to forwarding when it no longer receives BPDUs, and places it in loop-inconsistent state instead. BPDU guard handles unexpected BPDUs on edge ports. Root guard prevents a port from accepting superior BPDUs. PortFast would make the loop worse by forwarding immediately.
Question 12. SW2 has two links to the root bridge SW1: SW2 Gi0/23 to SW1 Gi0/2, and SW2 Gi0/24 to SW1 Gi0/1. All links have equal cost and default port priority, and the port IDs on SW1 are 128.1 for Gi0/1 and 128.2 for Gi0/2. Which port becomes the root port on SW2?
- A. Gi0/23, because it has the lower local port number
- B. Both ports, as parallel links
- C. Gi0/24
- D. Neither, because SW1 is the root
Show answer
Answer: C
The root path cost and the sender bridge ID are equal on both links, so the tie is broken by the lowest sender port ID. The BPDU from SW1 Gi0/1 (128.1) arrives on SW2 Gi0/24, so Gi0/24 becomes the root port, even though Gi0/23 has the lower local number. The local port ID is used only if the sender port IDs are also equal. The other port goes to the alternate role.
Question 13. On a Catalyst switch running Rapid PVST+, an administrator enters spanning-tree vlan 10 priority 30000 and receives an error saying that the bridge priority must be in increments of 4096. Which value would be accepted?
- A. 28672
- B. 30720
- C. 32767
- D. 30001
Show answer
Answer: A
With the extended system ID, the configurable bridge priority is a multiple of 4096 (0, 4096, 8192 and so on up to 61440) because the lower 12 bits carry the VLAN ID. 28672 is 7 x 4096, so it is accepted. 30000, 30720 and 32767 are not multiples of 4096.
Question 14. An administrator wants a switch to be the backup root bridge for VLAN 20 and enters the macro command spanning-tree vlan 20 root secondary. What priority does the switch set for VLAN 20?
- A. 24576
- B. 28672
- C. 32768
- D. 4096
Show answer
Answer: B
The root secondary macro sets the bridge priority to 28672, lower than the default 32768 but higher than the 24576 set by root primary, so the switch takes over only if the primary root fails. Priority 32768 is the unchanged default. 24576 is the value root primary sets when the current root priority is higher than that; root secondary does not use it. 4096 is a priority an administrator can set manually and is not what root secondary sets.
Question 15. An access switch has two uplinks, one to standalone distribution switch D1 and one to standalone switch D2. VLAN 10 and VLAN 20 are in use. The design should forward VLAN 10 traffic over the D1 uplink and VLAN 20 traffic over the D2 uplink, with each uplink as the standby for the other. What achieves this with Rapid PVST+?
- A. Make D1 the root for both VLANs and enable PortFast on the uplinks
- B. Disable spanning tree on the uplinks
- C. Bundle both uplinks into a single EtherChannel
- D. Make D1 the root for VLAN 10 and D2 the root for VLAN 20
Show answer
Answer: D
Rapid PVST+ runs a separate spanning tree per VLAN, so making D1 the root for VLAN 10 and D2 the root for VLAN 20 (for example with root primary and root secondary on each) makes each uplink forwarding for one VLAN and blocking for the other. A single root for both VLANs blocks the same uplink for both. Disabling spanning tree on uplinks risks a loop. One EtherChannel cannot span two standalone switches.
Where to go next
Review the Spanning Tree topic guide. The trunks that carry BPDUs are covered in the VLAN and trunking practice questions, and the addressing side is in the subnetting practice problems. Then take the free CCNA 20-question practice test and read the multiple-choice exam tips.