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 39

Question 380

During a review of IndexError and KeyError distinct, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: print({"x":1}["y"]) Program B: print([5,6][-1]) Program C: print({"a":9}["a"])

  1. Program B prints '5'.
  2. Program A prints '[1, 7]'.
  3. Program B prints '6'.
  4. Program C prints '9'.
  5. Program C prints '2'.
  6. Program A raises keyerror.

Explanation

Correct Answers

C:

Running Program B prints '6'. An absent list index produces IndexError whereas a missing dictionary key produces KeyError.

D:

Running Program C prints '9'. An absent list index produces IndexError whereas a missing dictionary key produces KeyError.

F:

Running Program A raises keyerror. An absent list index produces IndexError whereas a missing dictionary key produces KeyError.

Incorrect Answers

A:

Program B does not produce '5'; its verified result is: Prints '6'. An absent list index produces IndexError whereas a missing dictionary key produces KeyError.

B:

Program A does not produce '[1, 7]'; its verified result is: Raises KeyError. An absent list index produces IndexError whereas a missing dictionary key produces KeyError.

E:

Program C does not produce '2'; its verified result is: Prints '9'. An absent list index produces IndexError whereas a missing dictionary key produces KeyError.

Question 381

A learner is checking exact exception handler selection. What is the exact printed result or uncaught exception?try: n=1/0 except ZeroDivisionError: print("caught")

  1. Prints 'caugh'
  2. Prints 'caught'
  3. Prints 'thguac'
  4. Prints 'caught?'

Explanation

Correct Answer

B:

The snippet prints 'caught'. The except clause matching the raised exception class handles the error and allows execution to continue.

Incorrect Answers

A:

This predicts that the snippet prints 'caugh', but executing the displayed Python 3 code prints 'caught'. The except clause matching the raised exception class handles the error and allows execution to continue.

C:

This predicts that the snippet prints 'thguac', but executing the displayed Python 3 code prints 'caught'. The except clause matching the raised exception class handles the error and allows execution to continue.

D:

This predicts that the snippet prints 'caught?', but executing the displayed Python 3 code prints 'caught'. The except clause matching the raised exception class handles the error and allows execution to continue.

Question 382

A developer tests exact exception handler selection. The following code prints 'bad integer'. Which explanation best accounts for that observed behavior?try: x=int("oops") except ValueError: print("bad integer")

  1. The except clause matching the raised exception class handles the error and allows execution to continue.
  2. Providing a parameter both positionally and by keyword causes TypeError for multiple values.
  3. The result returned by one function can be passed directly as an argument to another function.
  4. KeyboardInterrupt and SystemExit derive from BaseException but not from the Exception subclass.

Explanation

Correct Answer

A:

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

Incorrect Answers

B:

The duplicate argument assignment raises TypeError topic does not explain why the code prints 'bad integer'. The relevant Python rule is: The except clause matching the raised exception class handles the error and allows execution to continue.

C:

The function call composition topic does not explain why the code prints 'bad integer'. The relevant Python rule is: The except clause matching the raised exception class handles the error and allows execution to continue.

D:

The BaseException versus Exception topic does not explain why the code prints 'bad integer'. The relevant Python rule is: The except clause matching the raised exception class handles the error and allows execution to continue.

Question 383

A learner is checking exact exception handler selection. After this modification, what does Python 3 actually do?try: print([1][9]) except IndexError: print("index")

  1. Prints 'index'
  2. Prints 'inde'
  3. Prints 'index?'
  4. Prints 'xedni'

Explanation

Correct Answer

A:

The snippet prints 'index'. The except clause matching the raised exception class handles the error and allows execution to continue.

Incorrect Answers

B:

This predicts that the snippet prints 'inde', but executing the displayed Python 3 code prints 'index'. The except clause matching the raised exception class handles the error and allows execution to continue.

C:

This predicts that the snippet prints 'index?', but executing the displayed Python 3 code prints 'index'. The except clause matching the raised exception class handles the error and allows execution to continue.

D:

This predicts that the snippet prints 'xedni', but executing the displayed Python 3 code prints 'index'. The except clause matching the raised exception class handles the error and allows execution to continue.

Question 384

During a review of exact exception handler selection, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: try: x=int("oops") except ValueError: print("bad integer") Program B: try: print([1][9]) except IndexError: print("index") Program C: try: print(3+"4") except TypeError: print("types")

  1. Program A prints 'bad integer'.
  2. Program A raises stopiteration.
  3. Program B prints 'broad'.
  4. Program B prints 'index'.
  5. Program C prints 'types'.
  6. Program C prints 'index'.

