Python Institute PCEP-30-02 Practice Exam Questions & Answers

6 Free Questions · Last reviewed: September 26, 2026 · Prepared & Reviewed by the ValidExamDumps Editorial Team

Exam Facts

Python Institute PCEP-30-02 Exam Details

Key details for this exam, checked against the published exam outline

30 Practice Questions (Our Bank)
40 minutes Exam Duration
70% Passing Score
USD 59 Official Exam Fee
Exam Code
PCEP-30-02
Full Name
PCEP - Certified Entry-Level Python Programmer
Issuing Body
Python Institute
Question Format (Our Bank)
Multiple Choice, Drag & Drop
Delivery
Online proctored via TestNow platform or at authorized testing centers
Eligibility
None
Validity
Lifetime
Practice Questions

Free PCEP-30-02 Practice Questions

Each question shows the correct answer and an explanation of why it is right

VA
ValidExamDumps Editorial Team Every question and its answer is checked by our PCEP-30-02 exam preparation team, who also write the explanation shown with each one. How we research and review these pages

What is the expected result of running the following code?

Correct Answer: C
Explanation

The code snippet that you have sent is trying to use the index method to find the position of a value in a list. The code is as follows:

the_list = [1, 2, 3, 4, 5] print(the_list.index(6))

The code starts with creating a list called ''the_list'' that contains the numbers 1, 2, 3, 4, and 5. Then, it tries to print the result of calling the index method on the list with the argument 6. The index method is used to return the first occurrence of a value in a list. For example, the_list.index(1) returns 0, because 1 is the first value in the list.

However, the code has a problem. The problem is that the value 6 is not present in the list, so the index method cannot find it. This will cause a ValueError exception, which is an error that occurs when a function or operation receives an argument that has the right type but an inappropriate value. The code does not handle the exception, and therefore it will terminate with an error message.

The expected result of the code is an unhandled exception, because the code tries to find a value that does not exist in the list. Therefore, the correct answer is C. The code raises an unhandled exception.

Assuming that the following assignment has been successfully executed:

Which of the following expressions evaluate to True? (Select two expressions.)

Correct Answer: C, D
Explanation

The code snippet that you have sent is assigning a list of four values to a variable called ''the_list''. The code is as follows:

the_list = ['1', 1, 1, 1]

The code creates a list object that contains the values '1', 1, 1, and 1, and assigns it to the variable ''the_list''. The list can be accessed by using the variable name or by using the index of the values. The index starts from 0 for the first value and goes up to the length of the list minus one for the last value. The index can also be negative, in which case it counts from the end of the list. For example, the_list[0] returns '1', and the_list[-1] returns 1.

The expressions that you have given are trying to evaluate some conditions on the list and return a boolean value, either True or False. Some of them are valid, and some of them are invalid and will raise an exception. An exception is an error that occurs when the code cannot be executed properly. The expressions are as follows:

A) the_List.index {''1''} in the_list: This expression is trying to check if the index of the value '1' in the list is also a value in the list. However, this expression is invalid, because it uses curly brackets instead of parentheses to call the index method. The index method is used to return the first occurrence of a value in a list. For example, the_list.index('1') returns 0, because '1' is the first value in the list. However, the_list.index {''1''} will raise a SyntaxError exception and output nothing.

B) 1.1 in the_list |1:3 |: This expression is trying to check if the value 1.1 is present in a sublist of the list. However, this expression is invalid, because it uses a vertical bar instead of a colon to specify the start and end index of the sublist. The sublist is obtained by using the slicing operation, which uses square brackets and a colon to get a part of the list. For example, the_list[1:3] returns [1, 1], which is the sublist of the list from the index 1 to the index 3, excluding the end index. However, the_list |1:3 | will raise a SyntaxError exception and output nothing.

