What the PCEP exam covers
- Computer Programming and Python Fundamentals174 questions
- Control Flow - Conditional Blocks and Loops213 questions
- Data Collections - Tuples, Dictionaries, Lists, and Strings206 questions
- Functions and Exceptions208 questions
Free PCEP sample questions
A sample of 10 questions with answers and explanations. Sign up free to practice all 801.
-
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 ** 10)
- A100
- B20
- C512
- D1024Correct
✓ Correct answer: DThe ** operator raises the left number to the power of the right number, so 2 ** 10 means 2 multiplied by itself ten times. That product is 1024, a familiar power of two.
Why the other options are wrong- A100 is 10 ** 2 (ten squared); here the base and exponent are the other way around.
- B20 is 2 * 10, which treats ** as multiplication rather than exponentiation.
- C512 is 2 ** 9, one power short of 2 ** 10.
-
What is the output of the following code? n = 4 if n % 2 == 0: print("even") elif n > 2: print("big") else: print("other")
- AevenCorrect
- Bbig
- Cother
- Deven big
✓ Correct answer: An % 2 == 0 is True (4 is even), so the if block prints even. Even though n > 2 is also True, the elif is skipped because an earlier branch already matched.
Why the other options are wrong- Bbig never runs here: the elif is only tested when the if condition is False.
- Cother is the else branch, reached only when every earlier test fails.
- DAt most one branch in an if / elif / else chain executes.
-
When is the condition of a while loop tested?
- AAfter each iteration, so the body always runs at least once
- BOnly one time, just before the loop begins
- COnly after the first iteration has finished
- DBefore every iteration, including the first, so the body may run zero timesCorrect
✓ Correct answer: DA while loop tests its condition before every iteration, including the very first one, so if the condition is false at the start the body never runs. This is why a while loop can execute zero times. A loop that always runs at least once would be a post-test loop, which Python's while is not.
Why the other options are wrong- AThat describes a post-test loop; Python's while tests before the body, so it may run zero times.
- BThe condition is re-tested before each iteration, not only once at the start.
- CThe condition is checked before the first iteration too, not just after it.
-
What is printed by the following snippet? print(bool([]))
- AFalseCorrect
- BTrue
- CNone
- D0
✓ Correct answer: Abool() reports the truth value of whatever it is given. In Python any empty container counts as falsy, and [] is an empty list, so bool([]) returns False. A list is only truthy once it holds at least one item.
Why the other options are wrong- BA list is truthy only when it has at least one element; this list is empty, so bool([]) is False.
- Cbool() always returns a boolean (True or False), never None.
- DThe result is the boolean False, printed as the word False, not the integer 0.
-
What is printed by the following snippet? lst = [1, 2, 3] lst[0] = 10 print(lst)
- A[10, 2, 3]Correct
- B[1, 2, 10]
- C[10, 1, 2, 3]
- D[1, 10, 2, 3]
✓ Correct answer: ALists are mutable, so assigning to lst[0] replaces the value stored at that position. Index 0 is the first element, so 1 is overwritten by 10, giving [10, 2, 3].
Why the other options are wrong- B[1, 2, 10] would change the last element, but index 0 refers to the first position.
- C[10, 1, 2, 3] inserts a new value, but assignment replaces the existing element rather than adding one.
- D[1, 10, 2, 3] would change index 1; here index 0, the first element, is the one being set.
-
What is printed by the following snippet? print((1, 2) == (1, 2))
- ATrueCorrect
- BFalse
- C(1, 2)
- DA TypeError is raised
✓ Correct answer: ATwo tuples compare equal with == when they have the same length and equal elements in the same order. Both tuples are (1, 2), so the result is True.
Why the other options are wrong- BThe tuples have identical contents, so they are equal, not unequal.
- CThe == operator returns a Boolean, not one of the tuples.
- DComparing tuples with == is valid and raises no error.
-
What is printed by the following snippet? def volume(length, width, height=1): return length * width * height print(volume(2, 3))
- A6Correct
- B5
- C0
- DNone
✓ Correct answer: AOnly two arguments are passed, so height uses its default of 1. The result is 2 * 3 * 1, which is 6.
Why the other options are wrong- B5 would be 2 + 3, but the body multiplies the three values.
- C0 would require height to be 0, but its default is 1.
- DThe function returns a number via return, so it is not None.
-
Which TWO statements about the global keyword are correct? Select TWO.
- AIt lets a function assign a new value to a global variable.Correct
- BIt must be used to read a global variable's value.
- CWithout it, an assignment to a name inside a function creates a local variable.Correct
- DIt creates a brand-new local variable each time the function runs.
✓ Correct answer: A, Cglobal tells Python that assignments to the name inside the function should target the module-level variable. Without global, any assignment to a name in a function makes that name local. Reading a global never requires global.
Why the other options are wrong- BReading a global variable inside a function needs no keyword; global is only required to assign to it.
- Dglobal does the opposite of creating a local: it binds the name to the global, not a fresh local.
-
In what order are the lines printed by the following snippet? try: print('try') except ValueError: print('except') else: print('else') finally: print('finally')
- Atry, except, finally
- Btry, finally
- Ctry, else, except, finally
- Dtry, else, finallyCorrect
✓ Correct answer: DThe try block succeeds, so the except branch is skipped, the else branch runs, and the finally branch always runs last.
Why the other options are wrong- AThe except branch runs only when a matching exception is raised.
- BThe else branch runs after a successful try, so else prints too.
- CThe except branch is skipped when no exception is raised.
Related Python resources
- PCEP study guideKey concepts
- Python practice examsAll Python
- Certification pathWhere this fits
- Certification exam guides & tipsBlog
- Plans & pricingFree & paid
- PCAP practice examRelated
- Python Automation for IT practice examRelated
PCEP practice exam FAQ
How many questions are in the PCEP practice exam on CertGrid?
CertGrid has 801 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.
Can I practice PCEP for free?
Yes. You can start practicing PCEP: Certified Entry-Level Python Programmer for free with daily practice and sample questions. Paid plans unlock full timed exams, complete explanations, and 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 an independent practice platform and is not affiliated with or endorsed by Python. Questions are original practice items designed to mirror certification concepts and exam style. CertGrid does not provide official exam questions or braindumps.