What the PCEP exam covers
- Computer Programming and Python Fundamentals174 questions
- Control Flow - Conditional Blocks and Loops216 questions
- Data Collections - Tuples, Dictionaries, Lists, and Strings208 questions
- Functions and Exceptions210 questions
Free PCEP practice test questions
A sample of 10 questions with answers and explanations. A free account includes a fixed set of 20 practice questions for this exam, retryable anytime. Paid access unlocks the full 808-question bank.
-
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? ```python print("a", "b", "c") ```
- Aa b cCorrect
- Babc
- Ca-b-c
- Da,b,c
✓ Correct answer: Aprint()'s sep parameter defaults to a single space (" ") whenever it is not given explicitly. Passing three separate arguments, "a", "b", and "c", causes print to insert one space between each adjacent pair as it writes them out, producing the single output line a b c, with no extra punctuation or symbols added anywhere.
Why the other options are wrong- B"abc" would only occur if the separator were an empty string; the default separator is a space, not nothing.
- C"a-b-c" would require an explicit sep="-" argument, which is not present in this call; the default is a space.
- D"a,b,c" would require sep=","; commas are not print's default separator between arguments.
-
Which TWO statements about break and continue inside a while loop are correct? (Select TWO.)
- Abreak immediately terminates the nearest enclosing loop.Correct
- Bcontinue skips the rest of the current iteration and returns to test the loop condition.Correct
- Ccontinue terminates the whole loop, just like break.
- Dbreak causes the loop's else clause to run.
✓ Correct answer: A, Bbreak ends the nearest enclosing loop right away. continue abandons only the current iteration and jumps back to re-evaluate the while condition.
Why the other options are wrong- Ccontinue does not end the loop; it only skips the remainder of the current pass.
- DLeaving a loop by break skips its else clause; the else runs only on normal completion.
-
What is printed by the following snippet? ```python print('a' and 'b') ```
- AbCorrect
- Ba
- CTrue
- Dab
✓ Correct answer: AThe and operator returns the second operand when the first is truthy. A non-empty string like 'a' is truthy, so and does not stop at it and instead returns the second operand 'b', which is printed.
Why the other options are wrong- Band returns the left operand only when it is falsy; 'a' is a non-empty, truthy string, so and continues past it.
- Cand returns the actual string operand 'b', not the boolean True.
- Dand returns one of the operands unchanged; it does not join or concatenate them into ab.
-
What is printed by the following snippet? ```python a = [1, 2, 3] b = a b.append(4) print(a) ```
- A[1, 2, 3, 4]Correct
- B[1, 2, 3]
- C[4, 1, 2, 3]
- DError
✓ Correct answer: Ab = a makes b an alias for the same list object, so appending through b also changes what a refers to.
Why the other options are wrong- Bb = a does not copy; b and a are the same list, so the append is visible through a.
- Cappend adds to the end, so the resulting order is [1, 2, 3, 4].
- DThe code is valid and prints a list, not an error.
-
Which of the following statements about tuple methods is correct?
- ATuples provide an append method for adding new elements
- BTuples provide an append method but no remove method
- CTuples share every method that lists provide, including append
- DTuples have no append method and offer only count and indexCorrect
✓ Correct answer: DBecause tuples are immutable, they cannot grow, so they provide no append method. append belongs to lists. The only two methods a tuple offers are count and index.
Why the other options are wrong- Aappend is a list method; tuples cannot add elements.
- BTuples have neither append nor remove because they are immutable.
- CTuples expose far fewer methods than lists, only count and index.
-
Which of the following statements about keyword arguments is correct?
- AKeyword arguments must still follow the order of the parameters
- BKeyword arguments can only be used when a function has one parameter
- CKeyword arguments bind by position, so their order matters
- DKeyword arguments bind by name, so they may be supplied in any orderCorrect
✓ Correct answer: DA keyword argument names the parameter it fills, so the interpreter matches it by name rather than by position. Because of that, the order in which keyword arguments appear in the call does not matter.
Why the other options are wrong- ASince keyword arguments bind by name, they need not follow parameter order.
- BKeyword arguments work with any number of parameters.
- CKeyword arguments bind by name, not by position.
-
What is printed by the following snippet? ```python try: raise KeyError('k') except KeyError: print('key handled') ```
- Ak
- Bkey handledCorrect
- CKeyError: k
- DNothing is printed
✓ Correct answer: Braise KeyError('k') creates a KeyError exception. Python looks for a matching except clause; except KeyError matches exactly, so control jumps into that block instead of propagating the error. The block executes print('key handled'), which sends that text to standard output. The traceback message and the key value itself are never displayed.
Why the other options are wrong- A"k" is the value passed to KeyError, but that value is never printed; only the except block's print statement runs.
- C"KeyError: k" is the format an unhandled traceback would show, but here the exception is caught, so no traceback is printed.
- DThe exception is caught by the except block, so the print statement inside it does execute and produces output.
-
What happens when this snippet runs? ```python i = 0 while i < 3: if i == 1: continue print(i) i += 1 ```
- A0 is output and the loop never endsCorrect
- B0 and 2 are output and it ends
- C0, 1 and 2 are output and it ends
- DAn IndentationError is raised
✓ Correct answer: AThe first pass outputs 0 and raises i to 1. On the next pass continue jumps straight back to the test without reaching the increment, so i stays at 1 and the same thing happens forever. This is the standard hazard of continue inside a while loop: anything that advances the loop variable must come before the continue, or be written as a for loop over a range where advancement is automatic.
Why the other options are wrong- Bi never reaches 2 because it stops being incremented.
- CThe value 1 is skipped by the continue.
- DThe indentation is valid; the fault is behavioural.
-
What is the output of the following code? ```python x = 5 if x <= 5: print("yes") else: print("no") ```
- AyesCorrect
- Bno
- C"yes"
- D(no output)
✓ Correct answer: AThe <= operator is True when the left side is less than OR equal to the right. 5 <= 5 is True because they are equal, so yes prints.
Why the other options are wrong- Bno would require 5 <= 5 to be False, but equal values satisfy <=.
- Cprint writes the text without its quotation marks, so the output is yes, not "yes".
- DOne branch of the if / else always runs.
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 808 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 808-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.