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 35

Question 340

During a review of keyword can override positional default, three independent Python 3 fragments are shown. Which TWO statements accurately describe their behavior? (Choose TWO.)Program A: def f(a,b=3): return a-b print(f(9,b=4)) Program B: def f(x=10,y=1): return x+y print(f(y=7)) Program C: def f(prefix="x",num=2): return prefix*num print(f(num=3))

  1. Program C prints 'bad'.
  2. Program A prints '7'.
  3. Program C prints 'xxx'.
  4. Program B prints '17'.
  5. Program B prints 'ab'.

Explanation

Correct Answers

C:

Running Program C prints 'xxx'. A supplied keyword value overrides a default parameter without changing the function definition.

D:

Running Program B prints '17'. A supplied keyword value overrides a default parameter without changing the function definition.

Incorrect Answers

A:

Program C does not produce 'bad'; its verified result is: Prints 'xxx'. A supplied keyword value overrides a default parameter without changing the function definition.

B:

Program A does not produce '7'; its verified result is: Prints '5'. A supplied keyword value overrides a default parameter without changing the function definition.

E:

Program B does not produce 'ab'; its verified result is: Prints '17'. A supplied keyword value overrides a default parameter without changing the function definition.

Question 341

A learner is checking local name shadows global name. What is the exact printed result or uncaught exception?x=9 def f(x): x+=1 return x print(f(2),x)

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

Explanation

Correct Answer

B:

The snippet prints '3 9'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

Incorrect Answers

A:

This predicts that the snippet prints '3 9?', but executing the displayed Python 3 code prints '3 9'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

C:

This predicts that the snippet prints '9 3', but executing the displayed Python 3 code prints '3 9'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

D:

This predicts that the snippet prints '3 ', but executing the displayed Python 3 code prints '3 9'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

Question 342

A developer tests local name shadows global name. The following code prints '7 4'. Which explanation best accounts for that observed behavior?value=4 def f(): value=7 return value print(f(),value)

  1. The except clause matching the raised exception class handles the error and allows execution to continue.
  2. Assigning to a parameter or local variable does not rebind the distinct global name without global.
  3. A default parameter supplies its predeclared value only when the call does not provide that argument.
  4. A global declaration makes assignment inside the function modify the module-level name.

Explanation

Correct Answer

B:

This is the operative language rule for the code. It directly explains why the example prints '7 4'; 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 '7 4'. The relevant Python rule is: Assigning to a parameter or local variable does not rebind the distinct global name without global.

C:

The default parameter value used when omitted topic does not explain why the code prints '7 4'. The relevant Python rule is: Assigning to a parameter or local variable does not rebind the distinct global name without global.

D:

The global declaration changes module binding topic does not explain why the code prints '7 4'. The relevant Python rule is: Assigning to a parameter or local variable does not rebind the distinct global name without global.

Question 343

A learner is checking local name shadows global name. After this modification, what does Python 3 actually do?x=5 def f(x): return x*2 print(f(3),x)

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

Explanation

Correct Answer

C:

The snippet prints '6 5'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

Incorrect Answers

A:

This predicts that the snippet prints '6 ', but executing the displayed Python 3 code prints '6 5'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

B:

This predicts that the snippet prints '6 5?', but executing the displayed Python 3 code prints '6 5'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

D:

This predicts that the snippet prints '5 6', but executing the displayed Python 3 code prints '6 5'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

Question 344

During a review of local name shadows global name, three independent Python 3 fragments are shown. Which TWO statements accurately describe their behavior? (Choose TWO.)Program A: value=4 def f(): value=7 return value print(f(),value) Program B: x=5 def f(x): return x*2 print(f(3),x) Program C: n=3 def f(): n=10 return n-1 print(n,f())

  1. Program C prints '1 2'.
  2. Program A prints '1 2'.
  3. Program B prints '6 5'.
  4. Program B prints '7 4'.
  5. Program C prints '3 9'.

Explanation

Correct Answers

C:

Running Program B prints '6 5'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

E:

Running Program C prints '3 9'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

Incorrect Answers

A:

Program C does not produce '1 2'; its verified result is: Prints '3 9'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

B:

Program A does not produce '1 2'; its verified result is: Prints '7 4'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

D:

Program B does not produce '7 4'; its verified result is: Prints '6 5'. Assigning to a parameter or local variable does not rebind the distinct global name without global.

