Python Institute PCAP โ Certified Associate in Python Programming (PCAP-31-03)
Get full access to the updated question bank and pass on your first attempt.
Vendor
Python Institute
Certification
General-Purpose
Content
109 Qs
Status
Verified
Updated
1 day ago
Test the Practice Engine
Experience our real exam environment with free demo questions
Premium Bundle
Complete Success Suite
Save $39 Instantly
-
โFull PDF + Interactive Engine Everything you need to pass
-
โAll Advanced Question Types Drag & Drop, Hotspots, Case Studies
-
โPriority 24/7 Expert Support Direct line to certification leads
-
โ90 Days Free Priority Updates Stay current as exams change
Success Metric
98.4% Pass Rate
Standard Simulation
Practice Engine
One-Time Payment
-
Web-Based (Zero Install)
-
Real Testing Environment Virtual & Practice Modes
-
Interactive Engine Drag & Drop, Hotspots
-
60 Days Free Updates
Compatible with All Devices
Basic Tier
PDF Study Guide
Digital Access
- โ Exam Questions (PDF)
- โ Mobile Friendly
- โ 60 Days Updates
Verified 10-Question Preview
Verified Community
The CertoMetrics Standard.
Recommend the #1 platform for verified Python Institute certification resources.
Success Network
Help a Colleague Succeed.
Invite a peer to get their own updated PCAP-31-03 prep kit.
Exam Overview
The Certified Associate in Python Programming (PCAP-31-03) certification is a globally recognized credential that validates your intermediate to advanced proficiency in Python. Achieving PCAP status signifies a robust understanding of core Python concepts, object-oriented programming, modules, packages, and advanced data structures, moving beyond foundational knowledge. This certification is a critical stepping stone for professionals aiming to solidify their Python expertise, demonstrating to employers a readiness to tackle complex programming challenges. It significantly enhances your professional profile, opening doors to diverse career opportunities in software development, data science, automation, and web development, and serves as a testament to your commitment to mastering the Python language.
Questions
40
Passing Score
700/1000
Duration
65 Minutes
Difficulty
Intermediate
Level
Associate
Skills Measured
Career Path
Target Roles
Common Questions
Is the material up to date?
Yes. We update our question bank weekly to match the latest Python Institute standards. You get free updates for 90 days.
What format do I get?
You get instant access to both the **PDF** (for reading) and our **Premium Test Engine** (for exam simulation).
Is there a guarantee?
Absolutely. If you fail the PCAP-31-03 exam using our materials, we offer a full money-back guarantee.
When do I get the download?
Instantly. The download link is available in your dashboard immediately after payment is confirmed.
Free Study Guide Samples
Previewing updated PCAP-31-03 bank (22 Questions).
What is true about the following snippet? (Choose two.)
Correct Option: B,D
โ
Reasoning: The raise E("what a pity") statement creates an E exception object. When print(e) is executed in the except block, Python calls the custom __str__ method of class E, which always returns "it's nice to see you".
โ
Reasoning: The print("I feel fine") statement is located at the beginning of the try block. It executes successfully before the raise E("what a pity") statement, printing "I feel fine" to the console. โ Why the other choices are incorrect:
- Option A is incorrect: The
__str__method of classEoverrides the default exception message, so "what a pity" (the message passed to__init__) is not printed whenprint(e)is called. - Option C is incorrect: The
except E as e:block explicitly catches and handles theEexception. The exception is therefore handled, not unhandled.
What is the expected behavior of the following code?

