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 28

Question 270

A developer tests dictionary items and values. The following code prints '[4, 5]'. Which explanation best accounts for that observed behavior?d={"x":4,"y":5} print(list(d.values()))

  1. items yields key/value pairs while values yields values; unpacking pairs preserves their association.
  2. Two names pointing to the same list share mutations, while a slice copy creates a new outer list.
  3. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.
  4. Tuple immutability protects its slots, but a mutable object stored inside a tuple can change in place.

Explanation

Correct Answer

A:

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

Incorrect Answers

B:

The list alias versus independent copy topic does not explain why the code prints '[4, 5]'. The relevant Python rule is: items yields key/value pairs while values yields values; unpacking pairs preserves their association.

C:

The string negative indexing and slices topic does not explain why the code prints '[4, 5]'. The relevant Python rule is: items yields key/value pairs while values yields values; unpacking pairs preserves their association.

D:

The mutable objects inside tuple topic does not explain why the code prints '[4, 5]'. The relevant Python rule is: items yields key/value pairs while values yields values; unpacking pairs preserves their association.

Question 271

A learner is checking dictionary items and values. After this modification, what does Python 3 actually do?d={"a":1,"b":2} print([k for k,v in d.items() if v>1])

  1. Prints '[]'
  2. Prints "['b']"
  3. Prints "['B']"
  4. Prints "['b', 'x']"

Explanation

Correct Answer

B:

The snippet prints "['b']". items yields key/value pairs while values yields values; unpacking pairs preserves their association.

Incorrect Answers

A:

This predicts that the snippet prints '[]', but executing the displayed Python 3 code prints "['b']". items yields key/value pairs while values yields values; unpacking pairs preserves their association.

C:

This predicts that the snippet prints "['b']", but executing the displayed Python 3 code prints "['b']". items yields key/value pairs while values yields values; unpacking pairs preserves their association.

D:

This predicts that the snippet prints "['b', 'x']", but executing the displayed Python 3 code prints "['b']". items yields key/value pairs while values yields values; unpacking pairs preserves their association.

Question 272

During a review of dictionary items and values, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: d={"x":4,"y":5} print(list(d.values())) Program B: d={"a":1,"b":2} print([k for k,v in d.items() if v>1]) Program C: d={"p":2,"q":4} print(sum(v for _,v in d.items()))

  1. Program B prints 'olleh'.
  2. Program B prints "['b']".
  3. Program C prints '6'.
  4. Program C prints '5'.
  5. Program A prints '[4, 5]'.
  6. Program A raises keyerror.

Explanation

Correct Answers

B:

Running Program B prints "['b']". items yields key/value pairs while values yields values; unpacking pairs preserves their association.

C:

Running Program C prints '6'. items yields key/value pairs while values yields values; unpacking pairs preserves their association.

E:

Running Program A prints '[4, 5]'. items yields key/value pairs while values yields values; unpacking pairs preserves their association.

Incorrect Answers

A:

Program B does not produce 'olleh'; its verified result is: Prints "['b']". items yields key/value pairs while values yields values; unpacking pairs preserves their association.

D:

Program C does not produce '5'; its verified result is: Prints '6'. items yields key/value pairs while values yields values; unpacking pairs preserves their association.

F:

Program A does not raises keyerror; its verified result is: Prints '[4, 5]'. items yields key/value pairs while values yields values; unpacking pairs preserves their association.

Question 273

A learner is checking string negative indexing and slices. What is the exact printed result or uncaught exception?s="python" print(s[-2:])

  1. Prints 'no'
  2. Prints 'o'
  3. Prints 'on?'
  4. Prints 'on'

Explanation

Correct Answer

D:

The snippet prints 'on'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

Incorrect Answers

A:

This predicts that the snippet prints 'no', but executing the displayed Python 3 code prints 'on'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

B:

This predicts that the snippet prints 'o', but executing the displayed Python 3 code prints 'on'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

C:

This predicts that the snippet prints 'on?', but executing the displayed Python 3 code prints 'on'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

Question 274

A developer tests string negative indexing and slices. The following code prints 'bcd'. Which explanation best accounts for that observed behavior?s="ABCDE" print(s[1:4])

  1. items yields key/value pairs while values yields values; unpacking pairs preserves their association.
  2. The optional third slice component controls stride, including reverse traversal with a negative step.
  3. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.
  4. dict.get(key, default) returns the default for a missing key, unlike direct subscription.

Explanation

Correct Answer

C:

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

Incorrect Answers

A:

The dictionary items and values topic does not explain why the code prints 'bcd'. The relevant Python rule is: String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

B:

The strided list slices topic does not explain why the code prints 'bcd'. The relevant Python rule is: String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

D:

The dictionary get with fallback topic does not explain why the code prints 'bcd'. The relevant Python rule is: String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

