Python Institute · Practice Exam · PCAP-31-03 · Updated for 2026

PCAP — Certified Associate in Python Programming Practice Exam

Practice across all five exam sections — modules and packages, exceptions, strings, object-oriented programming, and the miscellaneous block of list comprehensions, lambdas, closures, and file I/O. Get immediate feedback in Learn mode and a full 65-minute simulation in Exam mode that mirrors the real 70%-to-pass test. Start with a 24-hour free trial.

Start 24-hour free trial →
500+
Practice questions
5
Exam sections covered
70%
Score to pass
24h
Free trial access

Exam at a glance

Exam
PCAP — Certified Associate in Python Programming (PCAP-31-03)
Format
Single- and multiple-select, interactive, and scenario-based items
Questions
40, scored on a 1000-point scale
Time limit
65 minutes (plus a 10-minute NDA/tutorial)
Passing score
70% — officially documented by the Python Institute
Prerequisites
None; prior PCEP certification recommended
Validity
Lifetime (for the PCAP-31-03 version)
Cost
From $295 USD (exam); bundles with a retake or practice test cost more
Delivery
Pearson VUE test centers, OnVUE online proctoring, or OpenEDG TestNow
Languages
English, Spanish, Japanese

Source: Python Institute — PCAP · PCAP-31-03 Exam Syllabus

About this certification

PCAP — Certified Associate in Python Programming, from the Python Institute (OpenEDG), is a professional, intermediate-level credential. It measures your ability to design, develop, debug, run, and refactor multi-module Python programs and to apply core object-oriented programming techniques. The exam covers modules, packages, and PIP; character encoding and string processing; generators, iterators, and closures; files and file processing; the exception hierarchy and exception classes; selected Standard Library modules; and the fundamentals of OOP.

It is a step up from the entry-level PCEP and an interim step toward the professional PCPP1, with a strong emphasis on object-oriented programming — the largest section of the exam. There are no formal prerequisites, though prior PCEP certification is recommended. For how Python certifications fit alongside formal education, see Certifications vs. College Degrees in the Learning Hub.

Exam sections and weights

The exam is divided into five sections. Weights and item counts are taken directly from the official PCAP-31-03 syllabus; the 40 items are scored on a 1000-point scale.

Modules and Packages

Importing and using modules and packages, import variants, qualifying nested modules, dir() and sys.path, and using the math and random Standard Library modules.

12%6 items
Exceptions

Handling errors with try/except/else/finally, the exception hierarchy, raise and re-raising, assert, the arg property, and defining and using your own exceptions.

14%5 items
Strings

Character encoding (ASCII, Unicode, UTF-8, code points, escapes), indexing, slicing, immutability, iterating and concatenating, and built-in string methods like .join(), .split(), .find(), and the .isxxx() family.

18%8 items
Object-Oriented Programming

The largest section. Classes and objects, instance vs. class variables, __dict__, name mangling, methods and self, introspection with hasattr(), inheritance and polymorphism, overriding __str__(), and constructors.

34%12 items
Miscellaneous: Comprehensions, Lambdas, Closures & I/O

List comprehensions (including nested and conditional), lambdas with map() and filter(), closures, and file I/O — open(), text vs. binary streams, read()/write()/readline(), and using a bytearray buffer.

22%9 items

Who this exam is for

PCAP suits aspiring programmers, career changers moving into software development, data analysis, or testing, and industry professionals who want to validate intermediate Python and object-oriented skills. There are no formal prerequisites, so anyone can sit it, but the Python Institute recommends earning the entry-level PCEP first and having comfortable working knowledge of Python 3 — the exam goes well beyond basics into OOP, closures, and file processing.

It is positioned as an interim step toward the professional PCPP1 certification and as a foundation for more specialized paths such as testing, data analytics, machine learning, IoT, and web development. For how a Python credential maps to roles and pay, see the Career Hub, and for adjacent paths, the Data Engineer and AI Engineer role guides.

What this practice exam delivers

Learn mode

Answer one question at a time with the explanation revealed immediately — ideal for the heavily-weighted OOP section, where reading a class hierarchy and predicting behavior one step at a time is the whole point.

Exam mode

