Courseiva
Computer Programming and Python FundamentalsmediumMultiple SelectObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Which THREE of the following code snippets will successfully print the string 'Hello, World!'? (Choose three.)

⚠ Common exam trap

The PCEP exam often tests the distinction between string delimiters and the need for escaping quotes, trapping candidates who assume that any quote pair can contain the same quote character without escaping.

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

print('''Hello, World!''')

Triple-quoted strings in Python, using three single quotes ('''), can span multiple lines but also work for single-line strings. The code print('''Hello, World!''') outputs the string exactly as 'Hello, World!' without any syntax error, as the triple quotes properly delimit the string.

Answer analysis

Option-by-option breakdown

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

  • print('''Hello, World!''')

    Why this is correct

    Triple quotes are valid for strings.

  • print("He said, "Hello!"")

    Why it's wrong here

    Unescaped double quotes inside double-quoted string cause error.

  • print("Hello, World!")

    Why this is correct

    Valid double-quoted string.

  • print('It's a beautiful day')

    Why it's wrong here

    Single quote inside single-quoted string ends prematurely.

  • print('Hello, World!')

    Why this is correct

    Valid single-quoted string.

About these practice questions

Courseiva writes every PCEP question from scratch — 498 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 PCEP 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 PCEP exam.