PCEP Computer Programming and Python Fundamentals Practice Question
A programmer is writing a Python script to calculate the area of a circle. They write the following code:
radius = 5 area = 3.14 * radius ** 2
print(area)
What is the output of this code?
⚠ Common exam trap
The trap here is misapplying operator precedence by multiplying before exponentiating, which would yield a different 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
✓
78.5
The exponentiation operator ** has higher precedence than multiplication, so radius ** 2 is computed first, yielding 25. Then 3.14 * 25 equals 78.5, which is printed. This demonstrates correct operator precedence in Python and the use of the exponentiation operator for squaring a number.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
25
Why it's wrong here
25 is the result of 5 ** 2, but the code multiplies that by 3.14. The multiplication is not skipped; it is part of the expression. Therefore, the output is not just the squared radius. This option ignores the multiplication by pi, leading to an incorrect area calculation.
- ✗
31.4
Why it's wrong here
This would be the result if the expression were evaluated as (3.14 * radius) ** 2, which is not the case due to operator precedence. 3.14 * 5 equals 15.7, and 15.7 ** 2 equals 246.49, not 31.4. Alternatively, 3.14 * 5 * 2 equals 31.4, but the code uses exponentiation, not multiplication by 2. Thus, this value is incorrect.
- ✗
An error occurs because radius is an integer and cannot be used with exponentiation.
Why it's wrong here
In Python, integers support exponentiation; there is no type error. The ** operator works with integers and floats alike. The code runs without error and produces a float result because 3.14 is a float. This option incorrectly assumes a restriction that does not exist in Python.
- ✓
78.5
Why this is correct
The expression 3.14 * radius ** 2 is evaluated as 3.14 * (5 ** 2) because the exponentiation operator ** has higher precedence than multiplication. 5 ** 2 equals 25, and 3.14 * 25 equals 78.5. The print statement outputs 78.5, which is the correct area calculation using the given approximation of pi.
Quick reference
AAA Protocol Comparison
| Protocol | Port(s) | Encryption | Transport | Primary Use |
|---|---|---|---|---|
| RADIUS | 1812 / 1813 | Password only | UDP | Network access control |
| TACACS+ | 49 | Full packet | TCP | Device administration |
| Diameter | 3868 | Full session | TCP / SCTP | Carrier / mobile networks |
| 802.1X | — | EAP-based | Layer 2 | Port-based access control |
TACACS+ encrypts the entire packet; RADIUS only encrypts the password field — a key exam distinction.
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.