40 questions against a 65-minute timer, mirroring the real test — including the 70%-to-pass bar — so you build the pacing the single- and multiple-select format demands.

Source-linked explanations

Every answer cites the official Python documentation or PCAP syllabus it derives from — modules, exceptions, strings, OOP, and I/O — so you can verify the reasoning and dig deeper.

Score by exam section

Results break down across all five sections, so practice tells you exactly which area — OOP, strings, the miscellaneous block — to study next.

Sample practice questions

Ten free questions spanning the five exam sections, weighted toward object-oriented programming like the real exam, each with a full explanation of why the other answers are wrong. The complete bank is available with the 24-hour trial.

Question 1 · Modules and Packages

Which import statement brings only the sqrt function from the math module into the current namespace so it can be called as sqrt(2)?

  1. import math.sqrt
  2. from math import sqrt
  3. import sqrt from math
  4. import math as sqrt
Show answer & explanation

Correct: B — from math import sqrt. The from module import name form binds sqrt directly in the current namespace, so you call it as sqrt(2) without the math. prefix.

Why not the others: import math.sqrt (A) is invalid because sqrt is a function, not a submodule; import sqrt from math (C) is not valid Python syntax; import math as sqrt (D) aliases the whole module, so you would call sqrt.sqrt(2). Only B binds the function directly.

Source: Python docs — the import system → Further reading: PowerKram Career Hub →
Question 2 · Exceptions

In a try/except/else/finally statement, which block runs only if the try block completes without raising an exception?

  1. except
  2. else
  3. finally
  4. try again
Show answer & explanation

Correct: B — else. The else block runs only when the try block finishes with no exception; it is the place for code that should run on the success path but should not itself be guarded by the except handlers.

Why not the others: except (A) runs only when a matching exception is raised; finally (C) runs in all cases, exception or not; "try again" (D) is not a Python clause. else is the no-exception path.

Source: Python docs — errors & exceptions → Further reading: PowerKram Learning Hub →
Question 3 · Strings

What does 'hello'[1:4] evaluate to?

  1. 'hell'
  2. 'ell'
  3. 'ello'
  4. 'hel'
Show answer & explanation

Correct: B — 'ell'. Slicing [1:4] takes characters at indices 1, 2, and 3 (the stop index 4 is excluded): e, l, l'ell'.

Why not the others: 'hell' (A) would be [0:4]; 'ello' (C) would be [1:5] or [1:]; 'hel' (D) would be [0:3]. The start is inclusive and the stop is exclusive.

Source: Python docs — string type & slicing → Further reading: PowerKram — Certifications vs. College Degrees →
Question 4 · Strings

Which expression joins the list ['a', 'b', 'c'] into the single string 'a-b-c'?

  1. ['a','b','c'].join('-')
  2. '-'.join(['a','b','c'])
  3. join('-', ['a','b','c'])
  4. '-'.concat(['a','b','c'])
Show answer & explanation

Correct: B — '-'.join([...]). join() is a string method called on the separator, taking the iterable of strings as its argument, so '-'.join(['a','b','c']) yields 'a-b-c'.

Why not the others: calling join on the list (A) is wrong — lists have no join method; there is no standalone join() function (C); and strings have no concat method (D). The separator-calls-join idiom is the point being tested.

Source: Python docs — str.join →
Question 5 · Object-Oriented Programming

A variable is declared directly in the class body (not inside any method), e.g. count = 0. What kind of variable is it?

  1. An instance variable, unique to each object
  2. A class variable, shared by all instances of the class
  3. A local variable that disappears after the class is defined
  4. A global variable
Show answer & explanation

Correct: B — a class variable. A variable assigned in the class body (outside any method) belongs to the class itself and is shared by all instances; changing it on the class affects every instance that has not shadowed it with its own attribute.

Why not the others: instance variables (A) are created with self.x = ... inside methods, typically the constructor; it is not a transient local (C); and it is not global (D) — it lives in the class namespace. Class vs. instance variables is a core PCAP OOP topic.

Source: Python docs — classes (class vs instance variables) → Further reading: PowerKram — Data Engineer career path →
Question 6 · Object-Oriented Programming

Which method should you override so that print(obj) and str(obj) produce a custom, human-readable string for your class?

  1. __init__()
  2. __str__()
  3. __len__()
  4. __call__()
