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

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

A developer writes the following code: a = 3; b = 2; c = a / b; d = a // b; e = a % b. What are the values of c, d, e?

⚠ Common exam trap

It's easy for candidates to confuse the / operator (true division) with the // operator (floor division) and mistakenly think // returns a float, or they miscalculate the remainder by assuming it is always the fractional part of the division.

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

c=1.5, d=1, e=1

In Python, the / operator performs true division, yielding a float result (3/2 = 1.5). The // operator performs floor division, which for positive numbers truncates the decimal part, giving 1. The % operator returns the remainder of the division, which is 3 - (1 * 2) = 1. Thus c=1.5, d=1, e=1.

Answer analysis

Option-by-option breakdown

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

  • c=1, d=1, e=1

    Why it's wrong here

    True division gives 1.5, not 1.

  • c=1.5, d=1, e=0

    Why it's wrong here

    Remainder is 1, not 0.

  • c=1.5, d=1, e=1

    Why this is correct

    Correct values.

  • c=1.5, d=1.5, e=0

    Why it's wrong here

    Floor division gives 1, not 1.5.

About these practice questions

This PCEP question is part of Courseiva's 498-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 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.