Courseiva

PCEP Computer Programming and Python Fundamentals Practice Question

Exhibit

Refer to the exhibit.
A network engineer runs 'ipconfig' on Windows and observes:
Ethernet adapter Local Area Connection:
   IPv4 Address. . . . . . . . . . . : 192.168.1.10
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1
The Python code:
import re
output = "..." # contains the above text
pattern = r"\d+\.\d+\.\d+\.\d+"
match = re.findall(pattern, output)
print(match)
--- End of exhibit ---

What will be printed?

```python my_list = [] my_list.append('192.168.1.10') my_list.append('255.255.255.0') my_list.append('192.168.1.1')

print(my_list)

```

⚠ Common exam trap

The PCEP exam often tests whether candidates understand that `append()` adds elements sequentially to the end of a list, and that printing the list shows all elements in order, not just the last one or a subset.

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

✓

['192.168.1.10', '255.255.255.0', '192.168.1.1']

The printed output is a list containing three string elements: '192.168.1.10', '255.255.255.0', and '192.168.1.1'. When printing a list in Python, it displays each element enclosed in square brackets and separated by commas. Option C correctly shows this output. The other options have an incorrect number of elements.

Answer analysis

Option-by-option breakdown

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

  • ✗

    ['255.255.255.0']

    Why it's wrong here

    append() never replaces existing elements, so the list holds all three strings, not just the second one. Selecting this suggests confusing append with assignment to index 1. The correct output retains '192.168.1.10', '255.255.255.0' and '192.168.1.1' in insertion order.

  • ✗

    ['192.168.1.10']

    Why it's wrong here

    append() accumulates items rather than discarding earlier ones, so the list contains three strings, not only the first. This option reflects a mistaken belief that each append resets the list. The printed result preserves every appended value in the order they were added.

  • ✓

    ['192.168.1.10', '255.255.255.0', '192.168.1.1']

    Why this is correct

    append adds each string to the end of the list in call order, so the list holds the three addresses sequentially. Printing the list displays them in that insertion order within square brackets, with each element quoted as a string.

  • ✗

    ['192.168.1.10', '192.168.1.1']

    Why it's wrong here

    append() adds each string to the end of the list in call order, so the middle element '255.255.255.0' is also present; this option omits it. It is tempting if you assume append overwrites or that only first and last entries persist, but list mutation preserves every appended item.

About these practice questions

One of 482 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 PCEP practice question is part of Courseiva's free Python Institute 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 PCEP exam.