1Z0-811 Primitives, Strings and Operators Practice Question
Which TWO of the following are valid declarations and initializations of primitive variables?
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
✓
double d = 10.5;
Options A and C are correct. A: double d = 10.5; is valid because a double literal can be assigned without suffix. C: int i = 10; is valid because 10 fits in an int. B: float f = 10.5; is invalid because 10.5 is a double literal; must use f suffix. D: byte b = 200; is invalid because 200 is out of byte range (-128 to 127). E: long l = 123456789012; is invalid because the literal exceeds int range and lacks L 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.
- ✓
double d = 10.5;
Why this is correct
Valid double initialization.
- ✗
float f = 10.5;
Why it's wrong here
10.5 is double; need f suffix.
- ✓
int i = 10;
Why this is correct
Valid int initialization.
- ✗
byte b = 200;
Why it's wrong here
200 out of byte range (-128 to 127).
- ✗
long l = 123456789012;
Why it's wrong here
Literal exceeds int range; must have L suffix.
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.