What the PCEP exam covers
- Computer Programming and Python Fundamentals188 questions
- Control Flow - Conditional Blocks and Loops229 questions
- Data Collections - Tuples, Dictionaries, Lists, and Strings221 questions
- Functions and Exceptions223 questions
Free PCEP practice test questions
A sample of 10 questions with answers and explanations. Sign up free to practice all 861.
-
Which statement best describes how the standard CPython implementation runs a program?
- AIt compiles the source into bytecode, which a virtual machine then executes.Correct
- BIt translates the source directly into a standalone machine-code .exe first.
- CIt runs each line as raw machine code with no translation step at all.
- DIt needs the programmer to hand-compile the source into bytecode first.
✓ Correct answer: ACPython first compiles your source code into an intermediate form called bytecode, which the Python Virtual Machine then interprets and executes. This mix of compilation and interpretation is why Python is called an interpreted language.
Why the other options are wrong- BCPython does not produce a standalone machine-code executable before running.
- CSource is never executed as raw machine code line by line; it is compiled to bytecode first.
- DThe bytecode step is automatic; the programmer does not compile it manually.
-
What is printed by the following snippet? print(2.0 ** 3)
- A8
- B6.0
- C8.0Correct
- D9.0
✓ Correct answer: CThe ** operator raises the base to the given power, and when the base is a float the result is a float. Since 2.0 is a float, 2.0 ** 3 is 2.0 times 2.0 times 2.0, which equals 8.0.
Why the other options are wrong- A8 (an int) would appear only if both operands were ints; because 2.0 is a float, the result is the float 8.0.
- B6.0 is 2.0 * 3, treating ** as multiplication instead of exponentiation.
- D9.0 does not equal 2.0 raised to the third power; it would be 3.0 squared.
-
What is the output of the following code? a = 4 b = 2 if a > b: if a % b == 0: print("divisible") else: print("not divisible") else: print("smaller")
- AdivisibleCorrect
- Bnot divisible
- Csmaller
- D(no output)
✓ Correct answer: Aa > b is True (4 > 2), so we enter the outer if. Inside, a % b is 4 % 2 which is 0, so a % b == 0 is True and divisible prints.
Why the other options are wrong- Bnot divisible needs a % b to be nonzero, but 4 % 2 is 0.
- Csmaller runs only when a > b is False, but 4 > 2 is True.
- DOne inner branch always runs after the outer condition passes.
-
What does this loop print? for i in range(10): if i == 3: break print(i, end=' ')
- A0 1 2 3
- B0 1 2Correct
- C3
- D0 1 2 3 4 5 6 7 8 9
✓ Correct answer: BThe loop prints 0, 1, 2. When i reaches 3, break stops the loop before print runs, so 3 is not printed.
Why the other options are wrong- AThe break executes before print(i) when i is 3, so 3 is never printed.
- CThe loop prints every value up to but not including 3, not just the value 3.
- Dbreak ends the loop at i equal to 3, so the later values are never reached.
-
What is printed by the following snippet? x = 7 print(x and 'yes')
- AyesCorrect
- B7
- CTrue
- DSyntaxError
✓ Correct answer: Ax is assigned 7, which is truthy since it is nonzero. Because the left operand of and is truthy, Python must evaluate and return the right operand, the string 'yes', rather than converting anything to a boolean. So print(x and 'yes') outputs yes.
Why the other options are wrong- B7 would only be returned if and returned its left operand, but and returns the right operand once the left one is truthy.
- Cand returns one of its actual operand values, not a converted boolean like True.
- DThis is valid syntax combining a variable with a string using and; it raises no error.
-
What is printed by the following snippet? print("python".startswith("py"))
- ATrueCorrect
- BFalse
- C0
- Dpy
✓ Correct answer: AThe startswith method returns a Boolean reporting whether the string begins with the given prefix. 'python' does begin with 'py', so the result is True.
Why the other options are wrong- BFalse would mean the string does not start with 'py', but its first two letters are exactly 'py'.
- C0 is a number; startswith returns True or False, not an index.
- D'py' is the prefix being tested; the method returns a Boolean, not the matched text.
-
What is the output of the following code? d = {"a": 1, "b": 2} print(list(d.keys()))
- A['a', 'b']Correct
- B[1, 2]
- C['a', 1, 'b', 2]
- D[('a', 1), ('b', 2)]
✓ Correct answer: Akeys() returns a view object of just the dictionary's keys, and wrapping it in list() turns that view into an ordinary list. The keys are 'a' and 'b', so the result is ['a', 'b'].
Why the other options are wrong- B[1, 2] are the values; keys() returns the keys instead.
- Ckeys() lists only the keys and does not interleave them with values.
- DThat list of pairs is what items() produces, not keys().
-
In the definition def greet(name):, what is name referred to as?
- AA parameterCorrect
- BAn argument
- CA return value
- DA keyword
✓ Correct answer: AIn def greet(name):, name is written in the function header as a placeholder for whatever value is later supplied, making it a parameter. The actual value passed in at call time, such as "Alice" in greet("Alice"), is called an argument. Parameters belong to the definition; arguments belong to the call.
Why the other options are wrong- BAn argument is the value passed at the call site, not the name in the definition.
- CA return value comes back out of the function via return, unrelated to defining name.
- DA keyword here refers to Python's reserved words or keyword-argument syntax, not a parameter name.
-
What is printed? def greet(times): if times == 0: return print("hi") greet(times - 1) greet(2)
- Ahi hiCorrect
- Bhi
- Chi hi hi
- DNothing is printed.
✓ Correct answer: Agreet(2) prints hi and calls greet(1), which prints hi and calls greet(0). At 0 the base case returns without printing, so hi appears exactly twice.
Why the other options are wrong- BThe function prints once per call before the base case, so with times = 2 it prints twice.
- Cgreet(0) hits the base case and does not print, so there are two hi lines, not three.
- Dhi is printed on each call above the base case, so output does appear.
-
What is printed by this code? letters = list("abc") print(letters)
- A['a', 'b', 'c']Correct
- B['abc']
- Cabc
- DTypeError
✓ Correct answer: APassing an iterable to the list() constructor builds a new list containing each item the iterable produces, one at a time. Iterating over a string yields its characters one by one, so list("abc") creates a list with three separate one-character strings: 'a', 'b', and 'c'. The original three-letter string is not kept as a single item.
Why the other options are wrong- B['abc'] would result from list(["abc"]), wrapping the whole string as one element in a list, not from iterating over the string's characters.
- CPrinting the list shows it with brackets and quoted characters, not plain text abc; letters is a list object, not a string.
- DNo exception occurs; strings are iterable, so list() successfully builds a list of characters.
Who this PCEP practice exam is for
This practice set is for anyone preparing for the PCEP: Certified Entry-Level Python Programmer exam at the foundational level - from first-time candidates building a foundation to experienced Python practitioners doing a final review before test day. If you learn best by working through realistic questions and reading why each answer is right or wrong, it is built for you.
How to use this PCEP practice exam
- Start with the free sample questions above to gauge your current baseline.
- Read the full explanation on every question, including why each wrong option is wrong.
- Track your weak domains and focus your study where you are losing the most marks.
- Once you are scoring consistently well, take a timed, full-length mock exam.
- Use your readiness score to decide when you are ready to book the real PCEP exam.
Related Python resources
- PCEP study guideKey concepts
- Python practice examsAll Python
- Certification pathWhere this fits
- PCEP vs PCAPComparison
- Certification exam guides & tipsBlog
- Plans & pricingFree & paid
- Hands-on pcep labsLearn
- PCEP cheat sheetCheat sheet
- How these questions are written and reviewedMethodology
- Report a problem with a questionCorrections
- Python Automation for IT practice examRelated
- PCAP practice examRelated
PCEP practice exam FAQ
How many questions are in the PCEP practice exam on CertGrid?
CertGrid has 861 practice questions for PCEP: Certified Entry-Level Python Programmer, covering 4 exam domains. The real PCEP exam is 30 qs in 40 min. CertGrid's timed mock is a fixed 30 questions.
What is the passing score for PCEP?
The PCEP exam passing score is 70%, and you have about 40 min to complete it. CertGrid scores your practice attempts the same way so you know when you are ready.
Are these official PCEP exam questions?
No. CertGrid is an independent practice platform. We do not provide real or leaked exam questions. Our questions are original and designed to help you practice the concepts, scenarios, and difficulty style of the PCEP: Certified Entry-Level Python Programmer exam.
Is there a free PCEP practice test?
Yes. You can take a free PCEP: Certified Entry-Level Python Programmer practice test straight away: a fixed set of 20 practice questions for this exam, retryable as often as you like, with no credit card required. You get readiness scoring and a weak-domain breakdown on those questions. Paid plans unlock the full 861-question bank, timed mock exams and full-bank domain analytics.
What CertGrid is (and is not)
CertGrid is an independent IT certification practice platform for Azure, AWS, Google, Cisco, Security, Linux, Kubernetes, Terraform, and other certification tracks. It provides objective-mapped practice questions, readiness scoring, weak-domain drills, and explanations to help learners understand what to study next.
Independent & original. CertGrid is not affiliated with or endorsed by Microsoft, AWS, Google, Cisco, CompTIA, the Linux Foundation, HashiCorp, or other certification vendors. Questions are original practice items designed to mirror certification concepts and exam style. CertGrid does not provide official exam questions or braindumps.