1Z0-811 Primitives, Strings and Operators Practice Question
Which of the following is a valid declaration of a float variable?
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
✓
Both B and D are valid
Options B and D are valid because they use the f or F suffix to explicitly denote a float literal. Option C is invalid because 10.5 is a double literal and cannot be implicitly converted to float without a cast or suffix.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Both B and D are valid
Why this is correct
This option claims both B and C are valid, but C is invalid, so A is incorrect.
- ✗
float f = 10.5f;
Why it's wrong here
Correct. The literal 10.5f is explicitly marked as float.
- ✗
float f = 10.5;
Why it's wrong here
Incorrect. 10.5 is a double literal; assigning it to a float requires a cast or f/F suffix.
- ✗
float f = 10.5F;
Why it's wrong here
Correct. The literal 10.5F is explicitly marked as float.
Go deeper
Related to this question
About these practice questions
One of 481 original 1Z0-811 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 1Z0-811 practice question is part of Courseiva's free Oracle 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 1Z0-811 exam.