Courseiva

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

Exhibit

Refer to the exhibit.

>>> x = 10
>>> y = 3
>>> print(x // y, x % y)

What is the output from the interactive Python session?

⚠ Common exam trap

Python Institute often tests the distinction between true division (`/`) and floor division (`//`), knowing that candidates may confuse the two or forget that integer division in Python 3 returns an integer, not 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

✓

3 1

The expression `10 // 3` performs integer (floor) division, which discards the fractional part and returns the integer quotient 3. The expression `10 % 3` returns the remainder of the division, which is 1. Therefore, the output is `3 1`, making option B 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.

  • ✗

    3.333 1

    Why it's wrong here

    The session's integer division and modulo operations yield different values than 3.333 and 1; the float result arises only when true division is used, and the remainder depends on the actual operands. This pair is tempting when a candidate assumes division always returns a float and misreads the modulo operand.

  • ✓

    3 1

    Why this is correct

    Slicing `s[1:4]` extracts characters at indices 1, 2 and 3, giving `'ell'`, whose length is 3. The expression `s[0]` returns the first character `'h'`, not a count. Printing both yields `3 1`, satisfying the stem's request for the session's exact output.

  • ✗

    1 3

    Why it's wrong here

    The interactive session's division and modulo operators produce values other than 1 and 3 for the given operands; these numbers would appear only if the operands and operator order matched that pairing. It tempts candidates who swap the dividend and divisor or confuse floor division with modulo.

  • ✗

    3 0

    Why it's wrong here

    Neither 3 nor 0 matches the session's computed results; a zero remainder occurs only when the divisor divides the dividend exactly, and 3 would require different operands. It tempts candidates who assume the modulo always returns the divisor or misapply operator precedence.

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.