Show answer & explanation

Correct: B — __str__(). Overriding __str__() defines the informal, human-readable string for an object, which str() and print() use. PCAP explicitly tests overriding __str__().

Why not the others: __init__() (A) is the constructor; __len__() (C) backs len(); __call__() (D) makes instances callable. Only __str__() controls the printed representation here.

Source: Python docs — object.__str__ →
Question 7 · Object-Oriented Programming

Which built-in function checks whether an object is an instance of a given class (or a subclass of it)?

  1. type()
  2. isinstance()
  3. hasattr()
  4. issubclass()
Show answer & explanation

Correct: B — isinstance(). isinstance(obj, Cls) returns True if obj is an instance of Cls or any subclass of it, which is exactly the inheritance-aware check PCAP expects.

Why not the others: type() (A) returns the exact type and is not subclass-aware in a boolean test; hasattr() (C) checks for an attribute, not class membership; issubclass() (D) compares two classes, not an object and a class. isinstance() is the right tool.

Source: Python docs — isinstance() →
Question 8 · Miscellaneous · List Comprehensions

Which list comprehension produces the squares of the even numbers from 0 to 9, i.e. [0, 4, 16, 36, 64]?

  1. [x*2 for x in range(10)]
  2. [x**2 for x in range(10) if x % 2 == 0]
  3. [x**2 for x in range(10)]
  4. [x**2 if x % 2 == 0 for x in range(10)]
Show answer & explanation

Correct: B. [x**2 for x in range(10) if x % 2 == 0] squares each value and the trailing if filters to even numbers, giving [0, 4, 16, 36, 64].

Why not the others: A doubles instead of squaring; C squares all ten values without filtering; D has invalid syntax — a filtering if goes after the for, not before it (a leading if requires an else as a conditional expression). Filter placement is the tested detail.

Source: Python docs — list comprehensions → Further reading: PowerKram — AI Engineer career path →
Question 9 · Miscellaneous · Lambdas

What does list(map(lambda x: x + 1, [1, 2, 3])) return?

  1. [1, 2, 3]
  2. [2, 3, 4]
  3. [1, 2, 3, 1]
  4. 6
Show answer & explanation

Correct: B — [2, 3, 4]. map() applies the lambda to each element, adding 1, and list() materializes the result: [2, 3, 4].

Why not the others: A is the unchanged input; C misreads map as appending; D would be a sum, which is not what map/list produce. PCAP tests lambdas used with map() and filter().

Source: Python docs — map() →
Question 10 · Miscellaneous · File I/O

Which approach opens data.txt for reading and guarantees the file is closed automatically, even if an error occurs while reading?

  1. f = open('data.txt'); data = f.read()
  2. with open('data.txt') as f: data = f.read()
  3. f = open('data.txt', 'w'); data = f.read()
  4. read('data.txt')
Show answer & explanation

Correct: B. The with statement (a context manager) guarantees the file is closed when the block exits, whether normally or via an exception — the recommended pattern for file I/O.

Why not the others: plain open without with or a finally (A) leaks the handle if an error occurs and never closes it here; opening with 'w' (C) truncates the file and then fails to read; read('data.txt') (D) is not how Python reads files. The context manager is the safe idiom.

Source: Python docs — reading & writing files →

Keep going: Learning & Career resources

This certification pays off fastest when it sits on top of real Python practice and a clear sense of where the credential leads. Two PowerKram hubs back this exam up.

Deep dive: exam structure, scoring, study path & the PCAP-31-04 transition

Exam structure and how it’s scored

The PCAP-31-03 exam delivers 40 questions in 65 minutes (with an additional 10 minutes for the NDA and tutorial). Items include single- and multiple-select questions plus interactive and scenario-based items, scored on a 1000-point scale, and the passing score is 70% — a threshold the Python Institute documents openly. The five sections are weighted 12% / 14% / 18% / 34% / 22%, so object-oriented programming alone is more than a third of the exam. Read more in the Learning Hub →

What the five sections actually test

