PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A developer wants to store a person's age. Which of these variable names is invalid?
⚠ Common exam trap
Python Institute often tests the rule that variable names cannot start with a digit, tricking candidates who focus on case sensitivity or underscores instead of the initial character restriction.
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
✓
3rd_age
In Python, variable names must start with a letter or an underscore, not a digit. Option B (`3rd_age`) begins with a digit, which violates Python's identifier naming rules and will raise a `SyntaxError` if used in code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
_age
Why it's wrong here
'_age' is a valid identifier; a leading underscore is permitted in Python, though it conventionally signals internal or private use. It stores the value correctly. The invalid case would be a name starting with a digit or containing illegal characters such as a hyphen, which the parser rejects.
- ✓
3rd_age
Why this is correct
Python identifiers cannot begin with a digit, so `3rd_age` fails at the lexer stage before any assignment occurs. The stem asks which name is invalid, and this constraint on the first character makes it the only option that cannot be parsed as a valid identifier.
- ✗
Age
Why it's wrong here
'Age' is a valid Python identifier: it begins with a letter and contains only letters, so it satisfies naming rules. It is a sensible, descriptive choice for storing a person's age. The invalid option would be one starting with a digit or containing a hyphen or space, which Python rejects at parse time.
- ✗
age_3
Why it's wrong here
'age_3' is valid: it starts with a letter, and underscores and digits are permitted after the first character. It is a reasonable name when several age variables are needed. An identifier beginning with a digit, such as '3age', would be invalid because Python forbids that.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCEP question from scratch — 482 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 →
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.