Courseiva

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

Exhibit

Refer to the exhibit.

>>> x = 10
>>> y = 3
>>> z = x // y
>>> print(z)

What is the output of the code in the exhibit?

⚠ Common exam trap

Python Institute often tests the distinction between / (true division returning a float) and // (floor division returning an int), tricking candidates who confuse the two operators or forget that integer division discards the remainder.

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

✓

3

The code performs integer division using the // operator, which in Python returns the floor of the division result for positive numbers. Since 10 // 3 equals 3 (the integer part of 10/3), the output is 3. Option A is correct because integer division discards the fractional part.

Answer analysis

Option-by-option breakdown

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

  • ✓

    3

    Why this is correct

    The loop iterates over the list `[1, 2, 3]`, and the accumulator variable is reassigned on each pass rather than appended to, so only the final element survives. Printing after the loop therefore yields the last value, 3, satisfying the stem's requirement to trace the code's actual output.

  • ✗

    4

    Why it's wrong here

    The exhibit's expression evaluates to a different value, so 4 does not match the computed result. It is tempting because 4 is a plausible integer output, and it would be correct if the code performed the arithmetic that yields 4 rather than the operations actually shown.

  • ✗

    3.0

    Why it's wrong here

    The exhibit's expression yields an integer, not a float, so 3.0 misrepresents the type and value. It is tempting because 3.0 equals 3 numerically, and it would be correct if the code used true division or float operands producing a float result.

  • ✗

    3.3333333333333335

    Why it's wrong here

    Integer division with // yields 3, while true division of 10 by 3 produces the repeating binary float 3.3333333333333335. The option mistakes the operator: it is tempting because / always returns a float in Python 3, but the exhibit uses //, which floors to an int.

About these practice questions

Courseiva writes every PCEP question from scratch — 482 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 →

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.