Courseiva
Strings →easyMultiple Choice

PCAP list Practice Question

Exhibit

Consider the following Python code:

s = 'Python Programming'
print(s.split())

Consider the following code: print(type('apple,banana,cherry'.split(','))) What type of value is printed?

⚠ Common exam trap

Candidates may incorrectly think that `split()` returns a tuple or that the type of a list literal is printed as 'list' due to confusion with brackets. However, `split()` always returns a list, so `type()` outputs `<class 'list'>`.

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

✓

list

The `split()` method of a string returns a list of substrings. Thus, `type()` on that result returns `<class 'list'>`, indicating that the value is a 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.

  • ✓

    list

    Why this is correct

    When you call split() on a string, Python parses the string and returns a list of substrings, using whitespace or a specified separator as the delimiter. This list is mutable, so you can modify, index, or iterate over it. For example, 'a,b'.split(',') yields the list ['a', 'b'].

  • ✗

    tuple

    Why it's wrong here

    Unlike a tuple, which is an immutable sequence enclosed in parentheses, split() constructs a mutable list with square-bracket semantics. The method does not produce a tuple at any time; even if you use tuple(s.split()), you still must convert the list. Attempting to call tuple methods on the result would fail because the return type is list, not tuple.

  • ✗

    string

    Why it's wrong here

    A string is a single immutable sequence of characters, but split() breaks the original string into multiple substrings stored in a collection. The result is never one string; it is an ordered container of strings. If it returned a string, you would lose the boundaries between words and be unable to access individual pieces by index as separate entities. Therefore, the correct type is a list containing each piece as a separate string element.

  • ✗

    dict

    Why it's wrong here

    A dictionary stores key–value pairs and is accessed by unique keys, but split() produces an unkeyed, positionally ordered collection of strings. There is no hash mapping or key association in the output; each element is simply a substring. To get a dict, you would have to manually construct one, for example by enumerating the list from split() and assigning keys.

About these practice questions

This PCAP question is part of Courseiva's 421-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.