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 32

Question 310

A developer tests recursive summation. The following code prints '6'. Which explanation best accounts for that observed behavior?def f(n): if n<=1: return n return n+f(n-1) print(f(3))

  1. A recursive sum decreases the input until its base case and combines each return value on the way back.
  2. Keyword arguments bind by parameter name regardless of the order in which keywords are written.
  3. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.
  4. A return statement immediately exits a function and supplies its expression as the call result.

Explanation

Correct Answer

A:

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

Incorrect Answers

B:

The keyword argument binding topic does not explain why the code prints '6'. The relevant Python rule is: A recursive sum decreases the input until its base case and combines each return value on the way back.

C:

The positional argument binding topic does not explain why the code prints '6'. The relevant Python rule is: A recursive sum decreases the input until its base case and combines each return value on the way back.

D:

The function return controls result topic does not explain why the code prints '6'. The relevant Python rule is: A recursive sum decreases the input until its base case and combines each return value on the way back.

Question 311

A learner is checking recursive summation. After this modification, what does Python 3 actually do?def f(n): if n==0: return 0 return 2+f(n-1) print(f(3))

  1. Prints '7'
  2. Prints '6'
  3. Prints '5'
  4. Prints '8'

Explanation

Correct Answer

B:

The snippet prints '6'. A recursive sum decreases the input until its base case and combines each return value on the way back.

Incorrect Answers

A:

This predicts that the snippet prints '7', but executing the displayed Python 3 code prints '6'. A recursive sum decreases the input until its base case and combines each return value on the way back.

C:

This predicts that the snippet prints '5', but executing the displayed Python 3 code prints '6'. A recursive sum decreases the input until its base case and combines each return value on the way back.

D:

This predicts that the snippet prints '8', but executing the displayed Python 3 code prints '6'. A recursive sum decreases the input until its base case and combines each return value on the way back.

Question 312

A learner is checking recursive summation. Which final result follows from this separate test?def f(n): if n==0: return 1 return 2*f(n-1) print(f(4))

  1. Prints '16'
  2. Prints '18'
  3. Prints '17'
  4. Prints '15'

Explanation

Correct Answer

A:

The snippet prints '16'. A recursive sum decreases the input until its base case and combines each return value on the way back.

Incorrect Answers

B:

This predicts that the snippet prints '18', but executing the displayed Python 3 code prints '16'. A recursive sum decreases the input until its base case and combines each return value on the way back.

C:

This predicts that the snippet prints '17', but executing the displayed Python 3 code prints '16'. A recursive sum decreases the input until its base case and combines each return value on the way back.

D:

This predicts that the snippet prints '15', but executing the displayed Python 3 code prints '16'. A recursive sum decreases the input until its base case and combines each return value on the way back.

Question 313

A learner is checking generator yield suspends state. What is the exact printed result or uncaught exception?def g(): yield 2 yield 5 it=g() print(next(it),next(it))

  1. Prints '5 2'
  2. Prints '2 '
  3. Prints '2 5?'
  4. Prints '2 5'

Explanation

Correct Answer

D:

The snippet prints '2 5'. A generator yields values lazily and resumes after each yield when next is called.

Incorrect Answers

A:

This predicts that the snippet prints '5 2', but executing the displayed Python 3 code prints '2 5'. A generator yields values lazily and resumes after each yield when next is called.

B:

This predicts that the snippet prints '2 ', but executing the displayed Python 3 code prints '2 5'. A generator yields values lazily and resumes after each yield when next is called.

C:

This predicts that the snippet prints '2 5?', but executing the displayed Python 3 code prints '2 5'. A generator yields values lazily and resumes after each yield when next is called.

Question 314

A developer tests generator yield suspends state. The following code prints "['a', 'b']". Which explanation best accounts for that observed behavior?def g(): yield "a" yield "b" print(list(g()))

  1. A generator yields values lazily and resumes after each yield when next is called.
  2. The except clause matching the raised exception class handles the error and allows execution to continue.
  3. KeyboardInterrupt and SystemExit derive from BaseException but not from the Exception subclass.
  4. ZeroDivisionError inherits from ArithmeticError which itself inherits from Exception.

Explanation

Correct Answer

A:

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

Incorrect Answers

B:

The exact exception handler selection topic does not explain why the code prints "['a', 'b']". The relevant Python rule is: A generator yields values lazily and resumes after each yield when next is called.

C:

The BaseException versus Exception topic does not explain why the code prints "['a', 'b']". The relevant Python rule is: A generator yields values lazily and resumes after each yield when next is called.

D:

The ArithmeticError inheritance topic does not explain why the code prints "['a', 'b']". The relevant Python rule is: A generator yields values lazily and resumes after each yield when next is called.

Question 315

A learner is checking generator yield suspends state. After this modification, what does Python 3 actually do?def g(): yield 7 it=g() next(it) print(next(it))

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

Explanation

Correct Answer

B:

The snippet raises stopiteration. A generator yields values lazily and resumes after each yield when next is called.

Incorrect Answers

A:

This predicts that the snippet raises typeerror, but executing the displayed Python 3 code raises stopiteration. A generator yields values lazily and resumes after each yield when next is called.

