exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 105 discussion

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

Which two code fragments cause a compilation error? (Choose two.)

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

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
fvelazqueznava
3 months, 1 week ago
Selected Answer: CD
CD are the right ones that result in compilation error
upvoted 1 times
...
DarGrin
3 months, 1 week ago
Selected Answer: CD
CD are corect
upvoted 1 times
...
anastacia
3 months, 1 week ago
The answer is C and D. A. float flt = 100.00F; // correct B. float flt = (float) 1_11.00; // correct C. Float flt = 100.00; // assigning a double to Float object without explicit cast D. double y1 = 203.22; float flt = y1; // assigning a double to a float without explicit cast E. int y2 = 100; float flt = (float) y2 ; // correct
upvoted 3 times
...
IbrahimAlnutayfi
6 months, 3 weeks ago
Selected Answer: CD
The answer is CD
upvoted 1 times
...
Vicky_65
9 months, 2 weeks ago
Selected Answer: CD
C and D are not valid.
upvoted 1 times
...
Hirushi
11 months, 1 week ago
Answer is : CD tested
upvoted 1 times
...
akbiyik
1 year, 1 month ago
Selected Answer: CD
Answer is CD.
upvoted 2 times
...
akbiyik
1 year, 1 month ago
Example 2; import java.util.Arrays; import java.util.Scanner; public class ArrayDefaultValues { int intArray[] = new int[3]; float floatArray[] = new float[3]; byte byteArray[] = new byte[3]; boolean boolArray[] = new boolean[3]; String stringArray[] = new String[3]; public static void main(String args[]){ ArrayDefaultValues obj = new ArrayDefaultValues(); System.out.println(Arrays.toString(obj.intArray)); System.out.println(Arrays.toString(obj.floatArray)); System.out.println(Arrays.toString(obj.byteArray)); System.out.println(Arrays.toString(obj.boolArray)); System.out.println(Arrays.toString(obj.stringArray)); } } Output [0, 0, 0] [0.0, 0.0, 0.0] [0, 0, 0] [false, false, false] [null, null, null]
upvoted 1 times
...
carloswork
1 year, 2 months ago
Selected Answer: CD
Answer is CD. To test, uncomment one option at a time in the IDE and check the error. public static void main(String[] args) { //float flt = 100.00F; // A - Ok //float flt = (float) 1_11.00; // B - Ok //Float flt = 100.00; // C - Error - need cast to Float. //double y1 = 203.22; float flt = y1; // D - Error - need cast to float. //int y2 = 100; float flt = (float) y2 ; // F - Ok }
upvoted 1 times
...
iSnover
1 year, 3 months ago
Selected Answer: CD
Wrong Question, because Letters A, C and D not compiles...
upvoted 1 times
iSnover
1 year, 3 months ago
The reason of A and C is that the number 100.00 cannot be a float
upvoted 1 times
...
...
shivkumarx
1 year, 4 months ago
Correct answer is C and D
upvoted 4 times
...
shivkumarx
1 year, 4 months ago
Why does C not create compilation error
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