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 36

Question 350

A developer tests local variable before assignment error. The following code raises unboundlocalerror. Which explanation best accounts for that observed behavior?n=3 def f(): n=n+1 return n print(f())

  1. A generator yields values lazily and resumes after each yield when next is called.
  2. Keyword arguments bind by parameter name regardless of the order in which keywords are written.
  3. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.
  4. A function modifying a list argument in place changes the same list observed by its caller.

Explanation

Correct Answer

C:

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

Incorrect Answers

A:

The generator yield suspends state topic does not explain why the code raises unboundlocalerror. The relevant Python rule is: Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

B:

The keyword argument binding topic does not explain why the code raises unboundlocalerror. The relevant Python rule is: Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

D:

The mutable list argument shared with caller topic does not explain why the code raises unboundlocalerror. The relevant Python rule is: Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

Question 351

A learner is checking local variable before assignment error. After this modification, what does Python 3 actually do?x=2 def f(): global x x=x+4 f() print(x)

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

Explanation

Correct Answer

A:

The snippet prints '6'. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

Incorrect Answers

B:

This predicts that the snippet prints '8', but executing the displayed Python 3 code prints '6'. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

C:

This predicts that the snippet prints '7', but executing the displayed Python 3 code prints '6'. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

D:

This predicts that the snippet prints '5', but executing the displayed Python 3 code prints '6'. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

Question 352

During a review of local variable before assignment error, three independent Python 3 fragments are shown. Which TWO statements accurately describe their behavior? (Choose TWO.)Program A: n=3 def f(): n=n+1 return n print(f()) Program B: x=2 def f(): global x x=x+4 f() print(x) Program C: x=10 def f(): return x print(f())

  1. Program B prints '6'.
  2. Program B prints '3'.
  3. Program C prints '10'.
  4. Program A raises zerodivisionerror.
  5. Program C prints '16'.

Explanation

Correct Answers

A:

Running Program B prints '6'. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

C:

Running Program C prints '10'. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

Incorrect Answers

B:

Program B does not produce '3'; its verified result is: Prints '6'. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

D:

Program A does not raises zerodivisionerror; its verified result is: Raises UnboundLocalError. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

E:

Program C does not produce '16'; its verified result is: Prints '10'. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

Question 353

A learner is checking mutable list argument shared with caller. What is the exact printed result or uncaught exception?def add(a): a.append(7) items=[1] add(items) print(items)

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

Explanation

Correct Answer

B:

The snippet prints '[1, 7]'. A function modifying a list argument in place changes the same list observed by its caller.

Incorrect Answers

A:

This predicts that the snippet prints '[1]', but executing the displayed Python 3 code prints '[1, 7]'. A function modifying a list argument in place changes the same list observed by its caller.

C:

This predicts that the snippet prints '[7]', but executing the displayed Python 3 code prints '[1, 7]'. A function modifying a list argument in place changes the same list observed by its caller.

D:

This predicts that the snippet prints '[7, 1]', but executing the displayed Python 3 code prints '[1, 7]'. A function modifying a list argument in place changes the same list observed by its caller.

Question 354

A developer tests mutable list argument shared with caller. The following code prints '[9, 2]'. Which explanation best accounts for that observed behavior?def f(a): a[0]=9 v=[1,2] f(v) print(v)

  1. A Python function without a reachable return statement returns the singleton None.
  2. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.
  3. A function modifying a list argument in place changes the same list observed by its caller.
  4. An except block for an unrelated exception does not intercept the error and execution fails at the uncaught exception.

Explanation

Correct Answer

C:

This is the operative language rule for the code. It directly explains why the example prints '[9, 2]'; 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 '[9, 2]'. The relevant Python rule is: A function modifying a list argument in place changes the same list observed by its caller.

B:

The first matching except branch topic does not explain why the code prints '[9, 2]'. The relevant Python rule is: A function modifying a list argument in place changes the same list observed by its caller.

D:

The specific versus incorrect exception catch topic does not explain why the code prints '[9, 2]'. The relevant Python rule is: A function modifying a list argument in place changes the same list observed by its caller.

Question 355

A learner is checking mutable list argument shared with caller. After this modification, what does Python 3 actually do?def f(a): a=a+[3] v=[1] f(v) print(v)

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

Explanation

Correct Answer

C:

The snippet prints '[1]'. A function modifying a list argument in place changes the same list observed by its caller.

Incorrect Answers

A:

This predicts that the snippet prints '[1, 0]', but executing the displayed Python 3 code prints '[1]'. A function modifying a list argument in place changes the same list observed by its caller.

B:

