PCEP Computer Programming and Python Fundamentals Practice Question
Which of the following is a floating-point literal?
⚠ Common exam trap
Candidates often confuse a string containing a number (like `'3.14'`) with an actual numeric literal, or mistake an integer literal for a float, especially when the number looks like a decimal but lacks the decimal point.
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
`3.14` is a numeric literal with a decimal point, which Python interprets as a floating-point number. Floating-point literals represent real numbers and can be written with a decimal point or using scientific notation (e.g., `3.14e0`).
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'
Why it's wrong here
String literal.
- ✗
42
Why it's wrong here
Integer literal.
- ✗
1+2j
Why it's wrong here
Complex number literal.
- ✓
3.14
Why this is correct
Contains a decimal point, so float.
Go deeper
Related to this question
About these practice questions
This PCEP question is part of Courseiva's 498-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 →
Same concept, more angles
1 more way this is tested on PCEP
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Which of the following is a valid floating-point literal in Python?
easy- ✓ A.1e3
- B.'3.14'
- ✓ C.3.14
- D.0xFF
Why A: Both 1e3 and 3.14 are valid floating-point literals in Python. 1e3 uses scientific notation with an exponent, which Python interprets as a float. 3.14 is a literal with a decimal point. Options B and D are string and integer literals, respectively.
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.