Correct Option: A
โ
Reasoning: m starts at 0. foo(0) is called. Inside foo, 1/0 raises ZeroDivisionError. The inner except ArithmeticError catches it, m becomes 1, and the error is re-raised. The outer except ArithmeticError then catches it, and m becomes 1 + 2 = 3. Finally, print(m) outputs 3. โ Why the other choices are incorrect:
- Option B is incorrect:
mchanges multiple times due to exception handling. It's not 1. - Option C is incorrect: The
m += 2block executes, making the value 3, not 2. - Option D is incorrect: The code is syntactically correct and handles the
ZeroDivisionErrorgracefully without terminating.
Which of the following expressions evaluate to True? (Choose two.)
Correct Option: B,C
โ
Reasoning: The string '' contains two single-quote characters. The len function correctly counts these two characters, so len("''") evaluates to 2. Therefore, 2 == 2 is True.
โ
Reasoning: ord('z') returns the ASCII/Unicode value of 'z' (122). ord('z') - 1 is 121. chr(121) converts this value back to the character 'y'. Thus, 'y' == 'y' is True. โ Why the other choices are incorrect:
- Option A is incorrect:
ord("0")is 48 andord("9")is 57. The expression48 - 57equals-9. Since-9 == 10isFalse, this choice is incorrect. - Option D is incorrect: The syntax
''1234''is invalid in Python. It's interpreted as an empty string''followed by the integer1234followed by another empty string'', leading to aSyntaxError.
Which of the following snippets will execute without raising any unhandled exceptions? (Choose two.)
Correct Option: A,B
โ
Reasoning: The try block attempts 1 / 0, raising a ZeroDivisionError. The subsequent except ZeroDivisionError: block specifically catches this exception. The pass statement handles it, preventing any unhandled exceptions from propagating.
โ
Reasoning: The try block performs 1 / 1, which executes successfully without raising any exceptions. Since no ZeroDivisionError occurs, the except block is skipped entirely. The program continues normally without unhandled exceptions. โ Why the other choices are incorrect:
- Option C is incorrect: A
ValueErroris raised within thetryblock. Theexcept TypeError:clause will not catch aValueErrorbecause they are distinct, unrelated exception types. Thus, theValueErrorremains unhandled. - Option D is incorrect: The function
fraises a generalException. Theexcept IOError:clause is too specific to catch a generalException.IOErroris a subclass ofOSError, notExceptionitself directly. TheExceptionis unhandled.
What is the expected behavior of the following code?
Correct Option: C
โ
Reasoning: The string s = '2A' cannot be converted to an integer by int(s), causing a ValueError. This specific exception is caught by the first except ValueError: block, which sets n to 2. The program then proceeds to print(n), outputting 2. โ Why the other choices are incorrect:
- Option A is incorrect: The code includes
try...exceptblocks specifically to handle potential errors, preventing a crash and ensuring execution proceeds to print a value. - Option B is incorrect:
nwould be1only if anArithmeticErroroccurred.int('2A')raises aValueError, not anArithmeticError. - Option D is incorrect:
nwould be0only if a general, uncaught exception (notValueErrororArithmeticError) occurred. TheValueErroris specifically handled.
Which one of the platform module functions should be used to determine the underlying platform name?
Correct Option: D
โ
Reasoning: platform.platform returns a single string identifying the underlying platform, including OS, version, and architecture. It directly provides the comprehensive platform name. โ Why the other choices are incorrect:
- Option A is incorrect:
platform.processorreturns the processor's name (e.g., 'x86_64'), not the underlying platform's name. - Option B is incorrect:
platform.unamereturns a named tuple containing system information. Whileuname.systemgives the basic OS name, the function itself returns a tuple, not a direct platform name string. - Option C is incorrect:
platform.python_versionreturns the Python interpreter's version string, not the underlying platform's name.
With regards to the directory structure below, select the proper forms of the directives in order to import module_c. (Choose two.)
Correct Option: A,B
โ
Reasoning: This directive correctly uses the from... import... statement. It specifies the full package path pypack.upper.lower to locate the lower subpackage, then imports the module_c module from within it.
โ
Reasoning: This directive correctly uses the import... statement. It provides the absolute, fully qualified name for module_c by traversing the package hierarchy: pypack -> upper -> lower -> module_c. โ Why the other choices are incorrect:
- Option C is incorrect:
import upper.module_cis incorrect becauseupperis not a top-level package; it's a subpackage ofpypack. Furthermore,module_cis not directly insideupper, but rather insideupper.lower. - Option D is incorrect:
import upper.lower.module_cis incorrect becauseupperis not a top-level package; it's nested withinpypack. Python requires the full path from a package insys.path.
Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Choose two.) import random v1 = random.random() v2 = random.random()
Correct Option: C
โ
Reasoning: random.choice([1,2,3]) will always return 1, 2, or 3. All these values are greater than 0. Therefore, the expression random.choice([1,2,3]) > 0 will always evaluate to True. โ Why the other choices are incorrect:
- Option A is incorrect:
random.sample([1,2,3], 1)returns a list containing one element, so itslenis always1.1 > 2isFalse. - Option B is incorrect:
random.randomgenerates pseudo-random floats. While theoretically possible,v1 == v2is highly improbable and not guaranteed to beTrue. - Option D is incorrect:
random.randomreturns a floatxwhere0.0 <= x < 1.0. Thus,v1can never be greater than1.v1 > 1is alwaysFalse.
A Python module named pymod.py contains a variable named pyvar. Which of the following snippets will let you access this variable? (Choose two.)
Correct Option: B,D
โ
Reasoning: The import pymod statement imports the module pymod. After importing, variables within the module are accessed using dot notation: pymod.pyvar. The snippet correctly accesses pyvar and assigns it a new value.
โ
Reasoning: The from pymod import * statement imports all public names from pymod directly into the current namespace. This allows pyvar to be accessed directly by its name without a module prefix. The snippet then correctly accesses pyvar and assigns it a new value. โ Why the other choices are incorrect:
- Option A is incorrect: While
from pymod import pyvaris correct,pyvarattempts to callpyvaras a function, which is incorrect for a variable, resulting in aTypeError. - Option C is incorrect: The syntax
import pyvar from pymodis invalid. The correct syntax for importing specific names isfrom pymod import pyvar.
What is the expected output of the following code if existing_file is the name of a file located inside the working directory?
Correct Option: C
โ
Reasoning: The open('existing_file', 'w') call on an existing file truncates it but does not raise an IOError. The try block completes successfully, printing 1. The except block is skipped. The else block then executes, printing 3. The final output is "1 3". โ Why the other choices are incorrect:
- Option A is incorrect: The
exceptblock is not executed because noIOErroroccurs; therefore,2is not printed. - Option B is incorrect:
2is in theexceptblock, which is skipped. Theelseblock, which prints3, is executed. - Option D is incorrect: The
tryblock successfully prints1. Theexceptblock, which prints2, is skipped.
What is the expected behavior of the following code?

