Courseiva
Strings →hardMultiple Select

PCAP Strings Practice Question

Which three of the following statements about Python strings are true? (Choose three.)

⚠ Common exam trap

PCAP often tests the immutability of strings by presenting a statement that suggests strings can be changed in place, catching candidates who confuse strings with mutable sequence types like lists.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

The join() method is called on the separator string.

The join() method is called on the separator string, not on the iterable. For example, ','.join(['a', 'b']) returns 'a,b'. The separator is the string that will be placed between each element of the iterable passed as an argument. This is a common point of confusion because many learners mistakenly think join() is called on the list.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    The join() method is called on the separator string.

    Why this is correct

    The join() method is invoked on the separator string, and it takes an iterable of strings as its argument. For example, ','.join(['a', 'b']) returns 'a,b' by inserting the separator between each pair of elements. The separator string is not modified; it is reused as the delimiter, and every element in the iterable must be a string or a TypeError will be raised.

  • ✗

    The string '123.45' can be converted to integer using int('123.45').

    Why it's wrong here

    The expression int('123.45') is invalid because int() only accepts a string that represents an integer literal, such as '123', without a decimal point or exponent. Passing a string containing a decimal point raises a ValueError. To convert a decimal string, you must first use float('123.45') and then optionally convert to an integer with int(), which would truncate the fractional part.

  • ✓

    Strings support indexing with integers.

    Why this is correct

    Strings support indexing with integers because each string is a sequence of individual characters. Indices are zero-based, meaning the first character is at index 0, and negative integers count from the end, with -1 referring to the final character. Attempting to use an out-of-range index raises an IndexError, so indexing is a foundational way to access specific characters in a string.

  • ✗

    Strings are mutable.

    Why it's wrong here

    Strings are immutable in Python, meaning that once a string object is created, its contents cannot be changed in place. Any operation that appears to modify a string, such as concatenation or replacement, actually creates a brand-new string object rather than altering the original. This immutability allows strings to be hashed (usable as dictionary keys) and safely shared across threads, but it also means that building a string through repeated concatenation in a loop can be inefficient.

  • ✓

    The len() function returns the number of characters including spaces.

    Why this is correct

    The len() function returns the total number of characters in a string, and critically, it counts every character including spaces, tabs, newlines, and other whitespace characters. For example, len('hello world') returns 11 because the space between the two words is counted. len() counts Unicode code points rather than bytes, so most common characters have a length of 1, but some Unicode characters composed of multiple code points may affect the count.

About these practice questions

One of 421 original PCAP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCAP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCAP exam.