C) len (the list [0:2]} <3: This expression is trying to check if the length of a sublist of the list is less than 3. This expression is valid, because it uses the len function and the slicing operation correctly. The len function is used to return the number of values in a list or a sublist. For example, len(the_list) returns 4, because the list has four values. The slicing operation is used to get a part of the list by using square brackets and a colon. For example, the_list[0:2] returns ['1', 1], which is the sublist of the list from the index 0 to the index 2, excluding the end index. The expression len (the list [0:2]} <3 returns True, because the length of the sublist ['1', 1] is 2, which is less than 3.

D) the_list. index {'1'} -- 0: This expression is trying to check if the index of the value '1' in the list is equal to 0. This expression is valid, because it uses the index method and the equality operator correctly. The index method is used to return the first occurrence of a value in a list. For example, the_list.index('1') returns 0, because '1' is the first value in the list. The equality operator is used to compare two values and return True if they are equal, or False if they are not. For example, 0 == 0 returns True, and 0 == 1 returns False. The expression the_list. index {'1'} -- 0 returns True, because the index of '1' in the list is 0, and 0 is equal to 0.

Therefore, the correct answers are C. len (the list [0:2]} <3 and D. the_list. index {'1'} -- 0.

What is true about tuples? (Select two answers.)

Correct Answer: A, D
Explanation

Tuples are one of the built-in data types in Python that are used to store collections of data. Tuples have some characteristics that distinguish them from other data types, such as lists, sets, and dictionaries. Some of these characteristics are:

Tuples are immutable, which means that their contents cannot be changed during their lifetime. Once a tuple is created, it cannot be modified, added, or removed. This makes tuples more stable and reliable than mutable data types. However, this also means that tuples are less flexible and dynamic than mutable data types.For example, if you want to change an element in a tuple, you have to create a new tuple with the modified element and assign it to the same variable12

Tuples are ordered, which means that the items in a tuple have a defined order and can be accessed by using their index. The index of a tuple starts from 0 for the first item and goes up to the length of the tuple minus one for the last item. The index can also be negative, in which case it counts from the end of the tuple. For example, if you have a tuplet = ('a', 'b', 'c'), thent[0]returns'a', andt[-1]returns'c'12

Tuples can be indexed and sliced like lists, which means that you can get a single item or a sublist of a tuple by using square brackets and specifying the start and end index. For example, if you have a tuplet = ('a', 'b', 'c', 'd', 'e'), thent[2]returns'c', andt[1:4]returns('b', 'c', 'd'). Slicing does not raise any exception, even if the start or end index is out of range.It will just return an empty tuple or the closest possible sublist12

Tuples can contain any data type, such as strings, numbers, booleans, lists, sets, dictionaries, or even other tuples. Tuples can also have duplicate values, which means that the same item can appear more than once in a tuple. For example, you can have a tuplet = (1, 2, 3, 1, 2), which contains two 1s and two 2s12

Tuples are written with round brackets, which means that you have to enclose the items in a tuple with parentheses. For example, you can create a tuplet = ('a', 'b', 'c')by using round brackets. However, you can also create a tuple without using round brackets, by just separating the items with commas. For example, you can create the same tuplet = 'a', 'b', 'c'by using commas.This is called tuple packing, and it allows you to assign multiple values to a single variable12

The len() function can be applied to tuples, which means that you can get the number of items in a tuple by using the len() function. For example, if you have a tuplet = ('a', 'b', 'c'), thenlen(t)returns 312

An empty tuple is written as (), which means that you have to use an empty pair of parentheses to create a tuple with no items. For example, you can create an empty tuplet = ()by using empty parentheses. However, if you want to create a tuple with only one item, you have to add a comma after the item, otherwise Python will not recognize it as a tuple. For example, you can create a tuple with one itemt = ('a',)by using a comma12

Therefore, the correct answers are A. Tuples are immutable, which means that their contents cannot be changed during their lifetime. and D. Tuples can be indexed and sliced like lists.

Assuming that the following assignment has been successfully executed:

My_list -- [1, 1, 2, 3]

Select the expressions which will not raise any exception.

(Select two expressions.)

Correct Answer: B, D
Explanation

The code snippet that you have sent is assigning a list of four numbers to a variable called ''my_list''. The code is as follows:

my_list = [1, 1, 2, 3]

The code creates a list object that contains the elements 1, 1, 2, and 3, and assigns it to the variable ''my_list''. The list can be accessed by using the variable name or by using the index of the elements. The index starts from 0 for the first element and goes up to the length of the list minus one for the last element. The index can also be negative, in which case it counts from the end of the list. For example, my_list[0] returns 1, and my_list[-1] returns 3.

The code also allows some operations on the list, such as slicing, concatenation, repetition, and membership. Slicing is used to get a sublist of the original list by specifying the start and end index. For example, my_list[1:3] returns [1, 2]. Concatenation is used to join two lists together by using the + operator. For example, my_list + [4, 5] returns [1, 1, 2, 3, 4, 5]. Repetition is used to create a new list by repeating the original list a number of times by using the * operator. For example, my_list * 2 returns [1, 1, 2, 3, 1, 1, 2, 3]. Membership is used to check if an element is present in the list by using the in operator. For example, 2 in my_list returns True, and 4 in my_list returns False.

The expressions that you have given are trying to access or manipulate the list in different ways. Some of them are valid, and some of them are invalid and will raise an exception. An exception is an error that occurs when the code cannot be executed properly. The expressions are as follows:

A) my_list[-10]: This expression is trying to access the element at the index -10 of the list. However, the list only has four elements, so the index -10 is out of range. This will raise an IndexError exception and output nothing.

B) my_list|my_Li1st | 3| I: This expression is trying to perform a bitwise OR operation on the list and some other operands. The bitwise OR operation is used to compare the binary representation of two numbers and return a new number that has a 1 in each bit position where either number has a 1. For example, 3 | 1 returns 3, because 3 in binary is 11 and 1 in binary is 01, and 11 | 01 is 11. However, the bitwise OR operation cannot be applied to a list, because a list is not a number. This will raise a TypeError exception and output nothing.

C) my list [6]: This expression is trying to access the element at the index 6 of the list. However, the list only has four elements, so the index 6 is out of range. This will raise an IndexError exception and output nothing.

D) my_List- [0:1]: This expression is trying to perform a subtraction operation on the list and a sublist. The subtraction operation is used to subtract one number from another and return the difference. For example, 3 - 1 returns 2. However, the subtraction operation cannot be applied to a list, because a list is not a number. This will raise a TypeError exception and output nothing.

Only two expressions will not raise any exception. They are:

B) my_list|my_Li1st | 3| I: This expression is not a valid Python code, but it is not an expression that tries to access or manipulate the list. It is just a string of characters that has no meaning. Therefore, it will not raise any exception, but it will also not output anything.

D) my_List- [0:1]: This expression is a valid Python code that uses the slicing operation to get a sublist of the list. The slicing operation does not raise any exception, even if the start or end index is out of range. It will just return an empty list or the closest possible sublist. For example, my_list[0:10] returns [1, 1, 2, 3], and my_list[10:20] returns []. The expression my_List- [0:1] returns the sublist of the list from the index 0 to the index 1, excluding the end index. Therefore, it returns [1]. This expression will not raise any exception, and it will output [1].

Therefore, the correct answers are B. my_list|my_Li1st | 3| I and D. my_List- [0:1].

Which of the following are the names of Python passing argument styles?

(Select two answers.)

Correct Answer: A, D

A set of rules which defines the ways in which words can be coupled in sentences is called:

Correct Answer: B
Explanation

Syntax is the branch of linguistics that studies the structure and rules of sentences in natural languages. Lexis is the vocabulary of a language. Semantics is the study of meaning in language. A dictionary is a collection of words and their definitions, synonyms, pronunciations, etc.

Full Access

Get the complete PCEP-30-02 question set

  • 30 questions covering all exam domains
  • Correct answers with explanations, like the free questions above
  • PDF and online practice test
  • 90 days of free updates
Starting from 50% OFF
$20 $40
Get Full Access

One-time payment · Instant download

Study Guide

What the Python Institute PCEP-30-02 Exam Covers