Premium Solution Locked
Unlock all 109 answers & explanations
What is the expected behavior of the following code?

Premium Solution Locked
Unlock all 109 answers & explanations
Which of the following snippets will execute without raising any unhandled exceptions? (Choose two.)
Premium Solution Locked
Unlock all 109 answers & explanations
Assuming that the following piece of code has been executed successfully, which of the expressions evaluate to True? (Choose two.)
Premium Solution Locked
Unlock all 109 answers & explanations
What is the expected behavior of the following code?
Premium Solution Locked
Unlock all 109 answers & explanations
What is the expected output of the following code if there is no file named non_existing_file inside the working directory?
Premium Solution Locked
Unlock all 109 answers & explanations
Which of the following statements are true? (Choose two.)
Premium Solution Locked
Unlock all 109 answers & explanations
What is true about the __bases__ property?
Premium Solution Locked
Unlock all 109 answers & explanations
Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Choose two.)
string = 'SKY'[::-1]
string = string[-1]
Premium Solution Locked
Unlock all 109 answers & explanations
Which of the following expressions evaluate to True? (Choose two.)
Premium Solution Locked
Unlock all 109 answers & explanations
A Python module named pymod.py contains a function named pyfun().
Which of the following snippets will let you invoke the function? (Choose two.)
Premium Solution Locked
Unlock all 109 answers & explanations
What is the expected behavior of the following code?

Premium Solution Locked
Unlock all 109 answers & explanations
Full Question Bank Locked
You have reached the end of the free study guide preview. Upgrade now to unlock all 109 questions and the full simulation engine.
Certification Path
Related Certifications
Customer Reviews
Global Community Feedback
David M.
"The practice engine is incredible. It feels exactly like the real testing environment and helped me build so much confidence."
Sarah J.
"The PDF is very well organized and the explanations for the answers are actually helpful, not just random text."
Michael C.
"I was skeptical, but the content is high quality and definitely worth the price. I passed on my first try!"