Question 345

A learner is checking global declaration changes module binding. What is the exact printed result or uncaught exception?n=2 def f(): global n n+=3 f() print(n)

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

Explanation

Correct Answer

B:

The snippet prints '5'. A global declaration makes assignment inside the function modify the module-level name.

Incorrect Answers

A:

This predicts that the snippet prints '7', but executing the displayed Python 3 code prints '5'. A global declaration makes assignment inside the function modify the module-level name.

C:

This predicts that the snippet prints '6', but executing the displayed Python 3 code prints '5'. A global declaration makes assignment inside the function modify the module-level name.

D:

This predicts that the snippet prints '4', but executing the displayed Python 3 code prints '5'. A global declaration makes assignment inside the function modify the module-level name.

Question 346

A developer tests global declaration changes module binding. The following code prints 'true'. Which explanation best accounts for that observed behavior?flag=False def on(): global flag flag=True on() print(flag)

  1. Exception handlers are checked in order; a broad superclass handler before a specific one makes the later one unreachable.
  2. A global declaration makes assignment inside the function modify the module-level name.
  3. Positional arguments may precede named arguments, but a single parameter cannot receive two values.
  4. An uncaught exception raised inside a function propagates to the caller where a matching except can catch it.

Explanation

Correct Answer

B:

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

Incorrect Answers

A:

That statement describes the separate topic first matching except branch. It does not account for this example, whose result isprints 'true'. The relevant rule is: A global declaration makes assignment inside the function modify the module-level name.

C:

That statement describes the separate topic mixed positional and keyword calls. It does not account for this example, whose result isprints 'true'. The relevant rule is: A global declaration makes assignment inside the function modify the module-level name.

D:

That statement describes the separate topic exceptions propagate across function calls. It does not account for this example, whose result isprints 'true'. The relevant rule is: A global declaration makes assignment inside the function modify the module-level name.

Question 347

A learner is checking global declaration changes module binding. After this modification, what does Python 3 actually do?x=1 def f(): global x x=x*4 f() print(x)

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

Explanation

Correct Answer

A:

The snippet prints '4'. A global declaration makes assignment inside the function modify the module-level name.

Incorrect Answers

B:

This predicts that the snippet prints '5', but executing the displayed Python 3 code prints '4'. A global declaration makes assignment inside the function modify the module-level name.

C:

This predicts that the snippet prints '6', but executing the displayed Python 3 code prints '4'. A global declaration makes assignment inside the function modify the module-level name.

D:

This predicts that the snippet prints '3', but executing the displayed Python 3 code prints '4'. A global declaration makes assignment inside the function modify the module-level name.

Question 348

During a review of global declaration changes module binding, three independent Python 3 fragments are shown. Which TWO statements accurately describe their behavior? (Choose TWO.)Program A: flag=False def on(): global flag flag=True on() print(flag) Program B: x=1 def f(): global x x=x*4 f() print(x) Program C: text="a" def f(): global text text+="b" f() print(text)

  1. Program B prints '9'.
  2. Program C prints '12'.
  3. Program A prints 'even'.
  4. Program B prints '4'.
  5. Program C prints 'ab'.

Explanation

Correct Answers

D:

Running Program B prints '4'. A global declaration makes assignment inside the function modify the module-level name.

E:

Running Program C prints 'ab'. A global declaration makes assignment inside the function modify the module-level name.

Incorrect Answers

A:

Program B does not produce '9'; its verified result is: Prints '4'. A global declaration makes assignment inside the function modify the module-level name.

B:

Program C does not produce '12'; its verified result is: Prints 'ab'. A global declaration makes assignment inside the function modify the module-level name.

C:

Program A does not produce 'even'; its verified result is:prints 'True'. A global declaration makes assignment inside the function modify the module-level name.

Question 349

A learner is checking local variable before assignment error. What is the exact printed result or uncaught exception?x=5 def f(): print(x) x=6 f()

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

Explanation

Correct Answer

A:

The snippet raises unboundlocalerror. 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 raises indexerror, but executing the displayed Python 3 code raises unboundlocalerror. 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 raises typeerror, but executing the displayed Python 3 code raises unboundlocalerror. 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 raises keyerror, but executing the displayed Python 3 code raises unboundlocalerror. Assigning to a name anywhere in a function makes it local unless declared global; reading it first raises UnboundLocalError.

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.

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.