exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 125 discussion

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

Given the code fragment:

Which modification enables the code to print Price 5 New Price 4?

  • A. Replace line n2 with .map (n -> System.out.println ("New Price" + n ""1)) and remove line n3
  • B. Replace line n2 with .mapToInt (n -> n "" 1);
  • C. Replace line n1 with .forEach (e -> System.out.print ("Price" + e))
  • D. Replace line n3 with .forEach (n -> System.out.println ("New Price" + n));
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
jduarte
Highly Voted 4 years ago
Answer D test
upvoted 6 times
...
DarGrin
Most Recent 8 months ago
Selected Answer: D
D is correct sinse peek() is not a terminal operation
upvoted 1 times
...
steefaand
11 months, 3 weeks ago
Selected Answer: D
D is correct.
upvoted 1 times
...
aaraneta
1 year, 6 months ago
Selected Answer: D
Answer is D: tested List<Integer> prices = Arrays.asList(3,4,5); prices.stream() .filter(e -> e > 4) .peek(e -> System.out.print("Price " + e)) .map(n -> n - 1) .forEach (n -> System.out.println(" New Price " + n));
upvoted 1 times
...
YasinGaber
2 years, 11 months ago
Answer D
upvoted 2 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 ...