PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
Exhibit
Refer to the exhibit. Output of command: python3 -c "print(type(3.14))" <class 'float'>
A developer runs the command and sees the output. Which statement about the data type is correct?
⚠ Common exam trap
The PCEP exam often tests the misconception that Python has separate 'float' and 'double' types, similar to languages like C or Java, when in fact Python's float is always double-precision and there is no distinct double type.
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
✓
3.14 is a float in Python.
In Python, numeric literals with a decimal point, such as 3.14, are always interpreted as the built-in float type. Python does not have a separate 'double' type; its float is implemented as a C double (64-bit IEEE 754), but the language itself refers to it as float. This is a fundamental rule of Python's data type system.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
3.14 is a decimal.Decimal type.
Why it's wrong here
A literal such as 3.14 is parsed by Python as a float, not a decimal.Decimal; Decimal objects only arise from explicit construction via the decimal module. It is tempting because Decimal exists precisely for exact decimal arithmetic, and would be correct in financial calculations where binary floating-point rounding must be avoided.
- ✗
3.14 is a float, but Python also treats it as a double.
Why it's wrong here
Python's float is already implemented as a C double, so there is no separate double type to treat 3.14 as; the statement invents a distinction that does not exist. It is tempting because other languages such as Java and C distinguish float from double, and that answer would be correct in those languages.
- ✓
3.14 is a float in Python.
Why this is correct
The literal 3.14 contains a decimal point, which makes Python create a float object rather than an int. Its type is therefore float, and this holds regardless of whether the value is displayed, stored in a variable, or passed to a function.
- ✗
3.14 is a string.
Why it's wrong here
Unquoted 3.14 is a numeric literal, so Python evaluates it as a float; a string would require quotation marks such as '3.14'. It is tempting because input read from a file or console arrives as text, and string would be correct when the value is received via input() without conversion.
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 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.