PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A quiz program stores a user's score as score = 7 and the number of questions as total = 2. The developer writes percentage = score / total * 100. What value is displayed?
⚠ Common exam trap
The trap here is expecting integer division from the / operator, as in Python 2 or many other languages, when Python 3 always returns a float.
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
✓
350.0
Python 3 uses true division for the / operator, so dividing two integers yields a float. With score = 7 and total = 2, 7 / 2 is 3.5, and 3.5 * 100 is 350.0. The expression evaluates left to right, so the multiplication by 100 cannot be skipped. The displayed value includes a decimal because the result type is float.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
350
Why it's wrong here
This would be the result only if the division truncated to an integer before multiplication. Python 3's / does not truncate; it produces a float. The value 350 without a decimal point would require floor division and integer multiplication, which is not what the expression uses.
- ✓
350.0
Why this is correct
In Python 3, the / operator always performs true division, so 7 / 2 evaluates to 3.5 even though both operands are integers. Multiplying by 100 gives 350.0. The result is a float, which is why the decimal appears. This is the expected behavior for a percentage calculation.
- ✗
3.5
Why it's wrong here
3.5 is the intermediate result of 7 / 2 before the multiplication by 100. The full expression continues with * 100 due to left-to-right evaluation, so stopping at 3.5 ignores the remaining operation. A programmer might mistakenly read the division as the final step.
- ✗
TypeError
Why it's wrong here
No type error occurs because both operands of / and * are numbers. Mixing integers and floats in arithmetic is fully supported; Python promotes the result to float. A TypeError would arise only if a string or other non-numeric type were involved in the multiplication.
Go deeper
Related to this question
About these practice questions
This PCEP question is part of Courseiva's 482-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 →
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.