Courseiva
Computer Programming and Python FundamentalseasyMultiple ChoiceObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Which of the following statements about Python indentation is true?

⚠ Common exam trap

Many exam-takers think indentation is merely a style recommendation (like in other languages) or that it only applies to control flow statements, but Python strictly enforces it for all block structures, and mixing tabs with spaces is a common pitfall that leads to runtime errors.

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

Indentation must be consistent within a block.

Python enforces consistent indentation within a block to define the scope of statements. Unlike many languages that use braces, Python relies on the indentation level to group statements, and any inconsistency (e.g., mixing spaces and tabs or varying the number of spaces) will raise an IndentationError.

Answer analysis

Option-by-option breakdown

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

  • Indentation is optional but recommended.

    Why it's wrong here

    It's required.

  • You can mix tabs and spaces freely.

    Why it's wrong here

    Mixing can cause IndentationError.

  • Indentation must be consistent within a block.

    Why this is correct

    Correct.

  • Indentation only matters for loops and conditionals.

    Why it's wrong here

    It matters for all blocks (functions, classes, etc.).

About these practice questions

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