Python Institute PCEP-30-02 Exam Dumps, Practice Test Questions

100% Latest & Updated Python Institute PCEP-30-02 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!

Python Institute PCEP-30-02  Premium File
$54.99
$49.99

PCEP-30-02 Premium File

  • Premium File: 481 Questions & Answers. Last update: Nov 25, 2026
  • Latest Questions
  • 100% Accurate Answers
  • Fast Exam Updates

PCEP-30-02 Premium File

Python Institute PCEP-30-02  Premium File
  • Premium File: 481 Questions & Answers. Last update: Nov 25, 2026
  • Latest Questions
  • 100% Accurate Answers
  • Fast Exam Updates
$54.99
$49.99

Python Institute PCEP-30-02 Practice Test 40

Question 390

A developer tests exceptions propagate across function calls. The following code prints 'bad'. Which explanation best accounts for that observed behavior?def g(): return int("no") try: g() except ValueError: print("bad")

  1. A recursive function must reach a base case; factorial multiplies n by factorial(n-1) until n<=1.
  2. Once a function returns, the remaining statements in that function call are not executed.
  3. A global declaration makes assignment inside the function modify the module-level name.
  4. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

Explanation

Correct Answer

D:

This is the operative language rule for the code. It directly explains why the example prints 'bad'; the displayed behavior was independently reproduced by a Python 3 execution check.

Incorrect Answers

A:

The recursive factorial base case topic does not explain why the code prints 'bad'. The relevant Python rule is: An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

B:

The early return versus later statements topic does not explain why the code prints 'bad'. The relevant Python rule is: An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

C:

The global declaration changes module binding topic does not explain why the code prints 'bad'. The relevant Python rule is: An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

Question 391

A learner is checking exceptions propagate across function calls. After this modification, what does Python 3 actually do?def f(): return [1][8] try: f() except KeyError: print("wrong")

  1. Raises IndexError
  2. Raises KeyError
  3. Raises ValueError
  4. Raises TypeError

Explanation

Correct Answer

A:

The snippet raises indexerror. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

Incorrect Answers

B:

This predicts that the snippet raises keyerror, but executing the displayed Python 3 code raises indexerror. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

C:

This predicts that the snippet raises valueerror, but executing the displayed Python 3 code raises indexerror. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

D:

This predicts that the snippet raises typeerror, but executing the displayed Python 3 code raises indexerror. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

Question 392

During a review of exceptions propagate across function calls, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: def g(): return int("no") try: g() except ValueError: print("bad") Program B: def f(): return [1][8] try: f() except KeyError: print("wrong") Program C: def f(): return 8//2 try: print(f()) except ZeroDivisionError: print("error")

  1. Program B raises indexerror.
  2. Program A prints 'bad'.
  3. Program C prints '3'.
  4. Program A prints '[1]'.
  5. Program B raises valueerror.
  6. Program C prints '4'.

Explanation

Correct Answers

A:

Running Program B raises indexerror. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

B:

Running Program A prints 'bad'. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

F:

Running Program C prints '4'. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

Incorrect Answers

C:

Program C does not produce '3'; its verified result is: Prints '4'. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

D:

Program A does not produce '[1]'; its verified result is: Prints 'bad'. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

E:

Program B does not raises valueerror; its verified result is: Raises IndexError. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

Question 393

A learner is checking specific versus incorrect exception catch. What is the exact printed result or uncaught exception?try: print(4/0) except ValueError: print("value")

  1. Raises ZeroDivisionError
  2. Raises TypeError
  3. Raises IndexError
  4. Raises KeyError

Explanation

Correct Answer

A:

The snippet raises zerodivisionerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

Incorrect Answers

B:

This predicts that the snippet raises typeerror, but executing the displayed Python 3 code raises zerodivisionerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

C:

This predicts that the snippet raises indexerror, but executing the displayed Python 3 code raises zerodivisionerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

D:

This predicts that the snippet raises keyerror, but executing the displayed Python 3 code raises zerodivisionerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

Question 394

A developer tests specific versus incorrect exception catch. The following code raises keyerror. Which explanation best accounts for that observed behavior?try: print({}["x"]) except IndexError: print("index")

  1. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.
  2. An absent list index produces IndexError whereas a missing dictionary key produces KeyError.
  3. The result returned by one function can be passed directly as an argument to another function.
  4. int raises ValueError for text that cannot represent an integer; incompatible argument types raise TypeError.

Explanation

Correct Answer

A:

This is the operative language rule for the code. It directly explains why the example raises keyerror; the displayed behavior was independently reproduced by a Python 3 execution check.

Incorrect Answers

B:

The IndexError and KeyError distinct topic does not explain why the code raises keyerror. The relevant Python rule is: An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

C:

The function call composition topic does not explain why the code raises keyerror. The relevant Python rule is: An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

D:

The ValueError versus TypeError in conversion topic does not explain why the code raises keyerror. The relevant Python rule is: An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

Question 395

A learner is checking specific versus incorrect exception catch. After this modification, what does Python 3 actually do?try: print(int("q")) except TypeError: print("type")

  1. Raises TypeError
  2. Raises KeyError
  3. Raises IndexError
  4. Raises ValueError

Explanation

