nerdexam
Oracle

1Z0-809 · Question #246

Given the code fragment: 5. IntConsumer consumer = e -> System.out.println(e); 6. Integer value = 90; 7. / insert code fragment here / 8. consumer.accept(result); Which code fragment, when inserted…

The correct answer is A. Function<Integer, IntUnaryOperator> funRef = i -> e -> i + e; IntUnaryOperator funRefApply = funRef.apply(value); int result = funRefApply.apply(10). You've hit your session limit · resets 5:20pm (America/New_York)

Question

Given the code fragment:
  1. IntConsumer consumer = e -> System.out.println(e);
  2. Integer value = 90;
  3. /* insert code fragment here */
  4. consumer.accept(result);
Which code fragment, when inserted at line 7, enables printing 100?

Options

  • AFunction<Integer, IntUnaryOperator> funRef = i -> e -> i + e; IntUnaryOperator funRefApply = funRef.apply(value); int result = funRefApply.apply(10);
  • BIntFunction<Integer> funRef = i -> i + 10; int result = funRef.apply(value);
  • CToIntFunction<Integer> funRef = i -> i + 10; int result = funRef.applyAsInt(value);
  • DToIntFunction<Integer> funRef = i -> i + 10; int result = funRef.apply(value);

How the community answered

(63 responses)
  • A
    83% (52)
  • B
    10% (6)
  • C
    3% (2)
  • D
    5% (3)

Explanation

You've hit your session limit · resets 5:20pm (America/New_York)

Community Discussion

No community discussion yet for this question.

Full 1Z0-809 Practice