Career upgrade: Learn practical AI skills for better jobs and higher pay.
Level up
All Practice Exams

100+ Free PCPP2 Practice Questions

Pass your OpenEDG PCPP2 — Certified Professional in Python Programming Level 2 exam on the first try — instant access, no signup required.

✓ No registration✓ No credit card✓ No hidden fees✓ Start practicing immediately
~50-60% Pass Rate
100+ Questions
100% Free
1 / 100
Question 1
Score: 0/0

What does `mock.patch.object(target, 'attr', new=...)` do?

A
B
C
D
to track
2026 Statistics

Key Facts: PCPP2 Exam

45

Score-Weighted Questions

OpenEDG (PCPP-32-201)

70%

Passing Score

OpenEDG (cumulative)

65 min

Exam Duration

OpenEDG

$295

Exam Fee (from)

OpenEDG

6

Syllabus Blocks

Testing, Patterns, IPC, Network, DB, Clean Code

Lifetime

Validity

Does not expire

PCPP-32-201 has 45 score-weighted questions in 65 minutes with a 70% normalized passing score. Six syllabus blocks: testing principles, design patterns, interprocess communication, network programming, Python-SQL and Python-NoSQL database access, and clean code design and optimization. Delivered via Pearson VUE test centers and OnVUE Online Proctoring. PCAP and PCPP1 are recommended but not strictly required. Lifetime certification with no expiration. Exam fee from $295 USD.

Sample PCPP2 Practice Questions

Try these sample questions to test your PCPP2 exam readiness. Each question includes a detailed explanation. Start the interactive quiz above for the full 100+ question experience with AI tutoring.

1Which Python module provides the standard, batteries-included unit-testing framework based on the xUnit pattern?
A.pytest
B.unittest
C.doctest
D.nose2
Explanation: `unittest` is Python's standard library xUnit-style framework. Tests subclass `unittest.TestCase`, methods named `test_*` are auto-discovered, and `unittest.main()` runs them. `pytest` is a third-party framework. `doctest` runs examples embedded in docstrings.
2What is the purpose of the `setUp` method on a `unittest.TestCase` subclass?
A.Runs once for the whole module
B.Runs before EACH test method to prepare a fresh fixture
C.Runs only on test failure
D.Configures pytest fixtures
Explanation: `setUp(self)` runs before every `test_*` method, giving each test an isolated fixture. `tearDown(self)` runs after each. For one-time class-level setup, use `setUpClass` / `tearDownClass` (decorated `@classmethod`). Module-level: `setUpModule` / `tearDownModule`.
3Which assertion method on `unittest.TestCase` checks that `a == b`?
A.self.assertTrue(a, b)
B.self.assertEqual(a, b)
C.self.assertSame(a, b)
D.self.assertMatch(a, b)
Explanation: `assertEqual(a, b)` checks `a == b`. Other key assertions: `assertTrue/assertFalse`, `assertIs/assertIsNot` (identity), `assertIsNone/assertIsNotNone`, `assertIn`, `assertRaises`, `assertAlmostEqual`. There is no `assertSame` or `assertMatch`.
4What does this unittest snippet check? import unittest class T(unittest.TestCase): def test_div(self): with self.assertRaises(ZeroDivisionError): 1 / 0
A.That 1/0 returns 0
B.That 1/0 raises ZeroDivisionError
C.That ZeroDivisionError is a subclass of ValueError
D.Nothing
Explanation: `assertRaises(Exc)` used as a context manager passes the test if the wrapped block raises `Exc` (or a subclass). If the block does NOT raise, or raises a different exception type, the test fails.
5Which decorator skips a `unittest` test unconditionally with a reason?
A.@unittest.skip('reason')
B.@unittest.ignore('reason')
C.@unittest.disabled('reason')
D.@unittest.bypass('reason')
Explanation: `@unittest.skip(reason)` always skips the test. Related: `@unittest.skipIf(condition, reason)`, `@unittest.skipUnless(condition, reason)`, `@unittest.expectedFailure`. Use `self.skipTest('reason')` to skip from inside a test.
6By default, what filename pattern does `unittest` discovery match when you run `python -m unittest discover`?
A.test_*.py only
B.*_test.py only
C.test*.py
D.spec_*.py
Explanation: `python -m unittest discover` defaults to pattern `test*.py` in the start directory (and subpackages). You can override with `-p '*_test.py'`. Test classes must subclass `TestCase` and methods must start with `test`.
7Which `unittest.mock` class creates a flexible mock object that records calls and returns configurable values?
A.MagicMock
B.Stub
C.Spy
D.FakeObject
Explanation: `unittest.mock.MagicMock` (and its base `Mock`) creates a callable mock that records every attribute access and call. `MagicMock` additionally implements all the dunder methods (`__len__`, `__iter__`, etc.). Use `mock.return_value`, `mock.side_effect`, and `mock.assert_called_with(...)`.
8What does `@patch('module.func')` from `unittest.mock` do when used as a test decorator?
A.Adds logging to func
B.Replaces module.func with a MagicMock for the duration of the test, then restores it
C.Permanently deletes func
D.Runs func twice
Explanation: `@patch('module.func')` replaces `module.func` with a `MagicMock` while the test runs and restores the original afterward. The mock is passed as the LAST positional argument (or first if multiple patches stack — patches apply bottom-up).
9What does this code print? from unittest.mock import MagicMock m = MagicMock(return_value=42) print(m(1, 2), m.called, m.call_count)
A.None False 0
B.42 True 1
C.42 False 1
D.TypeError
Explanation: A MagicMock with `return_value=42` returns 42 on call. `m.called` becomes True after at least one call. `m.call_count` reflects how many times it was called (1). Use `m.assert_called_with(1, 2)` to verify args.
10In pytest, what is a `fixture`?
A.A failed test
B.A reusable, named setup/teardown function injected into tests by name
C.A stub HTTP server
D.A specific test runner
Explanation: A pytest fixture (defined with `@pytest.fixture`) is a function that prepares a value or resource. Tests request it by adding a parameter with the fixture's name. Pytest resolves the dependency, runs the fixture, injects its return value, and runs teardown after via `yield` or finalizers.