C:

This predicts that the snippet raises keyerror, but executing the displayed Python 3 code raises stopiteration. A generator yields values lazily and resumes after each yield when next is called.

D:

This predicts that the snippet raises indexerror, but executing the displayed Python 3 code raises stopiteration. A generator yields values lazily and resumes after each yield when next is called.

Question 316

During a review of generator yield suspends state, three independent Python 3 fragments are shown. Which TWO statements accurately describe their behavior? (Choose TWO.)Program A: def g(): yield "a" yield "b" print(list(g())) Program B: def g(): yield 7 it=g() next(it) print(next(it)) Program C: def g(): yield 1 yield 2 it=g() print(next(it))

  1. Program A prints 'left:right'.
  2. Program C prints '5'.
  3. Program C prints '1'.
  4. Program B prints 'bad integer'.
  5. Program B raises stopiteration.

Explanation

Correct Answers

C:

Running Program C prints '1'. A generator yields values lazily and resumes after each yield when next is called.

E:

Running Program B raises stopiteration. A generator yields values lazily and resumes after each yield when next is called.

Incorrect Answers

A:

Program A does not produce 'left:right'; its verified result is: Prints "['a', 'b']". A generator yields values lazily and resumes after each yield when next is called.

B:

Program C does not produce '5'; its verified result is: Prints '1'. A generator yields values lazily and resumes after each yield when next is called.

D:

Program B does not produce 'bad integer'; its verified result is: Raises StopIteration. A generator yields values lazily and resumes after each yield when next is called.

Question 317

A learner is checking yield inside for loop. What is the exact printed result or uncaught exception?def g(): for x in range(3): yield x*x print(list(g()))

  1. Prints '[4, 1, 0]'
  2. Prints '[0, 1, 4]'
  3. Prints '[0, 1]'
  4. Prints '[1, 4]'

Explanation

Correct Answer

B:

The snippet prints '[0, 1, 4]'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

Incorrect Answers

A:

This predicts that the snippet prints '[4, 1, 0]', but executing the displayed Python 3 code prints '[0, 1, 4]'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

C:

This predicts that the snippet prints '[0, 1]', but executing the displayed Python 3 code prints '[0, 1, 4]'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

D:

This predicts that the snippet prints '[1, 4]', but executing the displayed Python 3 code prints '[0, 1, 4]'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

Question 318

A developer tests yield inside for loop. The following code prints '[3, 5]'. Which explanation best accounts for that observed behavior?def g(): for x in (2,4): yield x+1 print(list(g()))

  1. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.
  2. The result returned by one function can be passed directly as an argument to another function.
  3. A generator can yield one value per loop pass, and consumption determines how many iterations run.
  4. Once a function returns, the remaining statements in that function call are not executed.

Explanation

Correct Answer

C:

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

Incorrect Answers

A:

The specific versus incorrect exception catch topic does not explain why the code prints '[3, 5]'. The relevant Python rule is: A generator can yield one value per loop pass, and consumption determines how many iterations run.

B:

The function call composition topic does not explain why the code prints '[3, 5]'. The relevant Python rule is: A generator can yield one value per loop pass, and consumption determines how many iterations run.

D:

The early return versus later statements topic does not explain why the code prints '[3, 5]'. The relevant Python rule is: A generator can yield one value per loop pass, and consumption determines how many iterations run.

Question 319

A learner is checking yield inside for loop. After this modification, what does Python 3 actually do?def g(): for x in range(1,4): yield x it=g() print(next(it),next(it))

  1. Prints '1 '
  2. Prints '2 1'
  3. Prints '1 2'
  4. Prints '1 2?'

Explanation

Correct Answer

C:

The snippet prints '1 2'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

Incorrect Answers

A:

This predicts that the snippet prints '1 ', but executing the displayed Python 3 code prints '1 2'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

B:

This predicts that the snippet prints '2 1', but executing the displayed Python 3 code prints '1 2'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

D:

This predicts that the snippet prints '1 2?', but executing the displayed Python 3 code prints '1 2'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

Question 320

During a review of yield inside for loop, three independent Python 3 fragments are shown. Which TWO statements accurately describe their behavior? (Choose TWO.)Program A: def g(): for x in (2,4): yield x+1 print(list(g())) Program B: def g(): for x in range(1,4): yield x it=g() print(next(it),next(it)) Program C: def g(): for c in "ab": yield c.upper() print("".join(g()))

  1. Program B prints '120'.
  2. Program C prints 'ab'.
  3. Program B prints '1 2'.
  4. Program C prints '27'.
  5. Program A prints 'lookup'.

Explanation

Correct Answers

B:

Running Program C prints 'ab'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

C:

Running Program B prints '1 2'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

Incorrect Answers

A:

Program B does not produce '120'; its verified result is: Prints '1 2'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

D:

Program C does not produce '27'; its verified result is: Prints 'AB'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

E:

Program A does not produce 'lookup'; its verified result is: Prints '[3, 5]'. A generator can yield one value per loop pass, and consumption determines how many iterations run.

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.