Courseiva
Data Types, Variables, Basic I/O and OperatorseasyMultiple SelectObjective-mapped

PCEP Practice Question: Data Types, Variables, Basic I/O and Operators

Which of the following are valid Python variable names? (Choose two.)

⚠ Common exam trap

The PCEP exam often tests the distinction between hyphens (which are not allowed) and underscores (which are allowed), and the rule that keywords like 'for' cannot be used as variable names, even though they look like valid identifiers.

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

data_1

(data_1) is correct because Python variable names can contain letters, digits, and underscores, but must not start with a digit. 'data_1' starts with a letter and includes an underscore and digit, all of which are allowed.

Answer analysis

Option-by-option breakdown

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

  • for

    Why it's wrong here

    for is a reserved keyword and cannot be used as a variable name.

  • data_1

    Why this is correct

    Letters, digits, and underscores are allowed, and the name does not start with a digit.

  • _count

    Why this is correct

    Underscore is allowed at the start of a variable name.

  • 2nd_place

    Why it's wrong here

    Variable names cannot start with a digit.

  • my-var

    Why it's wrong here

    Hyphens are not allowed in variable names; underscores are used instead.

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.