Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 150

Given the code fragment:

Which code fragment, when inserted at line 7, enables printing 100?

    Correct Answer: C

    To print 100, a function needs to be defined that takes the integer value 90 and adds 10 to it. The code must correctly use lambda expressions and the appropriate functional interface to perform this operation. The correct method signature and function type is `ToIntFunction<Integer>`, which is designed to apply lambda expressions involving conversion to primitive int. The resulting integer must then be passed to the `accept` method of the `IntConsumer`. Therefore, the appropriate code fragment is `ToIntFunction<Integer> funRef = e -> e + 10; int result = funRef.applyAsInt(value);`.

Discussion
jduarteOption: C

Answer C.Tested

jduarteOption: C

The correct answer is C

Svetleto13Option: C

C,tested

steefaandOption: C

C is answer.

duydnOption: C

C is correct, tested

WilsonKKerllOption: C

Answer is C. A should write Function<Integer, Integer> funRef2 = e -> e + 10;