Courseiva

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

A program checks divisibility. Which condition correctly determines if a number n is divisible by 7?

⚠ Common exam trap

The PCEP exam often tests the distinction between division operators (/, //, %) and expects candidates to know that only the modulo operator (%) correctly checks divisibility, not the quotient operators.

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

✓

n % 7 == 0

The modulo operator (%) returns the remainder of the division of n by 7. If the remainder is 0, then n is exactly divisible by 7. This is the standard way to test divisibility in Python.

Answer analysis

Option-by-option breakdown

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

  • ✗

    n / 7 == 0

    Why it's wrong here

    True division yields a quotient that equals zero only when n is zero, so this never detects divisibility for positive n. It is tempting because the quotient concept feels related to division, but it suits comparisons of magnitude, not remainder checks.

  • ✗

    n // 7 == 0

    Why it's wrong here

    Floor division returns zero only when n is less than seven, so it fails for multiples such as 14 or 21. It is tempting because integer division looks like a divisibility test, but it actually suits extracting a digit or quotient, not checking remainders.

  • ✓

    n % 7 == 0

    Why this is correct

    The modulo operator returns the remainder of integer division, so n % 7 yields zero exactly when seven divides n without a remainder. This directly satisfies the stem's divisibility requirement, correctly identifying multiples of 7 including zero, unlike division or comparison operators that would not test remainder.

  • ✗

    n % 7 != 0

    Why it's wrong here

    The inequality is true when n is not divisible by seven, the inverse of the requirement. It is tempting because it correctly identifies non-multiples, which is the right test when you need to filter out numbers that are not multiples of seven.

About these practice questions

One of 482 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 →

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.