easyMultiple ChoiceObjective-mapped
FC0-U71 Practice Question: Correctly declares a variable to store a person's…
Which of the following correctly declares a variable to store a person's age in Python?
⚠ Common exam trap
The trap here is that candidates familiar with statically-typed languages (like Java or C++) may choose Option B, mistakenly applying type declaration syntax to Python, which does not use it.
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
✓
age = 25
In Python, variables are created by assignment with the `=` operator, and no explicit type declaration is needed. Option D correctly assigns the integer value 25 to the variable `age` using `age = 25`, which is the proper syntax for declaring and initializing a variable in Python.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
var age = 25
Why it's wrong here
'var' is not used in Python for variable declaration.
- ✗
int age = 25
Why it's wrong here
Python does not require type declaration; this syntax is from other languages.
- ✗
age == 25
Why it's wrong here
This is a comparison operator, not assignment.
- ✓
age = 25
Why this is correct
This correctly assigns the value 25 to the variable age.
Go deeper
Related to this question
About these practice questions
This FC0-U71 question is part of Courseiva's 988-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on FC0-U71
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A developer writes a Python script that processes user input. During execution, the script prompts for an age and stores it in a variable. Which data type is most appropriate for the variable that stores the age?
hard- A.Float
- B.Boolean
- C.String
- ✓ D.Integer
Why D: Age is typically a whole number, so an integer (int) is the most appropriate data type. Python's int can store whole numbers without decimals.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This FC0-U71 practice question is part of Courseiva's free CompTIA 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 FC0-U71 exam.