exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 221 discussion

Actual exam question from Oracle's 1z0-808
Question #: 221
Topic #: 1
[All 1z0-808 Questions]

Which two code fragments cause compilation errors? (Choose two.)

  • A. double y1 = 203.22; float fit = y1;
  • B. float fit = (float) 1_11.00;
  • C. Float fit = 100.00;
  • D. int y2 = 100; float fit = (float) y2;
  • E. float fit = 100.00F;
Show Suggested Answer Hide Answer
Suggested Answer: AC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
BelloMio
6 days, 8 hours ago
Someone gave wrong explanations. The reason why A and C are wrong is because we cannot implicitly cast double values to float. They need to be explicitly casted, but it is possible.
upvoted 1 times
...
ManuTov
8 months ago
Another repeated question. its the same as n 105.
upvoted 1 times
...
ShaileshRaj
8 months, 1 week ago
Selected Answer: AC
These answer will give compilation error as question is asking, other option will give no compilation error
upvoted 2 times
...
kuuu
1 year, 4 months ago
Selected Answer: AC
The answer is AC
upvoted 2 times
...
akbiyik
1 year, 6 months ago
The answer is AC
upvoted 2 times
...
carloswork
1 year, 7 months ago
Selected Answer: AC
Answer is AC. Options that do not compile are A and C. Here is similar variables to test: public static void main(String[] args) { double y1 = 203.22; float fit = y1; // A --- error float fit2 = (float) 1_11.00; // B Float fit3 = 100.00; // C --- error int y2 = 100; float fit4 = (float) y2; // D float fit5 = 100.00F; // E }
upvoted 2 times
...
iSnover
1 year, 8 months ago
Selected Answer: AC
The answer is AC, I knew but just in case I tested it and here is the explanation of each one: A -> Wrong, because a float cannot receive a double B -> Correct, how are you doing a cast to float compiles C -> Wrong, a float cannot receive a value of 100.00, it is out of its range D -> Compile, cast to float And -> Compiles too, when you put F at the end inform that it is a floating point number, then compile.
upvoted 1 times
...
shivkumarx
1 year, 9 months ago
Think you wrote the question wrong, A,C,E compile fine and BD do not compile
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago