Courseiva

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

A developer writes: total = 2 ** 3 + 4. What is the value of total?

⚠ Common exam trap

Python Institute often tests operator precedence by combining exponentiation with addition, trapping candidates who mistakenly evaluate left-to-right or confuse ** with multiplication.

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

✓

12

In Python, the exponentiation operator (**) has higher precedence than addition (+). Therefore, 2 ** 3 is evaluated first, yielding 8. Then 8 + 4 equals 12. Option B is 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.

  • ✗

    16

    Why it's wrong here

    Exponentiation binds tighter than addition, so 2 ** 3 evaluates to 8, then 8 + 4 gives 12, not 16. It is tempting because 2 ** 4 equals 16, and that result would be correct if the expression were written as 2 ** (3 + 1) or 2 ** 4.

  • ✓

    12

    Why this is correct

    Exponentiation binds tighter than addition, so 2 ** 3 evaluates first to 8, then 8 + 4 yields 12. The stem's expression therefore assigns 12 to total, not 14 as left-to-right evaluation would wrongly suggest.

  • ✗

    14

    Why it's wrong here

    Exponentiation binds tighter than addition, so 2 ** 3 evaluates to 8, then 8 + 4 gives 12, not 14. The value 14 would arise only if the expression were grouped as 2 ** (3 + 4), which is not how Python parses this line.

  • ✗

    10

    Why it's wrong here

    Python evaluates ** before +, so 2 ** 3 is 8 and 8 + 4 equals 12. Reaching 10 requires reading the expression left to right as (2 ** 3) + 4 misapplied, or treating it as 2 * (3 + 4); operator precedence forbids both.

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.