Free Python Institute PCEP-30-02 Exam Actual Questions

The questions for PCEP-30-02 were last updated On Jun 12, 2025

At ValidExamDumps, we consistently monitor updates to the Python Institute PCEP-30-02 exam questions by Python Institute. Whenever our team identifies changes in the exam questions,exam objectives, exam focus areas or in exam requirements, We immediately update our exam questions for both PDF and online practice exams. This commitment ensures our customers always have access to the most current and accurate questions. By preparing with these actual questions, our customers can successfully pass the Python Institute PCEP - Certified Entry-Level Python Programmer exam on their first attempt without needing additional materials or study guides.

Other certification materials providers often include outdated or removed questions by Python Institute in their Python Institute PCEP-30-02 exam. These outdated questions lead to customers failing their Python Institute PCEP - Certified Entry-Level Python Programmer exam. In contrast, we ensure our questions bank includes only precise and up-to-date questions, guaranteeing their presence in your actual exam. Our main priority is your success in the Python Institute PCEP-30-02 exam, not profiting from selling obsolete exam questions in PDF or Online Practice Test.

 

Question No. 1

What is the expected result of running the following code?

Show Answer Hide Answer
Correct Answer: C

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.


Question No. 2

What happens when the user runs the following code?

Show Answer Hide Answer
Correct Answer: D

The code snippet that you have sent is a while loop with an if statement and a print statement inside it. The code is as follows:

while True: if counter < 0: print('''') else: print(''**'')

The code starts with entering a while loop that repeats indefinitely, because the condition ''True'' is always true. Inside the loop, the code checks if the value of ''counter'' is less than 0. If yes, it prints a single asterisk () to the screen. If no, it prints three asterisks (**) to the screen. However, the code does not change the value of ''counter'' inside the loop, so the same condition is checked over and over again. The loop never ends, and the code enters an infinite loop.

The program outputs either one asterisk () or three asterisks (**) to the screen repeatedly, depending on the initial value of ''counter''. Therefore, the correct answer is D. The program enters an infinite loop.


Question No. 3

How many hashes (+) does the code output to the screen?

Show Answer Hide Answer
Correct Answer: C

The code snippet that you have sent is a loop that checks if a variable ''floor'' is less than or equal to 0 and prints a string accordingly. The code is as follows:

floor = 5 while floor > 0: print(''+'') floor = floor - 1

The code starts with assigning the value 5 to the variable ''floor''. Then, it enters a while loop that repeats as long as the condition ''floor > 0'' is true. Inside the loop, the code prints a ''+'' symbol to the screen, and then subtracts 1 from the value of ''floor''. The loop ends when ''floor'' becomes 0 or negative, and the code exits.

The code outputs five ''+'' symbols to the screen, one for each iteration of the loop. Therefore, the correct answer is C. five.


Question No. 4

What happens when the user runs the following code?

Show Answer Hide Answer
Correct Answer: B

The code snippet that you have sent is calculating the value of a variable ''total'' based on the values in the range of 0 to 3. The code is as follows:

total = 0 for i in range(0, 3): if i % 2 == 0: total = total + 1 else: total = total + 2 print(total)

The code starts with assigning the value 0 to the variable ''total''. Then, it enters a for loop that iterates over the values 0, 1, and 2 (the range function excludes the upper bound). Inside the loop, the code checks if the current value of ''i'' is even or odd using the modulo operator (%). If ''i'' is even, the code adds 1 to the value of ''total''. If ''i'' is odd, the code adds 2 to the value of ''total''. The loop ends when ''i'' reaches 3, and the code prints the final value of ''total'' to the screen.

The code outputs 2 to the screen, because the value of ''total'' changes as follows:

When i = 0, total = 0 + 1 = 1

When i = 1, total = 1 + 2 = 3

When i = 2, total = 3 + 1 = 4

When i = 3, the loop ends and total = 4 is printed

Therefore, the correct answer is B. The code outputs 2.


Question No. 5

What is the expected output of the following code?

Show Answer Hide Answer
Correct Answer: C

The code snippet that you have sent is a conditional statement that checks if a variable ''counter'' is less than 0, greater than or equal to 42, or neither. The code is as follows:

if counter < 0: print('''') elif counter >= 42: print('''') else: print('''')

The code starts with checking if the value of ''counter'' is less than 0. If yes, it prints a single asterisk () to the screen and exits the statement. If no, it checks if the value of ''counter'' is greater than or equal to 42. If yes, it prints three asterisks () to the screen and exits the statement. If no, it prints two asterisks () to the screen and exits the statement.

The expected output of the code depends on the value of ''counter''. If the value of ''counter'' is 10, as shown in the image, the code will print two asterisks (**) to the screen, because 10 is neither less than 0 nor greater than or equal to 42. Therefore, the correct answer is C. * *