About the PCPP2 Exam

The OpenEDG PCPP2 (PCPP-32-201) Certified Professional in Python Programming Level 2 exam validates senior Python 3 engineering skills: testing with unittest/pytest/mock, GoF design patterns (Singleton, Factory, Facade, Proxy, Observer, Command, Template Method, State) and SOLID principles, interprocess communication with threading/multiprocessing/subprocess (and the GIL), network programming with sockets and TLS plus software-defined networking concepts, Python-SQL access (sqlite3, SQLAlchemy ORM) and Python-NoSQL access (pymongo, redis-py), and clean code, maintenance, and optimization.

Questions

45 scored questions

Time Limit

65 min

Passing Score

70% normalized

Exam Fee

$295 (OpenEDG Python Institute / Pearson VUE)

PCPP2 Exam Content Outline

~17%

Testing principles and techniques

unittest (TestCase, setUp/tearDown, setUpClass/tearDownClass, setUpModule, assertEqual/assertTrue/assertRaises/assertIn/assertAlmostEqual, skip/skipIf/skipUnless/expectedFailure, test discovery with python -m unittest discover); unittest.mock (Mock, MagicMock, return_value, side_effect, assert_called_with, patch, patch.object as decorator and context manager); pytest (function/class/module/session fixtures, @pytest.mark.parametrize, conftest.py for shared fixtures, monkeypatch, pytest.raises); doctest fundamentals.

~17%

Design patterns

GoF patterns in Python: Singleton via __new__ or metaclass; Factory Method and Abstract Factory; Facade; Proxy (virtual, protection, remote, caching); GoF Decorator (object composition) versus Python @decorator syntax; Observer (publish/subscribe); Command with execute/undo; Template Method via abstract base classes; State and Strategy and how they differ in intent. SOLID principles (SRP, OCP, LSP, ISP, DIP) implemented with abstract base classes and typing.Protocol.

~17%

Interprocess communication

threading (Thread, daemon=True, start/join, Lock/RLock, Semaphore/BoundedSemaphore, Event, Condition with notify/notify_all, Barrier, thread-safe queue.Queue), the Global Interpreter Lock and CPU- vs I/O-bound implications, multiprocessing (Process, Queue, Pipe, Pool with map/imap, Manager proxies, Value and Array shared memory, spawn vs fork start methods, the if __name__ == '__main__' guard), subprocess (run with capture_output/text/check, Popen, PIPE, communicate, shell=True risks), and concurrent.futures (ThreadPoolExecutor, ProcessPoolExecutor) plus asyncio basics (async/await, asyncio.run, gather, create_task).

~17%

Network programming

socket module (AF_INET / AF_INET6, SOCK_STREAM / SOCK_DGRAM, server flow socket > bind > listen > accept > recv/send, client flow socket > connect > send/recv, sendall vs send, sendto/recvfrom for UDP, setblocking, gethostbyname and getaddrinfo), I/O multiplexing with selectors.DefaultSelector (epoll/kqueue/select under the hood), software-defined networking concepts (control plane vs data plane separation, OpenFlow controllers), and network security via the ssl module (ssl.create_default_context, TLS 1.2+, certificate chain validation, hostname checking, SNI via server_hostname).

~17%

Python-SQL and Python-NoSQL database access

DB-API 2.0 (PEP 249) concepts of Connection, Cursor, transactions, commit/rollback. sqlite3 (connect, cursor, execute/executemany, parameterized ? placeholders, fetchone/fetchmany/fetchall, sqlite3.Row, connection used as context manager auto-commits or rolls back). SQLAlchemy ORM (create_engine, sessionmaker, DeclarativeBase, session.commit / rollback / close). pymongo (MongoClient, database/collection access, insert_one, find/find_one, update_one/update_many, replace_one, create_index for query performance). redis-py basics (Redis client, set/get, decode_responses).

