exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 54 discussion

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

Given the code fragment:
List<Integer> codes = Arrays.asList (10, 20);
UnaryOperator<Double> uo = s -> s +10.0;
codes.replaceAll(uo);
codes.forEach(c -> System.out.println(c));
What is the result?

  • A. 20.0 30.0
  • B. 10.0 20.0
  • C. A compilation error occurs.
  • D. A NumberFormatException is thrown at run time.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
M_Jawad
Highly Voted 5 years ago
The 12th line of the program will compile error, because the generic type of List is Integer, but UnaryOperator uses Double, which is different, so the compilation error.
upvoted 7 times
...
6c84cb9
Most Recent 5 months, 4 weeks ago
Answer is C.
upvoted 1 times
...
asdfjhfgjuaDCV
11 months ago
Tested: C is the correct answer
upvoted 1 times
...
steefaand
12 months ago
Selected Answer: C
C is answer as Integer cannot be cast to Double.
upvoted 1 times
...
WilsonKKerll
2 years, 10 months ago
Answer is C.
upvoted 1 times
...
thetech
5 years, 1 month ago
Answer is C. Tested.
upvoted 4 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