PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
What does 'print(2 ** 3)' output?
⚠ Common exam trap
Candidates often confuse the ** operator with multiplication (*) or addition (+), leading them to pick 6 or 23, or they reverse the base and exponent, picking 9 instead of 8.
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
✓
8
The ** operator in Python performs exponentiation, raising the left operand (2) to the power of the right operand (3), which equals 8. The print() function then outputs this integer result to the console.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
9
Why it's wrong here
Exponentiation raises the base to the power, so 2 ** 3 is 2 × 2 × 2 = 8, not 9. Nine is the square of three, making it tempting when the operands are transposed, but the base here is 2 and the exponent is 3.
- ✗
23
Why it's wrong here
Python evaluates 2 ** 3 arithmetically to 8; the digits are not concatenated into 23. Concatenation is genuinely what the + operator does with strings, which makes 23 tempting, but ** is exponentiation and returns a single numeric value rather than a joined string.
- ✓
8
Why this is correct
The `**` operator performs exponentiation, raising the left operand to the power of the right. Here 2 raised to the power 3 equals 8, so `print` outputs 8. It is distinct from `^`, which is bitwise XOR in Python.
- ✗
6
Why it's wrong here
The ** operator performs exponentiation, so 2 ** 3 evaluates to 2 × 2 × 2, which is 8, not 6. Six is the result of multiplication (2 * 3), making it tempting for anyone who misreads the double asterisk as ordinary multiplication rather than a power operation.
Go deeper
Related to this question
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 →
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.