Courseiva
Question 317 of 498
Computer Programming and Python FundamentalshardMultiple ChoiceObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Exhibit

config = {
    'env': 'prod',
    'debug': False,
    'max_retries': 3
}
if config.get('debug', False):
    print("Debug mode active")
else:
    print("Running in normal mode")

Refer to the exhibit. A developer runs this code. What is printed?

⚠ Common exam trap

The PCEP exam often tests the `if __name__ == '__main__':` idiom to see if candidates understand that `__name__` is `'__main__'` only when the script is run directly, not when imported.

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

Running in normal mode

The code first checks a variable `debug`. Since `debug` is likely `False` or not set (default), the condition `if debug:` is `False`, so it moves to the `elif` branch. The condition `if __name__ == '__main__':` evaluates to `True` because the script is run directly, so it prints 'Running in normal mode'. This is the standard Python entry-point pattern for conditional execution of code only when the script is executed directly.

Answer analysis

Option-by-option breakdown

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

  • Running in normal mode

    Why this is correct

    Since debug is False, the else branch runs.

  • Error

    Why it's wrong here

    The code is syntactically correct and runs without error.

  • True

    Why it's wrong here

    The print statement does not output the boolean.

  • Debug mode active

    Why it's wrong here

    That would print if the value were True.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.