PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
Exhibit
Refer to the exhibit. x = 7 y = 2 result = x / y print(type(result))
What is the output of the code?
⚠ Common exam trap
Python Institute often tests the distinction between `/` (true division) and `//` (floor division) in Python 3, and the trap here is that candidates mistakenly think integer division with `/` yields an integer, confusing it with Python 2 behavior or the `//` operator.
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
✓
<class 'float'>
The code uses the `type()` function to determine the data type of the result of the expression `10 / 3`. In Python 3, the `/` operator always performs true division, which returns a floating-point number even if the operands are integers. Therefore, `10 / 3` evaluates to `3.3333333333333335` (a float), and `type()` returns `<class 'float'>`. Option C is correct.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
<class 'str'>
Why it's wrong here
The code returns a string instance, so its type prints as <class 'str'>; the option describes the class object itself, not the value's type. It tempts because str is the correct type name, and calling type() on the class rather than the instance would indeed yield <class 'type'>.
- ✗
<class 'int'>
Why it's wrong here
The code produces a boolean result, so type() reports bool rather than int; Python's bool subclasses int but type() returns the exact class. It is tempting because booleans behave like 0 and 1 in arithmetic, and would be correct if the expression performed numeric addition instead of a comparison.
- ✓
<class 'float'>
Why this is correct
Dividing with the `/` operator in Python 3 always returns a float, even when both operands are integers and divide evenly. Since the expression uses true division, the result's type is float, so `type()` reports `<class 'float'>`, satisfying the stem's request for the exact printed output.
- ✗
<class 'bool'>
Why it's wrong here
The expression evaluates to an integer, so the type reported is int, not bool; bool only appears when the value is True or False. It is tempting because comparison operators such as == or > produce booleans, and would be correct if the code compared values rather than computing arithmetic.
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 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.