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 33

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.

Question 321

A learner is checking positional argument binding. What is the exact printed result or uncaught exception?def sub(a,b): return a-b print(sub(10,3))

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

Explanation

Correct Answer

A:

The snippet prints '7'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

Incorrect Answers

B:

This predicts that the snippet prints '8', but executing the displayed Python 3 code prints '7'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

C:

This predicts that the snippet prints '9', but executing the displayed Python 3 code prints '7'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

D:

This predicts that the snippet prints '6', but executing the displayed Python 3 code prints '7'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

Question 322

A developer tests positional argument binding. The following code prints '27'. Which explanation best accounts for that observed behavior?def f(x,y): return x*10+y print(f(2,7))

  1. The except clause matching the raised exception class handles the error and allows execution to continue.
  2. KeyboardInterrupt and SystemExit derive from BaseException but not from the Exception subclass.
  3. A generator yields values lazily and resumes after each yield when next is called.
  4. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

Explanation

Correct Answer

D:

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

Incorrect Answers

A:

The exact exception handler selection topic does not explain why the code prints '27'. The relevant Python rule is: Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

B:

The BaseException versus Exception topic does not explain why the code prints '27'. The relevant Python rule is: Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

C:

The generator yield suspends state topic does not explain why the code prints '27'. The relevant Python rule is: Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

Question 323

A learner is checking positional argument binding. After this modification, what does Python 3 actually do?def div(x,y): return x//y print(div(9,2))

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

Explanation

Correct Answer

A:

The snippet prints '4'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

Incorrect Answers

B:

This predicts that the snippet prints '3', but executing the displayed Python 3 code prints '4'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

C:

This predicts that the snippet prints '5', but executing the displayed Python 3 code prints '4'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

D:

This predicts that the snippet prints '6', but executing the displayed Python 3 code prints '4'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

Question 324

During a review of positional argument binding, three independent Python 3 fragments are shown. Which TWO statements accurately describe their behavior? (Choose TWO.)Program A: def f(x,y): return x*10+y print(f(2,7)) Program B: def div(x,y): return x//y print(div(9,2)) Program C: def join(a,b): return a+":"+b print(join("left","right"))

  1. Program B prints '4'.
  2. Program C prints "['a', 'b']".
  3. Program B prints '6'.
  4. Program A prints '16'.
  5. Program C prints 'left:right'.

Explanation

Correct Answers

A:

Running Program B prints '4'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

E:

Running Program C prints 'left:right'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

Incorrect Answers

B:

Program C does not produce "['a', 'b']"; its verified result is: Prints 'left:right'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

C:

Program B does not produce '6'; its verified result is: Prints '4'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

D:

Program A does not produce '16'; its verified result is: Prints '27'. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

Question 325

A learner is checking keyword argument binding. What is the exact printed result or uncaught exception?def sub(a,b): return a-b print(sub(b=3,a=10))

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

Explanation

Correct Answer

B:

The snippet prints '7'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

Incorrect Answers

A:

This predicts that the snippet prints '8', but executing the displayed Python 3 code prints '7'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

C:

This predicts that the snippet prints '9', but executing the displayed Python 3 code prints '7'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

D:

This predicts that the snippet prints '6', but executing the displayed Python 3 code prints '7'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

Question 326

A developer tests keyword argument binding. The following code prints '24'. Which explanation best accounts for that observed behavior?def f(x,y): return x*10+y print(f(y=4,x=2))

  1. A Python function without a reachable return statement returns the singleton None.
  2. Keyword arguments bind by parameter name regardless of the order in which keywords are written.
  3. Assigning to a parameter or local variable does not rebind the distinct global name without global.
  4. Positional arguments bind to parameters in declared order; their values are not automatically sorted or swapped.

Explanation

Correct Answer

B:

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

Incorrect Answers

A:

The implicit None return topic does not explain why the code prints '24'. The relevant Python rule is: Keyword arguments bind by parameter name regardless of the order in which keywords are written.

C:

The local name shadows global name topic does not explain why the code prints '24'. The relevant Python rule is: Keyword arguments bind by parameter name regardless of the order in which keywords are written.

D:

The positional argument binding topic does not explain why the code prints '24'. The relevant Python rule is: Keyword arguments bind by parameter name regardless of the order in which keywords are written.

Question 327

A learner is checking keyword argument binding. After this modification, what does Python 3 actually do?def join(a,b): return a+"/"+b print(join(b="end",a="start"))

  1. Prints 'dne/trats'
  2. Prints 'start/end'
  3. Prints 'start/end?'
  4. Prints 'start/en'

Explanation

Correct Answer

B:

The snippet prints 'start/end'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

Incorrect Answers

A:

This predicts that the snippet prints 'dne/trats', but executing the displayed Python 3 code prints 'start/end'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

C:

This predicts that the snippet prints 'start/end?', but executing the displayed Python 3 code prints 'start/end'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

D:

This predicts that the snippet prints 'start/en', but executing the displayed Python 3 code prints 'start/end'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

Question 328

During a review of keyword argument binding, three independent Python 3 fragments are shown. Which TWO statements accurately describe their behavior? (Choose TWO.)Program A: def f(x,y): return x*10+y print(f(y=4,x=2)) Program B: def join(a,b): return a+"/"+b print(join(b="end",a="start")) Program C: def area(w,h): return w*h print(area(h=3,w=7))

  1. Program A prints '12'.
  2. Program B prints '[0, 1, 4]'.
  3. Program C prints '[]'.
  4. Program C prints '21'.
  5. Program B prints 'start/end'.

Explanation

Correct Answers

D:

Running Program C prints '21'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

E:

Running Program B prints 'start/end'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

Incorrect Answers

A:

Program A does not produce '12'; its verified result is: Prints '24'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

B:

Program B does not produce '[0, 1, 4]'; its verified result is: Prints 'start/end'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

C:

Program C does not produce '[]'; its verified result is: Prints '21'. Keyword arguments bind by parameter name regardless of the order in which keywords are written.

Question 329

A learner is checking mixed positional and keyword calls. What is the exact printed result or uncaught exception?def f(a,b,c): return a+b+c print(f(1,c=3,b=2))

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

Explanation

Correct Answer

C:

The snippet prints '6'. Positional arguments may precede named arguments, but a single parameter cannot receive two values.

Incorrect Answers

A:

This predicts that the snippet prints '5', but executing the displayed Python 3 code prints '6'. Positional arguments may precede named arguments, but a single parameter cannot receive two values.

B:

This predicts that the snippet prints '7', but executing the displayed Python 3 code prints '6'. Positional arguments may precede named arguments, but a single parameter cannot receive two values.

D:

This predicts that the snippet prints '8', but executing the displayed Python 3 code prints '6'. Positional arguments may precede named arguments, but a single parameter cannot receive two values.

Question 330

A developer tests mixed positional and keyword calls. The following code prints '123'. Which explanation best accounts for that observed behavior?def f(a,b,c): return 100*a+10*b+c print(f(1,2,c=3))

  1. An absent list index produces IndexError whereas a missing dictionary key produces KeyError.
  2. A global declaration makes assignment inside the function modify the module-level name.
  3. An inner try-except handles matching exceptions; otherwise an outer compatible handler can receive the propagated error.
  4. Positional arguments may precede named arguments, but a single parameter cannot receive two values.

Explanation

Correct Answer

D:

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

Incorrect Answers

A:

The IndexError and KeyError distinct topic does not explain why the code prints '123'. The relevant Python rule is: Positional arguments may precede named arguments, but a single parameter cannot receive two values.

B:

The global declaration changes module binding topic does not explain why the code prints '123'. The relevant Python rule is: Positional arguments may precede named arguments, but a single parameter cannot receive two values.

C:

The nested try except responsibility topic does not explain why the code prints '123'. The relevant Python rule is: Positional arguments may precede named arguments, but a single parameter cannot receive two values.

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.