Courseiva
Computer Programming and Python FundamentalseasyMultiple SelectObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Which TWO of the following are valid Python variable names?

⚠ Common exam trap

The PCEP exam often tests the rule that variable names cannot start with a digit, and the distinction between hyphens (which are operators) and underscores (which are valid identifier characters), leading candidates to mistakenly accept '2nd_var' or 'my-var' as valid.

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

my_var2

Python variable names must start with a letter or underscore, and can contain letters, digits, and underscores. 'my_var2' starts with a letter and contains only valid characters, so it is a valid identifier.

Answer analysis

Option-by-option breakdown

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

  • my_var2

    Why this is correct

    Letters, underscores, and digits are allowed.

  • 2nd_var

    Why it's wrong here

    Cannot start with a digit.

  • _myvar

    Why this is correct

    Underscore is allowed as starting character.

  • my-var

    Why it's wrong here

    Hyphen is not allowed in variable names.

  • for

    Why it's wrong here

    'for' is a reserved keyword.

About these practice questions

One of 498 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.