Courseiva

PCAP Modules and Packages Practice Question

Match each code snippet to its output.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

8

3

1

15

14

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

✓

2 + 3 * 4: 14

Understand operator precedence: exponentiation > multiplication/division > addition/subtraction. Parentheses override precedence. Integer division (//) returns floor division quotient, while modulo (%) returns remainder.

Answer analysis

Option-by-option breakdown

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

  • ✓

    2 + 3 * 4: 14

    Why this is correct

    Correct. Python's operator precedence rules dictate that multiplication (*) is evaluated before addition (+), even when the multiplication appears to the right of the addition. Thus 3 * 4 is computed first, yielding 12, and then 2 + 12 gives the result 14. This is a direct application of standard mathematical precedence, not a left-to-right evaluation.

  • ✓

    (2 + 3) * 4: 20

    Why this is correct

    Correct. Parentheses override Python's default operator precedence and force the addition to be evaluated first. The expression inside the parentheses, 2 + 3, is computed to produce 5, and then the multiplication by 4 yields 20. This demonstrates that grouping symbols explicitly control evaluation order, which is essential when the intended operation sequence differs from operator precedence.

  • ✗

    2 ** 3: 6

    Why it's wrong here

    Incorrect. The correct output of 2 ** 3 is 8, because the exponentiation operator (**) raises 2 to the third power, meaning 2 * 2 * 2. The value 6 would result from multiplying 2 by 3 (2 * 3), which is a different operation. This mistake likely stems from confusing exponentiation with ordinary multiplication.

  • ✗

    10 // 3: 1

    Why it's wrong here

    Incorrect. In Python, the // operator performs floor division, which for 10 // 3 gives the integer quotient 3, since 3 goes into 10 exactly 3 times with a remainder. The value 1 is actually the remainder of the division, which would be obtained using the modulo operator: 10 % 3. Floor division always returns the largest integer less than or equal to the exact quotient when both operands are positive, so the result cannot be 1.

About these practice questions

This PCAP question is part of Courseiva's 421-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 PCAP 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 PCAP exam.