200-201 exam dumps

200-201 practice question 314 of 405

Cisco Cybersecurity Associate. Associate level, Cisco. Free question with the correct answer and a full explanation.

200-201 Question 314

Single answer

You are tasked with filtering log entries to identify IP addresses from a server log file. The log contains entries such as 'User logged in from 192.168.1.100' and 'Connection received from 10.0.0.5'. Which regular expression would you use to match valid IPv4 addresses?

  1. A

    \b\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\b

  2. B

    \b\d{1,2}.\d{1,2}.\d{1,2}.\d{1,2}\b

  3. C

    \b\d{3}.\d{3}.\d{3}.\d{3}\b

  4. D

    \b[0-9]+.[0-9]+.[0-9]+.[0-9]+\b

Show answer and explanation

Correct answer: A

Explanation

The correct regular expression '\b\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\b' properly matches IPv4 addresses by ensuring that each segment consists of 1-3 digits and is separated by dots. The use of word boundaries ensures that only complete IP addresses are matched, avoiding partial matches in larger strings.

  • A. Correct.

    This is the correct regular expression for matching IPv4 addresses. It accounts for numbers between 1 and 3 digits separated by dots and is bounded by word boundaries to prevent partial matches.

  • B. Incorrect.

    This regex incorrectly limits the segments of the IP address to a maximum of 2 digits, which would exclude valid IP addresses like '192.168.1.100'.

  • C. Incorrect.

    This regex incorrectly requires all segments of the IP address to have exactly 3 digits, which would exclude valid IP addresses like '10.0.0.5'.

  • D. Incorrect.

    Although this regex matches numbers separated by dots, it is not bounded by word boundaries, which may lead to partial matches or unintended results in complex text.

Timed practice exam

Take a 200-201 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam