PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
Given the following code, which of the following statements are true after execution? (Choose three.)
x = 10 y = 3.0 z = x / y w = x // y
⚠ Common exam trap
The PCEP exam often tests the misconception that floor division (//) returns an int when one operand is a float, or that true division (/) can return an integer, leading candidates to incorrectly select options C or D.
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
✓
The expression x % y is valid.
The modulo operator % works with both integers and floats in Python. Here, x is an int and y is a float, so x % y is valid and returns a float result (the remainder of the division).
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The expression x % y is valid.
Why this is correct
Modulo works with floats.
- ✓
The value of z is approximately 3.33 (type float).
Why this is correct
Division of int by float yields float.
- ✗
The type of w is int.
Why it's wrong here
Floor division with a float operand returns a float.
- ✗
The expression x / y returns an integer.
Why it's wrong here
True division always returns a float.
- ✓
The value of w is 3.0.
Why this is correct
10 // 3.0 = 3.0.
Go deeper
Related to this question
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 →
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.