Exam domains verified against: Official Python Institute PCEP-30-02 exam guide, last checked September 2026.

Domain 1: Computer Programming Fundamentals

Covers interpreters, compilers, syntax, and semantics. Assesses Python essentials including keywords, instructions, indentation, and commenting. Includes data types (Booleans, integers, floats, strings), variable usage, naming conventions, and operator types (arithmetic, string, assignment, bitwise, Boolean, and relational).

Sample question from this domain above: Q5

Domain 2: Control Flow 29%

Tests conditional statements such as if, if-else, if-elif, and if-elif-else. Evaluates looping structures like while and for loops, including use of range. Covers loop control mechanisms and nesting of both loops and conditional statements.

Sample questions from this domain above: Q2Q4

Domain 3: Data Collections 25%

Focuses on working with data structures including lists (creation, indexing, slicing, method usage, list comprehensions) and tuples. Evaluates proficiency with dictionaries and string manipulation, including construction, indexing, and relevant methods.

Sample question from this domain above: Q3

Domain 4: Functions and Exceptions 28%

Examines ability to define and invoke functions, understand parameter passing, arguments, and scope rules. Includes assessment of recursion concepts and Python's exception hierarchy. Tests knowledge of exception-handling techniques, including try-except blocks.

Sample questions from this domain above: Q1Q6

FAQ

PCEP-30-02 Exam FAQ

Common questions about the exam itself

What experience do I need before sitting PCEP-30-02?
No formal prerequisites exist. You should be familiar with basic programming concepts like variables, conditions, loops, and functions before attempting PCEP-30-02, but you do not need professional experience or prior certifications.
How long should I study for PCEP-30-02?
Most candidates prepare for 3 to 5 weeks, though this depends on your starting experience. If basic programming concepts feel like a foreign language to you, budget 6 to 8 weeks instead. This exam has a tight time budget, so structured practice with timed questions is essential.
What makes PCEP-30-02 hard or easy compared to other certifications?
PCEP-30-02 is an entry-level exam and the most affordable in the Python Institute track. The difficulty lies not in concept depth but in speed and precision, you must answer 30 questions in 40 minutes with no partial credit. Control Flow and Functions and Exceptions together carry 57 percent of the exam weight.
How many questions can I get wrong and still pass PCEP-30-02?
You need 70 percent to pass. With 30 questions, you can answer approximately 9 questions incorrectly and still pass. Since there is no penalty for wrong answers, you should attempt every question.
What question types appear on PCEP-30-02?
The exam uses single-select multiple choice, multiple-select multiple choice, drag-and-drop, gap fill, code fill, code insertion, and interactive scenario-based questions. Many questions require you to assemble working code rather than just identify problems.
Can I retake PCEP-30-02 if I fail?
Yes, you can retake the exam. A single-shot exam costs USD 59, while a voucher with one retake included costs USD 76.70. There is no published limit on retake attempts.
Does PCEP-30-02 expire, and do I need to recertify?
No. PCEP-30-02 is a lifetime certification. Once you pass, your credential never expires and requires no recertification fee or continuing education credits.
How does PCEP-30-02 relate to PCAP and the higher Python certs?
PCEP-30-02 is entry-level and a stepping stone to PCAP (Associate level). PCEP covers functions, exceptions, and built-in collections but stops there. PCAP and PCPP levels require classes, modules, file handling, and more advanced design. PCAP and PCPP do not require you to hold PCEP first, though PCEP provides a low-cost rehearsal.
Where do I sit PCEP-30-02, and what do I need on exam day?
The exam is delivered online via TestNow, the Python Institute's secure proctoring platform. You can take it from home with a webcam and remote proctor, or at an authorized testing center. You will need a valid photo ID and a computer with a stable internet connection.
What job role does PCEP-30-02 prepare me for?
PCEP-30-02 validates foundational skills for entry-level Python programmer and junior developer roles. It demonstrates to employers that you understand Python syntax, can write small programs independently, and grasp core concepts needed for progression to more advanced roles.