Courseiva

PCEP Practice Question: Data Types, Variables, Basic I/O and Operators

A Python programmer is analyzing the results of several expressions. Which TWO of the following expressions evaluate to a float value? (Choose two.)

⚠ Common exam trap

The trap here is assuming that floor division always returns an integer, but when one operand is a float, the result is 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

✓

4.0 // 2

In Python, the / operator always returns a float, so 4 / 2 yields 2.0. Additionally, floor division // returns a float if either operand is a float, so 4.0 // 2 yields 2.0. The other expressions involve only integers and use operators that return integers when both operands are integers. Thus, the expressions that evaluate to a float are 4 / 2 and 4.0 // 2.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    4 + 2

    Why it's wrong here

    Adding two integers results in an integer. 4 + 2 equals 6, which is of type int. This expression does not produce a float. It is a straightforward integer addition. While addition can produce a float if one operand is a float, here both are integers, so the result remains an integer.

  • ✓

    4.0 // 2

    Why this is correct

    The floor division operator // returns a float if either operand is a float. Here, 4.0 is a float, so 4.0 // 2 yields 2.0, which is a float. Even though the operation is floor division, the presence of a float operand forces the result to be a float. Thus, this expression evaluates to a float value.

  • ✓

    4 / 2

    Why this is correct

    The division operator / in Python always returns a float, even when the division is exact. 4 / 2 equals 2.0, which is a float. Therefore, this expression evaluates to a float value. This is a key distinction from floor division, which would return an integer if both operands are integers.

  • ✗

    4 * 2

    Why it's wrong here

    The multiplication of two integers yields an integer. 4 * 2 equals 8, which is of type int. No float is involved, so this expression does not evaluate to a float. This option might be chosen if one mistakenly thinks that any arithmetic operation produces a float, but that is not the case here.

  • ✗

    4 // 2

    Why it's wrong here

    The floor division operator // returns an integer when both operands are integers. 4 // 2 equals 2, which is an int, not a float. While the result is numerically the same as 4 / 2, the type is different. This expression does not evaluate to a float, so it is not one of the correct choices.

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 →

How Courseiva writes practice questions · Editorial policy

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.