PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A student is analyzing Python code and wants to understand the result of the expression `2 ** 3 ** 2` in Python 3. What value does this expression produce?
⚠ Common exam trap
The trap here is assuming that exponentiation is left-associative, which would lead to computing (2 ** 3) ** 2 = 64 instead of the correct right-associative result.
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
✓
512
The exponentiation operator (**) in Python is right-associative, meaning that in a chain like 2 ** 3 ** 2, the rightmost operation is performed first. This gives 2 ** (3 ** 2) = 2 ** 9 = 512. Understanding associativity prevents errors when chaining exponentiation without parentheses.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
36
Why it's wrong here
36 is the result of 6 ** 2 or 2 ** 5.18..., neither of which matches the expression. The correct evaluation is 2 ** (3 ** 2) = 2 ** 9 = 512. 36 is not produced by any standard interpretation of the operators involved.
- ✓
512
Why this is correct
The exponentiation operator (**) in Python is right-associative, so 2 ** 3 ** 2 is evaluated as 2 ** (3 ** 2). First, 3 ** 2 equals 9; then 2 ** 9 equals 512. Thus, the expression yields 512, demonstrating the right-associative grouping of the ** operator.
- ✗
128
Why it's wrong here
128 would be the result of 2 ** 7, which is not what the expression evaluates to. The expression involves two exponentiation operations: 2 ** (3 ** 2) = 2 ** 9 = 512. 128 does not correspond to any valid grouping of the given numbers.
- ✗
64
Why it's wrong here
This would be the result if exponentiation were left-associative, computing (2 ** 3) ** 2 = 8 ** 2 = 64. However, Python's exponentiation operator (**) is right-associative, so grouping is 2 ** (3 ** 2), not (2 ** 3) ** 2. Therefore 64 is incorrect for this expression in Python.
Go deeper
Related to this question
About these practice questions
This PCEP question is part of Courseiva's 482-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 →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Python Institute exam blueprint
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.