Modules and Packages covers import variants, dir(), sys.path, and the math and random modules. Exceptions covers the hierarchy, try/except/else/finally, raising, asserting, and custom exceptions. Strings covers encoding, slicing, immutability, and built-in methods. OOP — the largest section — covers classes and objects, class vs. instance variables, inheritance and polymorphism, introspection, and overriding __str__(). The Miscellaneous block covers list comprehensions, lambdas with map()/filter(), closures, and file I/O. Certifications vs. College Degrees →

Realistic study path

A practical plan: work through the free, aligned Python Essentials 2 course (Edube Interactive or Cisco Networking Academy), then drill each section with hands-on code — write and import your own modules, build an exception hierarchy with custom exceptions, manipulate strings, design a small class hierarchy that overrides __str__() and uses isinstance(), and write list comprehensions, lambdas, closures, and file-I/O routines using with. Because OOP is 34% of the exam, weight your practice toward it, and use timed mock exams to build pacing for the 40-in-65-minutes format. Career Hub →

Cost, delivery, and retakes

The exam starts at $295 USD; bundles that add a retake or a practice test cost more, and a standalone practice test is $49. You can test at a Pearson VUE center, online with OnVUE proctoring, or through OpenEDG’s TestNow, in English, Spanish, or Japanese. If you do not pass, you can retake after a 15-day waiting period (free if you bought a retake voucher). Verify current pricing on the official Python Institute pages before purchasing. Python Institute — official PCAP page →

The PCAP-31-04 transition

PCAP-31-03 is the current active version and its certification is valid for life, but it is scheduled for retirement on August 31, 2026, with a successor (PCAP-31-04) in development that is expected to carry a 7-year validity rather than lifetime. If you are studying now, confirm which version you are registering for on the official site, since the syllabus weights and validity terms may change with the new version. Learning Hub →

Career outlook

Python is consistently among the highest-demand and highest-paid programming languages, and PCAP validates intermediate, OOP-focused proficiency that maps to software-development, data-analysis, and testing roles, and serves as a foundation for machine learning, IoT, and web development. It is also the interim step toward the professional PCPP1 credential. For role-by-role context and salary ranges, see the Career Hub. Career Hub — Data Engineer →

Frequently asked questions

What is the passing score for the PCAP exam?

The passing score is 70%. The exam is scored on a 1000-point scale, so you need at least 700 points. The Python Institute documents this threshold openly, so it is a firm, official target. Because object-oriented programming is 34% of the exam, weak OOP knowledge is the fastest way to fall short of 70%.

How many questions are on the exam and how long is it?

PCAP-31-03 has 40 questions and a 65-minute time limit, plus about 10 extra minutes for the NDA and tutorial. The items are a mix of single- and multiple-select questions along with interactive and scenario-based items, so you should practice reading and reasoning about real Python code, not just memorizing definitions.

Which topics carry the most weight?

Object-Oriented Programming is by far the largest section at 34% (12 items), followed by the Miscellaneous block — list comprehensions, lambdas, closures, and file I/O — at 22% (9 items). Strings are 18% (8 items), Exceptions 14% (5 items), and Modules and Packages 12% (6 items). Prioritize OOP and the miscellaneous block in your preparation.

Do I need experience or prerequisites to take it?

There are no formal prerequisites, so anyone can register, but the Python Institute recommends earning the entry-level PCEP first and having comfortable working knowledge of Python 3. PCAP is an intermediate exam that goes well beyond basics into OOP, closures, and file processing, so hands-on coding experience makes a real difference.

How much does it cost, and how do I take it?

The exam starts at $295 USD; bundles with a retake or a practice test cost more, and a standalone practice test is $49. You can take it at a Pearson VUE test center, online with OnVUE proctoring, or through OpenEDG’s TestNow, in English, Spanish, or Japanese. If you fail, you can retake after a 15-day waiting period.

Is the PCAP exam changing, and is the certification valid for life?

The current version, PCAP-31-03, carries lifetime validity, but it is scheduled for retirement on August 31, 2026. A successor version (PCAP-31-04) is in development and is expected to carry a 7-year validity instead of lifetime. If you are registering now, confirm on the official Python Institute site which version you are taking, since weights and validity terms may differ for the new version.

Start your free 24-hour practice trial

Full access to the question bank, both study modes, and section-level scoring across all five exam areas. No credit card required.

Start free trial →