Explanation

Correct Answers

A:

Running Program A prints 'bad integer'. The except clause matching the raised exception class handles the error and allows execution to continue.

D:

Running Program B prints 'index'. The except clause matching the raised exception class handles the error and allows execution to continue.

E:

Running Program C prints 'types'. The except clause matching the raised exception class handles the error and allows execution to continue.

Incorrect Answers

B:

Program A does not raises stopiteration; its verified result is: Prints 'bad integer'. The except clause matching the raised exception class handles the error and allows execution to continue.

C:

Program B does not produce 'broad'; its verified result is: Prints 'index'. The except clause matching the raised exception class handles the error and allows execution to continue.

F:

Program C does not produce 'index'; its verified result is: Prints 'types'. The except clause matching the raised exception class handles the error and allows execution to continue.

Question 385

A learner is checking first matching except branch. What is the exact printed result or uncaught exception?try: int("no") except Exception: print("broad") except ValueError: print("narrow")

  1. Prints 'broad?'
  2. Prints 'broa'
  3. Prints 'broad'
  4. Prints 'daorb'

Explanation

Correct Answer

C:

The snippet prints 'broad'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

Incorrect Answers

A:

This predicts that the snippet prints 'broad?', but executing the displayed Python 3 code prints 'broad'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

B:

This predicts that the snippet prints 'broa', but executing the displayed Python 3 code prints 'broad'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

D:

This predicts that the snippet prints 'daorb', but executing the displayed Python 3 code prints 'broad'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

Question 386

A developer tests first matching except branch. The following code prints 'specific'. Which explanation best accounts for that observed behavior?try: 1/0 except ZeroDivisionError: print("specific") except Exception: print("general")

  1. A global declaration makes assignment inside the function modify the module-level name.
  2. A recursive function must reach a base case; factorial multiplies n by factorial(n-1) until n<=1.
  3. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.
  4. KeyboardInterrupt and SystemExit derive from BaseException but not from the Exception subclass.

Explanation

Correct Answer

C:

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

Incorrect Answers

A:

The global declaration changes module binding topic does not explain why the code prints 'specific'. The relevant Python rule is: Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

B:

The recursive factorial base case topic does not explain why the code prints 'specific'. The relevant Python rule is: Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

D:

The BaseException versus Exception topic does not explain why the code prints 'specific'. The relevant Python rule is: Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

Question 387

A learner is checking first matching except branch. After this modification, what does Python 3 actually do?try: [][0] except LookupError: print("lookup") except IndexError: print("index")

  1. Prints 'lookup?'
  2. Prints 'looku'
  3. Prints 'lookup'
  4. Prints 'pukool'

Explanation

Correct Answer

C:

The snippet prints 'lookup'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

Incorrect Answers

A:

This predicts that the snippet prints 'lookup?', but executing the displayed Python 3 code prints 'lookup'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

B:

This predicts that the snippet prints 'looku', but executing the displayed Python 3 code prints 'lookup'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

D:

This predicts that the snippet prints 'pukool', but executing the displayed Python 3 code prints 'lookup'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

Question 388

During a review of first matching except branch, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: try: 1/0 except ZeroDivisionError: print("specific") except Exception: print("general") Program B: try: [][0] except LookupError: print("lookup") except IndexError: print("index") Program C: try: {}["missing"] except KeyError: print("key") except Exception: print("other")

  1. Program C prints 'key'.
  2. Program B prints 'lookup'.
  3. Program C prints 'xxx'.
  4. Program B prints '(1, 2)'.
  5. Program A prints 'hi guest'.
  6. Program A prints 'specific'.

Explanation

Correct Answers

A:

Running Program C prints 'key'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

B:

Running Program B prints 'lookup'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

F:

Running Program A prints 'specific'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

Incorrect Answers

C:

Program C does not produce 'xxx'; its verified result is: Prints 'key'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

D:

Program B does not produce '(1, 2)'; its verified result is: Prints 'lookup'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

E:

Program A does not produce 'hi guest'; its verified result is: Prints 'specific'. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

Question 389

A learner is checking exceptions propagate across function calls. What is the exact printed result or uncaught exception?def f(): return 1/0 try: print(f()) except ZeroDivisionError: print("handled")

  1. Prints 'handle'
  2. Prints 'deldnah'
  3. Prints 'handled'
  4. Prints 'handled?'

Explanation

Correct Answer

C:

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

Incorrect Answers

A:

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

B:

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

D:

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

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.

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.