Question 275

A learner is checking string negative indexing and slices. After this modification, what does Python 3 actually do?s="Hello" print(s[::-1])

  1. Prints 'Hello'
  2. Prints 'olleH'
  3. Prints 'olleH?'
  4. Prints 'olle'

Explanation

Correct Answer

B:

The snippet prints 'olleh'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

Incorrect Answers

A:

This predicts that the snippet prints 'hello', but executing the displayed Python 3 code prints 'olleh'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

C:

This predicts that the snippet prints 'olleh?', but executing the displayed Python 3 code prints 'olleh'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

D:

This predicts that the snippet prints 'olle', but executing the displayed Python 3 code prints 'olleh'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

Question 276

During a review of string negative indexing and slices, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: s="ABCDE" print(s[1:4]) Program B: s="Hello" print(s[::-1]) Program C: s="banana" print(s[::2])

  1. Program C prints '[7]'.
  2. Program C prints 'bnn'.
  3. Program A prints 'bnn'.
  4. Program B prints 'false'.
  5. Program A prints 'bcd'.
  6. Program B prints 'olleh'.

Explanation

Correct Answers

B:

Running Program C prints 'bnn'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

E:

Running Program A prints 'bcd'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

F:

Running Program B prints 'olleh'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

Incorrect Answers

A:

Program C does not produce '[7]'; its verified result is: Prints 'bnn'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

C:

Program A does not produce 'bnn'; its verified result is: Prints 'BCD'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

D:

Program B does not produce 'false'; its verified result is: Prints 'olleH'. String indexing and slicing resemble list indexing, but slicing returns a new string and excludes the stop.

Question 277

A learner is checking string immutability and reassembly. What is the exact printed result or uncaught exception?s="cat" s[0]="b"

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

Explanation

Correct Answer

C:

The snippet raises typeerror. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

Incorrect Answers

A:

This predicts that the snippet raises indexerror, but executing the displayed Python 3 code raises typeerror. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

B:

This predicts that the snippet raises valueerror, but executing the displayed Python 3 code raises typeerror. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

D:

This predicts that the snippet raises keyerror, but executing the displayed Python 3 code raises typeerror. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

Question 278

A developer tests string immutability and reassembly. The following code prints 'bat'. Which explanation best accounts for that observed behavior?s="cat" s="b"+s[1:] print(s)

  1. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.
  2. Tuple immutability protects its slots, but a mutable object stored inside a tuple can change in place.
  3. When a dictionary literal repeats the same key, the later value replaces the earlier value.
  4. dict.get(key, default) returns the default for a missing key, unlike direct subscription.

Explanation

Correct Answer

A:

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

Incorrect Answers

B:

The mutable objects inside tuple topic does not explain why the code prints 'bat'. The relevant Python rule is: Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

C:

The duplicate dictionary keys overwritten topic does not explain why the code prints 'bat'. The relevant Python rule is: Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

D:

The dictionary get with fallback topic does not explain why the code prints 'bat'. The relevant Python rule is: Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

Question 279

A learner is checking string immutability and reassembly. After this modification, what does Python 3 actually do?word="go" word+= "!" print(word)

  1. Prints 'go!'
  2. Prints 'go!?'
  3. Prints '!og'
  4. Prints 'go'

Explanation

Correct Answer

A:

The snippet prints 'go!'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

Incorrect Answers

B:

This predicts that the snippet prints 'go!?', but executing the displayed Python 3 code prints 'go!'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

C:

This predicts that the snippet prints '!og', but executing the displayed Python 3 code prints 'go!'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

D:

This predicts that the snippet prints 'go', but executing the displayed Python 3 code prints 'go!'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

Question 280

During a review of string immutability and reassembly, three independent Python 3 fragments are shown. Which THREE statements accurately describe their behavior? (Choose THREE.)Program A: s="cat" s="b"+s[1:] print(s) Program B: word="go" word+= "!" print(word) Program C: s="abc" print(s.replace("a","z"),s)

  1. Program C prints 'zbc abc'.
  2. Program B prints 'go!'.
  3. Program A prints 'bcd'.
  4. Program A prints 'bat'.
  5. Program B prints 'bcd'.
  6. Program C raises nameerror.

Explanation

Correct Answers

A:

Running Program C prints 'zbc abc'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

B:

Running Program B prints 'go!'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

D:

Running Program A prints 'bat'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

Incorrect Answers

C:

Program A does not produce 'bcd'; its verified result is: Prints 'bat'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

E:

Program B does not produce 'bcd'; its verified result is: Prints 'go!'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

F:

Program C does not raises nameerror; its verified result is: Prints 'zbc abc'. Strings are immutable; constructing a new string works but assigning directly into an index raises TypeError.

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.