This predicts that the snippet prints '[]', but executing the displayed Python 3 code prints '[1]'. A function modifying a list argument in place changes the same list observed by its caller.

D:

This predicts that the snippet prints '[2]', but executing the displayed Python 3 code prints '[1]'. A function modifying a list argument in place changes the same list observed by its caller.

Question 356

During a review of mutable list argument shared with caller, three independent Python 3 fragments are shown. Which TWO statements accurately describe their behavior? (Choose TWO.)Program A: def f(a): a[0]=9 v=[1,2] f(v) print(v) Program B: def f(a): a=a+[3] v=[1] f(v) print(v) Program C: def f(a): a.extend([2,3]) v=[] f(v) print(v)

  1. Program A prints 'caught'.
  2. Program B prints '[1]'.
  3. Program C prints 'lookup'.
  4. Program B prints '2 5'.
  5. Program C prints '[2, 3]'.

Explanation

Correct Answers

B:

Running Program B prints '[1]'. A function modifying a list argument in place changes the same list observed by its caller.

E:

Running Program C prints '[2, 3]'. A function modifying a list argument in place changes the same list observed by its caller.

Incorrect Answers

A:

Program A does not produce 'caught'; its verified result is: Prints '[9, 2]'. A function modifying a list argument in place changes the same list observed by its caller.

C:

Program C does not produce 'lookup'; its verified result is: Prints '[2, 3]'. A function modifying a list argument in place changes the same list observed by its caller.

D:

Program B does not produce '2 5'; its verified result is: Prints '[1]'. A function modifying a list argument in place changes the same list observed by its caller.

Question 357

A learner is checking duplicate argument assignment raises TypeError. What is the exact printed result or uncaught exception?def f(x): return x print(f(1,x=2))

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

Explanation

Correct Answer

C:

The snippet raises typeerror. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

Incorrect Answers

A:

This predicts that the snippet raises keyerror, but executing the displayed Python 3 code raises typeerror. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

B:

This predicts that the snippet raises indexerror, but executing the displayed Python 3 code raises typeerror. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

D:

This predicts that the snippet raises valueerror, but executing the displayed Python 3 code raises typeerror. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

Question 358

A developer tests duplicate argument assignment raises TypeError. The following code raises typeerror. Which explanation best accounts for that observed behavior?def f(a,b): return a+b print(f(1,a=2,b=3))

  1. Providing a parameter both positionally and by keyword causes TypeError for multiple values.
  2. A recursive function must reach a base case; factorial multiplies n by factorial(n-1) until n<=1.
  3. A recursive sum decreases the input until its base case and combines each return value on the way back.
  4. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.

Explanation

Correct Answer

A:

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

Incorrect Answers

B:

The recursive factorial base case topic does not explain why the code raises typeerror. The relevant Python rule is: Providing a parameter both positionally and by keyword causes TypeError for multiple values.

C:

The recursive summation topic does not explain why the code raises typeerror. The relevant Python rule is: Providing a parameter both positionally and by keyword causes TypeError for multiple values.

D:

The first matching except branch topic does not explain why the code raises typeerror. The relevant Python rule is: Providing a parameter both positionally and by keyword causes TypeError for multiple values.

Question 359

A learner is checking duplicate argument assignment raises TypeError. After this modification, what does Python 3 actually do?def f(x,y): return x+y print(f(1,y=2))

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

Explanation

Correct Answer

B:

The snippet prints '3'. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

Incorrect Answers

A:

This predicts that the snippet prints '4', but executing the displayed Python 3 code prints '3'. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

C:

This predicts that the snippet prints '5', but executing the displayed Python 3 code prints '3'. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

D:

This predicts that the snippet prints '2', but executing the displayed Python 3 code prints '3'. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

Question 360

During a review of duplicate argument assignment raises TypeError, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: def f(a,b): return a+b print(f(1,a=2,b=3)) Program B: def f(x,y): return x+y print(f(1,y=2)) Program C: def f(x=1): return x print(f(x=4))

  1. Program B prints '3'.
  2. Program A raises typeerror.
  3. Program A raises nameerror.
  4. Program C prints '4'.
  5. Program C prints '8'.
  6. Program B prints '6'.

Explanation

Correct Answers

A:

Running Program B prints '3'. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

B:

Running Program A raises typeerror. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

D:

Running Program C prints '4'. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

Incorrect Answers

C:

Program A does not raises nameerror; its verified result is: Raises TypeError. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

E:

Program C does not produce '8'; its verified result is: Prints '4'. Providing a parameter both positionally and by keyword causes TypeError for multiple values.

F:

Program B does not produce '6'; its verified result is: Prints '3'. Providing a parameter both positionally and by keyword causes TypeError for multiple 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.