Correct Answer

D:

The snippet raises valueerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

Incorrect Answers

A:

This predicts that the snippet raises typeerror, but executing the displayed Python 3 code raises valueerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

B:

This predicts that the snippet raises keyerror, but executing the displayed Python 3 code raises valueerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

C:

This predicts that the snippet raises indexerror, but executing the displayed Python 3 code raises valueerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

Question 396

During a review of specific versus incorrect exception catch, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: try: print({}["x"]) except IndexError: print("index") Program B: try: print(int("q")) except TypeError: print("type") Program C: try: print([1][4]) except LookupError: print("lookup")

  1. Program C prints '(1, 2)'.
  2. Program A prints 'lookup'.
  3. Program A raises keyerror.
  4. Program B raises valueerror.
  5. Program C prints 'lookup'.
  6. Program B prints 'hi\nnone'.

Explanation

Correct Answers

C:

Running Program A raises keyerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

D:

Running Program B raises valueerror. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

E:

Running Program C prints 'lookup'. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

Incorrect Answers

A:

Program C does not produce '(1, 2)'; its verified result is: Prints 'lookup'. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

B:

Program A does not produce 'lookup'; its verified result is: Raises KeyError. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

F:

Program B does not produce 'hi\nnone'; its verified result is: Raises ValueError. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

Question 397

A learner is checking nested try except responsibility. What is the exact printed result or uncaught exception?try: try: int("no") except ValueError: print("inner") except Exception: print("outer")

  1. Prints 'renni'
  2. Prints 'inner'
  3. Prints 'inne'
  4. Prints 'inner?'

Explanation

Correct Answer

B:

The snippet prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

Incorrect Answers

A:

This predicts that the snippet prints 'renni', but executing the displayed Python 3 code prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

C:

This predicts that the snippet prints 'inne', but executing the displayed Python 3 code prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

D:

This predicts that the snippet prints 'inner?', but executing the displayed Python 3 code prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

Question 398

A developer tests nested try except responsibility. The following code prints 'outer'. Which explanation best accounts for that observed behavior?try: try: print(1/0) except ValueError: print("inner") except ZeroDivisionError: print("outer")

  1. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.
  2. The result returned by one function can be passed directly as an argument to another function.
  3. Positional arguments may precede named arguments, but a single parameter cannot receive two values.
  4. int raises ValueError for text that cannot represent an integer; incompatible argument types raise TypeError.

Explanation

Correct Answer

A:

This is the operative language rule for the code. It directly explains why the example prints 'outer'; the displayed behavior was independently reproduced by a Python 3 execution check.

Incorrect Answers

B:

The function call composition topic does not explain why the code prints 'outer'. The relevant Python rule is: An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

C:

The mixed positional and keyword calls topic does not explain why the code prints 'outer'. The relevant Python rule is: An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

D:

The ValueError versus TypeError in conversion topic does not explain why the code prints 'outer'. The relevant Python rule is: An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

Question 399

A learner is checking nested try except responsibility. After this modification, what does Python 3 actually do?try: try: print([1][5]) except IndexError: print("inner") except LookupError: print("outer")

  1. Prints 'inner?'
  2. Prints 'inne'
  3. Prints 'inner'
  4. Prints 'renni'

Explanation

Correct Answer

C:

The snippet prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

Incorrect Answers

A:

This predicts that the snippet prints 'inner?', but executing the displayed Python 3 code prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

B:

This predicts that the snippet prints 'inne', but executing the displayed Python 3 code prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

D:

This predicts that the snippet prints 'renni', but executing the displayed Python 3 code prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

Question 400

During a review of nested try except responsibility, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: try: try: print(1/0) except ValueError: print("inner") except ZeroDivisionError: print("outer") Program B: try: try: print([1][5]) except IndexError: print("inner") except LookupError: print("outer") Program C: try: try: print({}["x"]) except TypeError: print("inner") except KeyError: print("outer")

  1. Program B prints 'inner'.
  2. Program A prints 'outer'.
  3. Program C prints 'outer'.
  4. Program B prints 'broad'.
  5. Program A prints 'false'.
  6. Program C prints 'other'.

Explanation

Correct Answers

A:

Running Program B prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

B:

Running Program A prints 'outer'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

C:

Running Program C prints 'outer'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

Incorrect Answers

D:

Program B does not produce 'broad'; its verified result is: Prints 'inner'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

E:

Program A does not produce 'false'; its verified result is: Prints 'outer'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

F:

Program C does not produce 'other'; its verified result is: Prints 'outer'. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.

PCEP - Certified Entry-Level Python Programmer (PCEP-30-02) Practice Tests

UP

SPECIAL OFFER: GET 10% OFF

This is ONE TIME OFFER

ExamSnap Discount Offer
Enter Your Email Address to Receive Your 10% Off Discount Code

A confirmation link will be sent to this email address to verify your login. *We value your privacy. We will not rent or sell your email address.

Download Free Demo of VCE Exam Simulator

Experience Avanset VCE Exam Simulator for yourself.

Simply submit your e-mail address below to get started with our interactive software demo of your free trial.

Free Demo Limits: In the demo version you will be able to access only first 5 questions from exam.