PCEP Computer Programming and Python Fundamentals Practice Question
A developer is writing a Python script and assigns a value to a variable named '2nd_place'. When the script is run, it raises a SyntaxError. What is the cause of this error?
⚠ Common exam trap
The trap here is focusing on the underscore or the word 'place' instead of the leading digit, which is the actual syntax violation.
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
✓
Variable names cannot start with a digit.
Python identifiers must start with a letter or underscore, not a digit. The name '2nd_place' begins with '2', so the parser cannot treat it as a single identifier and raises a SyntaxError. Underscores are allowed, uppercase is not required, and the name is not a keyword.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Variable names must be uppercase.
Why it's wrong here
Python does not require uppercase variable names. Lowercase and mixed-case identifiers are perfectly valid. The convention is to use lowercase with underscores for ordinary variables, but uppercase is not mandatory. The SyntaxError arises from the leading digit, not from the case of the letters.
- ✓
Variable names cannot start with a digit.
Why this is correct
In Python, identifiers must begin with a letter (a-z, A-Z) or an underscore, not a digit. '2nd_place' starts with '2', which is invalid. This rule prevents ambiguity with numeric literals. The interpreter cannot parse '2nd_place' as a single token, so it raises a SyntaxError at the point of assignment.
- ✗
The name '2nd_place' is a reserved keyword.
Why it's wrong here
Reserved keywords in Python include 'if', 'else', 'for', 'while', etc., but '2nd_place' is not one of them. Keywords are valid identifiers syntactically but have special meaning; however, '2nd_place' is not a keyword. The error is purely lexical: it starts with a digit, which is not allowed.
- ✗
Variable names cannot contain underscores.
Why it's wrong here
Underscores are allowed in Python identifiers after the first character. Names like 'second_place' or '_2nd_place' are valid. The error is not due to the underscore but due to the leading digit. Underscores are commonly used to separate words in variable names, so this is not a restriction.
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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Python Institute exam blueprint
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.