Courseiva
StringshardMultiple SelectObjective-mapped

PCAP Strings Practice Question

Which THREE of the following are valid ways to create a string in Python?

⚠ Common exam trap

Python Institute often tests the distinction between string literals and the str() constructor, tricking candidates into thinking that str(None) is invalid or that str(['h','i']) produces 'hi', when in fact it produces the list's string representation.

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

'world'

All five options are valid ways to create a string in Python. 'world' (A) is a single-quoted string literal, str(['h','i']) (B) uses the str() constructor to convert a list into its string representation ''['h', 'i']'', '''multi-line''' (C) is a triple-quoted string literal, str(None) (D) converts the None object into the string 'None', and 'hello' (E) is a double-quoted string literal. The str() function returns a string for any argument, making B and D just as valid as the literals A, C, and E.

Answer analysis

Option-by-option breakdown

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

  • 'world'

    Why this is correct

    'world' is a string literal enclosed in single quotes, directly creating a string.

  • str(['h','i'])

    Why this is correct

    str(['h','i']) calls the str() constructor, which returns the string representation of the list, ''['h', 'i']'', a valid string.

  • """multi-line"""

    Why this is correct

    '''multi-line''' is a triple-quoted string literal, valid for multi-line strings.

  • str(None)

    Why this is correct

    str(None) calls the str() constructor on None, producing the string 'None'.

  • "hello"

    Why this is correct

    'hello' is a string literal enclosed in double quotes, directly creating a string.

About these practice questions

This PCAP question is part of Courseiva's 169-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.