DEV Community

ExamCert.App
ExamCert.App

Posted on

Free PCEP Practice Test 2026: The 8 Python Traps That Catch Beginners

PCEP

If you are hunting a free PCEP practice test 2026 edition, you are probably in the same spot most PCEP candidates are: you can write Python that works, and you are not sure whether that is the same thing the exam is testing.

It is not, quite. PCEP-30-02 is an entry-level certification, but it is a reading exam more than a writing exam. Most questions show you a snippet and ask what it prints. Your code running correctly in an editor is a different skill from predicting output in your head, and the gap between them is where beginners lose marks.

Here are the eight things that catch people, with the snippets that expose them.

1. Integer division vs true division

print(7 / 2)    # 3.5   -> float, always
print(7 // 2)   # 3     -> int
print(-7 // 2)  # -4    -> floors toward negative infinity, not toward zero
print(7 % 3)    # 1
print(-7 % 3)   # 2     -> sign follows the divisor
Enter fullscreen mode Exit fullscreen mode

The negative cases appear constantly. -7 // 2 being -4 rather than -3 surprises almost everyone the first time, and -7 % 3 being 2 surprises them again.

2. Mutable default arguments

def add(item, target=[]):
    target.append(item)
    return target

print(add(1))   # [1]
print(add(2))   # [1, 2]  <- not [2]
Enter fullscreen mode Exit fullscreen mode

The default list is created once, at definition time, and shared by every call. This is a favourite question type because it looks like a bug and is actually documented behaviour.

3. Lists are references, and slices are copies

a = [1, 2, 3]
b = a
b.append(4)
print(a)        # [1, 2, 3, 4]

c = a[:]
c.append(5)
print(a)        # [1, 2, 3, 4]  -> unchanged
Enter fullscreen mode Exit fullscreen mode

Know which operations mutate in place (append, extend, sort, reverse) and which return something new (sorted, reversed, slicing, concatenation). A question that calls sort() and prints its return value is testing whether you know it returns None.

4. Slice arithmetic, especially negative steps

s = "abcdef"
print(s[1:4])     # bcd
print(s[:3])      # abc
print(s[-2:])     # ef
print(s[::-1])    # fedcba
print(s[::2])     # ace
print(s[4:1:-1])  # edc
Enter fullscreen mode Exit fullscreen mode

That last one trips people. With a negative step you walk backwards from index 4 down to but not including index 1.

5. Loop else

for i in range(3):
    if i == 5:
        break
else:
    print("no break")   # this runs
Enter fullscreen mode Exit fullscreen mode

The else on a loop runs when the loop finished without break. Rare in real code, common on the exam, and free marks once you know it.

6. Operator precedence and the exponent oddity

print(2 ** 3 ** 2)   # 512, not 64  -> ** is right-associative
print(2 + 3 * 4)     # 14
print(not True or False)   # False -> not binds tighter than or
Enter fullscreen mode Exit fullscreen mode

Write the precedence order on one card: **, unary -, * / // %, + -, comparisons, not, and, or.

7. Scope and the global keyword

x = 1
def f():
    x = 2        # a new local, the global is untouched
def g():
    global x
    x = 3

f(); print(x)    # 1
g(); print(x)    # 3
Enter fullscreen mode Exit fullscreen mode

Also worth knowing: reading a global inside a function works fine, but assigning to that name anywhere in the function makes it local for the whole function, which is how you get UnboundLocalError.

8. Exception ordering

try:
    print(1 / 0)
except ArithmeticError:
    print("arithmetic")     # this one runs
except ZeroDivisionError:
    print("zero")           # unreachable, parent caught it first
Enter fullscreen mode Exit fullscreen mode

ZeroDivisionError is a subclass of ArithmeticError. Except blocks are checked top to bottom, so a broad handler above a narrow one makes the narrow one dead code. Know the basic hierarchy: BaseExceptionExceptionArithmeticError / LookupError / TypeError / ValueError, with ZeroDivisionError under arithmetic and IndexError and KeyError under lookup.

How to practise so this sticks

The habit that matters: predict before you run. Read the snippet, write down the expected output, then execute it. If you skip the prediction step you are testing the interpreter, not yourself, and the exam does not come with an interpreter.

Do that with realistic question sets rather than tutorial code, because tutorial code is written to be clear and exam code is written to be tricky. A run through the free PCEP practice test is a fast way to find which of the eight traps above are yours — most people have two or three, not eight.

Then, for every miss, write the rule rather than the answer. "Slices copy, assignment aliases" is portable. "The answer was C" is not.

When an explanation leaves you unsure, ask a follow-up instead of moving on. The AI simulator at ai.examcert.app will explain a specific snippet and then let you ask "what if the step were negative", which is exactly the kind of question a static answer key cannot handle.

What else the exam covers

Beyond the traps: data types and literals, input() and type conversion, string methods, conditionals, while and for, range() in all three forms, lists and nested lists, tuples, dictionaries and their methods, functions, arguments including keyword and default, tuples and dictionaries returned from functions, basic exception handling.

It is a small syllabus. Two to four weeks of consistent practice is realistic if you have written any Python at all; six if you are starting from zero.

Exam logistics worth confirming

PCEP-30-02 is the current version, sat online through the OpenEDG testing service. Question count, time limit and pass mark are published on the OpenEDG site — check there rather than trusting a blog, including this one, because those details change between versions.

The bottom line

PCEP is a fair exam that rewards a specific habit: reading code carefully and predicting output. Drill the eight traps, predict before you run, and keep a rules log. Do that for a few weeks and the certification is a formality.

Full syllabus breakdown: https://www.examcert.app/exams/pcep/

Top comments (0)