Courseiva
Computer Programming and Python FundamentalseasyMultiple ChoiceObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Which of the following is a correct way to comment multiple lines in Python?

⚠ Common exam trap

The PCEP exam often tests the distinction between Python's actual comment syntax (#) and the use of triple-quoted strings as a de facto multi-line comment, leading candidates to incorrectly choose /* */ or // from other languages.

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

""" comment """

Triple-quoted strings (''' or """) in Python can be used as multi-line comments when they are not assigned to a variable, as they are ignored by the interpreter as expressions. This is a common practice for documenting code or temporarily disabling multiple lines.

Answer analysis

Option-by-option breakdown

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

  • // comment

    Why it's wrong here

    This is C++/Java style, not valid in Python.

  • /* comment */

    Why it's wrong here

    This is C-style comment syntax, not valid in Python.

  • """ comment """

    Why this is correct

    Triple quotes create a multi-line string that can serve as a comment.

  • # comment (each line)

    Why it's wrong here

    This works but requires a # on every line, not a single multi-line comment construct.

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.