← All PCEP Flashcard Decks

PCEP String Operations and Methods Flashcards

6 cards from real PCEP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 6 PCEP String Operations and Methods flashcards as text
  1. What is the output of `'Python'[-1]`?

    Answer: n

    Negative indexing starts from the end; `-1` refers to the last character, which is 'n'.

  2. What does `'hello' in 'hello world'` evaluate to?

    Answer: True

    The `in` operator returns `True` if the left string is a substring of the right string.

  3. Which string method checks if a string starts with a specified prefix?

    Answer: startswith()

    `startswith(prefix)` returns `True` if the string begins with the given prefix.

  4. What is the result of `str(42)`?

    Answer: '42'

    `str()` converts an integer to its string representation, resulting in the string '42'.

  5. What does `'Hello World'.count('l')` return?

    Answer: 3

    `count()` returns the number of non-overlapping occurrences; 'l' appears 3 times in 'Hello World'.

  6. What is the output of `'abc' * 0`?

    Answer: ''

    Multiplying a string by 0 produces an empty string because the string is repeated zero times.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy

Sources & references

Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy

  1. pythoninstitute.org — Fees, exam format, passing score, retake fee, score release, time limit, score validity, test delivery, eligibility, retake policy · verified Oct 2026