PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A developer writes: x = 5; y = 2.0; z = x / y; print(type(z)). What is the output?
⚠ Common exam trap
Python Institute often tests the distinction between / (true division, always returns float) and // (floor division, returns int for int operands) to catch candidates who assume integer division returns an integer.
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'>
In Python, the division operator (/) always returns a float, even when dividing two integers. Here, x is an integer (5) and y is a float (2.0), so the result is a float (2.5). The type() function returns <class 'float'>, making D 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
No strings are involved.
- ✗
<class 'int'>
Why it's wrong here
Division involving a float yields a float, not int.
- ✗
TypeError
Why it's wrong here
No error occurs; division is valid.
- ✓
<class 'float'>
Why this is correct
x / y returns a float because y is float.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCEP question from scratch — 498 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.