Courseiva
easyMultiple Choice

200-901 Practice Question: Refer to the exhibit

Exhibit

R1# show ip route
Codes: L - local, C - connected, S - static, R - RIP, O - OSPF, B - BGP
       D - EIGRP, EX - EIGRP external, N - NAPT
Gateway of last resort is 10.0.0.1
     10.0.0.0/8 is variably subnetted, 2 subnets
C       10.0.0.0/24 is directly connected, GigabitEthernet0/0
S       10.0.1.0/24 [1/0] via 10.0.0.2

Refer to the exhibit. A developer is parsing the output of 'show ip route' using Python. Which regular expression would extract the prefix '10.0.1.0/24'?

⚠ Common exam trap

Cisco often tests the distinction between capturing only the IP address versus the full CIDR prefix, leading candidates to pick options that omit the subnet mask (like Option B) or use overly broad patterns (like Option C) that match unintended fields.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

r'^S\s+(\d+\.\d+\.\d+\.\d+/\d+)'

The regex `^S\s+(\d+\.\d+\.\d+\.\d+/\d+)` matches lines starting with 'S' (static route) followed by whitespace, then captures the entire prefix including both the IP address and subnet mask in CIDR notation (e.g., 10.0.1.0/24). This ensures the extracted string is exactly the prefix as it appears in the 'show ip route' output.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    r'^S\s+(\d+\/\d+)'

    Why it's wrong here

    This pattern captures only digits and a slash, matching a mask-length fragment rather than the full dotted prefix, and requires the line to start with 'S'. It is tempting because it anchors to static-route lines and grabs a slash-delimited token, which suits extracting a bare mask length, not an address.

  • ✗

    r'^S.*(\d+\.\d+\.\d+\.\d+)'

    Why it's wrong here

    The pattern captures only the dotted address, stopping before the '/24' suffix, so the prefix length is lost. It is tempting because anchoring to 'S' and matching the network address looks like prefix extraction, which would be correct if only the address, not the CIDR notation, were required.

  • ✗

    r'S\s+(\S+)'

    Why it's wrong here

    '\S+' captures the first non-whitespace token after 'S', which is the next-hop or code field, not the prefix; the pattern is unanchored and grabs the wrong column. It is tempting because it is a simple generic token grab, which works when the desired value is the first field on the line.

  • ✓

    r'^S\s+(\d+\.\d+\.\d+\.\d+/\d+)'

    Why this is correct

    The pattern anchors at line start, matches the code 'S', consumes whitespace, then captures the dotted-quad prefix with its CIDR suffix via a group. Anchoring prevents matching similar addresses embedded elsewhere in the routing table output.

Visual reference

192.168.1.0 /24 256 addresses (254 usable) 192.168.1.0 /25 Subnet A 128 addr (126 usable) 192.168.1.128 /25 Subnet B 128 addr (126 usable) Borrowing 1 bit from host portion creates 2 subnets (/25)

About these practice questions

Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.