~15%

Clean code design, maintenance, and optimization

PEP 8 style (naming, indentation, line length, import order), PEP 257 docstring conventions, PEP 484 type hints (Optional, Union, Callable, TypeVar, Generic, list[str], dict[str,int]), PEP 544 typing.Protocol for structural subtyping, dataclasses.dataclass with frozen/slots/kw_only options, formatters and linters (black, ruff/flake8, isort, mypy/pyright), profiling (cProfile and pstats), memory optimization (__slots__ to suppress __dict__, functools.lru_cache and functools.cache, generator expressions versus list comprehensions, NumPy vectorization at a conceptual level).

How to Pass the PCPP2 Exam

What You Need to Know

  • Passing score: 70% normalized
  • Exam length: 45 questions
  • Time limit: 65 min
  • Exam fee: $295

Keys to Passing

  • Complete 500+ practice questions
  • Score 80%+ consistently before scheduling
  • Focus on highest-weighted sections
  • Use our AI tutor for tough concepts

PCPP2 Study Tips from Top Performers

1Memorize the six PCPP-32-201 syllabus blocks: testing, design patterns, IPC, network, database, and clean code — they receive comparable weight
2For testing, drill the difference between unittest fixtures (setUp / setUpClass / setUpModule) and pytest fixture scopes (function / class / module / session)
3GoF Decorator (runtime object composition) is NOT the same as Python's @decorator syntax (compile-time callable wrapping) — exam loves to test this distinction
4Threading is for I/O-bound work because of the GIL; multiprocessing (separate processes, separate GILs) is for CPU-bound work
5Always use Popen.communicate() (or subprocess.run with capture_output=True) — reading one stream at a time can deadlock on a full OS pipe buffer
6TCP server: socket > bind > listen > accept > recv/send. UDP: SOCK_DGRAM with sendto / recvfrom — no listen/accept
7Use ssl.create_default_context() and pass server_hostname to wrap_socket — disabling cert or hostname checks defeats TLS authentication
8sqlite3: parameterized queries with ? placeholders, never f-string SQL. The connection-as-context-manager commits on success and rolls back on exception (it does NOT close the connection)
9PyMongo: insert_one / find / find_one / update_one / update_many / replace_one — and remember create_index for query performance
10Use the free PCPP2 course series on Edube.org — it is the official PCPP-32-201 prep material

Frequently Asked Questions

What is the PCPP-32-201 exam?

PCPP-32-201 is the OpenEDG Certified Professional in Python Programming Level 2 (PCPP2) exam, the highest-tier OpenEDG Python certification. Administered by the OpenEDG Python Institute via Pearson VUE test centers and OnVUE Online Proctoring, it validates senior Python 3 engineering across testing, design patterns and SOLID, concurrency and IPC, network programming, SQL/NoSQL database access, and clean code, maintenance, and optimization.

How many questions are on the PCPP2 exam?

PCPP-32-201 has 45 score-weighted questions in 65 minutes (plus 10 minutes for the NDA and tutorial). Item types include single-select, multiple-select, drag-and-drop, gap-fill, code insert, and code order. The passing score is a cumulative 70%. Many questions present advanced Python 3 code (mock setup, threading flow, socket sequences, ORM session usage) and ask you to predict output, identify the bug, or complete the design.

Is PCPP1 required before PCPP2?

PCPP1 is recommended but not strictly required to register for PCPP-32-201. OpenEDG explicitly says there are no formal prerequisites. However, PCPP2 assumes everything PCPP1 covers (advanced OOP, PEP 8 / 257, GUI, sockets, file processing) plus deeper expertise in testing, concurrency, design patterns, and databases. Most PCPP2 candidates have either passed PCPP1 or have 2+ years of professional Python experience.

What is the largest domain on the PCPP2 exam?

OpenEDG distributes PCPP-32-201 across six roughly balanced syllabus blocks: testing principles, design patterns, interprocess communication, network programming, Python-SQL and Python-NoSQL database access, and clean code, maintenance, and optimization. Each block contributes a comparable share of the score, so balanced preparation across all six is required.

How should I prepare for the PCPP2 exam?

Plan for 120-180 hours of study over 12-18 weeks. Use the free PCPP2 course series on Edube Interactive — modules cover testing, design patterns, IPC, networking, database access, and clean code. Build at least one project per syllabus block: a tested package with pytest, a threading + multiprocessing job, a socket + TLS client/server, and a data layer using sqlite3, SQLAlchemy, and pymongo. Complete 100+ practice questions and aim for 80%+ before scheduling.

What jobs can I get with PCPP2 certification?

PCPP2 demonstrates senior-level Python proficiency and supports lead and architect roles such as Senior Python Engineer, Backend Tech Lead, Software Architect, Senior Platform Engineer, Senior DevOps Engineer, and Senior Data Engineer. Together with practical experience, PCPP2 is one of the strongest formal Python credentials available outside vendor-specific certifications.