Courseiva
Data Types, Variables, Basic I/O and OperatorsmediumMultiple ChoiceObjective-mapped

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 (`//`), and the trap here is that candidates mistakenly think dividing two integers always yields an integer, forgetting that Python 3's `/` 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

<class 'float'>

The expression `3 / 2` performs true division in Python, which always returns a float even if both operands are integers. The result is `1.5`, and `type(1.5)` returns `<class 'float'>`. Therefore, option B 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

    Not a string.

  • <class 'float'>

    Why this is correct

    Division yields float.

  • <class 'int'>

    Why it's wrong here

    Even if divisible, division returns float.

  • <class 'bool'>

    Why it's wrong here

    Not boolean.

About these practice questions

One of 498 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.