exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 192 discussion

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

Given the code fragment:
BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2; //line n1
//line n2
System.out.println(val.apply(10, 10.5));
What is the result?

  • A. 20
  • B. 20.5
  • C. A compilation error occurs at line n1.
  • D. A compilation error occurs at line n2.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️
Community vote distribution
C (100%)

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
jduarte
Highly Voted 3 years, 7 months ago
answer C. If line n1 looks like below, A is the correct answer. BiFunction val = (t1, t2) -> t1 + t2; //line n1
upvoted 9 times
AVB22
2 years, 9 months ago
if it is like that you will have following error: The operator + is undefined for the argument type(s) java.lang.Object, java.lang.Object
upvoted 1 times
...
...
asdfjhfgjuaDCV
Most Recent 5 months, 3 weeks ago
C is the correct answer
upvoted 1 times
...
steefaand
6 months, 3 weeks ago
Selected Answer: C
C is correct. Double can't be cast to Integer.
upvoted 1 times
...
iSnover
6 months, 3 weeks ago
Selected Answer: C
Answer is C, Bad return type in lambda expression: double cannot be converted to Integer.
upvoted 1 times
...
WilsonKKerll
2 years, 5 months ago
Answer is c.
upvoted 2 times
...
griglad
2 years, 6 months ago
Autounboxing is needed for the values to be added. The main point here is when we add a double to an int , double is returned . So if we had BiFunction<Integer,Double,Double> it would compile file. The answer is C
upvoted 1 times
...
fffff
3 years, 6 months ago
Bad return type in lambda expression: double cannot be converted to Integer in line n1 so answer C
upvoted 3 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:
MD-102
Sao Paulo, 1 minute ago