Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Oracle 1Z0-809 Exam - Topic 14 Question 85 Discussion

Actual exam question for Oracle's 1Z0-809 exam
Question #: 85
Topic #: 14
[All 1Z0-809 Questions]

Given the code fragment:

UnaryOperator uo1 = s -> s*2;line n1

List loanValues = Arrays.asList(1000.0, 2000.0);

loanValues.stream()

.filter(lv -> lv >= 1500)

.map(lv -> uo1.apply(lv))

.forEach(s -> System.out.print(s + '' ''));

What is the result?

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

0/2000 characters
Glory
3 months ago
Nope, it works fine!
upvoted 0 times
...
Lynelle
3 months ago
Wait, isn't there a type mismatch with Integer and Double?
upvoted 0 times
...
Antione
3 months ago
Totally agree, it doubles the values!
upvoted 0 times
...
Lindsay
3 months ago
The result will be 4000.0.
upvoted 0 times
...
Stefanie
4 months ago
I thought it would throw a compilation error.
upvoted 0 times
...
Mirta
4 months ago
I'm leaning towards option C because I feel like there's a type mismatch with the Integer and Double in the UnaryOperator.
upvoted 0 times
...
Cora
4 months ago
I practiced a similar question where we had to apply a function to a stream, but I can't recall if the types need to match exactly.
upvoted 0 times
...
Rodolfo
4 months ago
I think the filter will only let through the loan values that are 1500 or more, so that might help narrow it down.
upvoted 0 times
...
Edmond
5 months ago
I remember that UnaryOperator takes a single argument and returns a result, but I'm not sure if it can handle different types like Integer and Double together.
upvoted 0 times
...
Buffy
5 months ago
Ugh, I'm not sure about this one. The types seem a bit tricky, and I'm not totally clear on how the stream operations are going to work. I'll need to think it through carefully.
upvoted 0 times
...
Noel
5 months ago
I'm pretty confident I know the answer to this one. The stream is filtering for values greater than or equal to 1500, then doubling those values, so the output should be 4000.0.
upvoted 0 times
...
Helaine
5 months ago
Wait, is there a problem with the types here? I'm not sure the map() operation is going to work as expected.
upvoted 0 times
...
Kristofer
5 months ago
Okay, I think I've got this. The UnaryOperator is taking an Integer and returning an Integer, so that should work with the stream. Let me work through the steps.
upvoted 0 times
...
Ashley
5 months ago
Hmm, this looks like a tricky one. I'll need to carefully read through the code and think about the types involved.
upvoted 0 times
...
Lucina
10 months ago
I'm going with A. The stream will filter out the values less than 1500, then double the remaining values.
upvoted 0 times
Miss
9 months ago
C) A compilation error occurs at line n1.
upvoted 0 times
...
Lavera
10 months ago
I think it will be B) 4000
upvoted 0 times
...
Glenna
10 months ago
A) 4000.0
upvoted 0 times
...
...
Keva
11 months ago
I'm not sure, but I think there might be a compilation error at line n1
upvoted 0 times
...
Coleen
11 months ago
I agree with Celestina, the code should multiply by 2 and print the result
upvoted 0 times
...
Larue
11 months ago
Ha! I bet someone will say the answer is 'A compilation error occurs' just to be tricky.
upvoted 0 times
Gregg
9 months ago
User3
upvoted 0 times
...
Izetta
9 months ago
User2
upvoted 0 times
...
Zona
9 months ago
User1
upvoted 0 times
...
...
Chun
11 months ago
The key is understanding the UnaryOperator type. It's going to apply the lambda function to each element in the stream, doubling the value.
upvoted 0 times
...
Celestina
11 months ago
I think the result will be 4000.0
upvoted 0 times
...
Wai
11 months ago
Hmm, the question seems straightforward. I think the answer is A) 4000.0.
upvoted 0 times
Andra
10 months ago
I think so too, it should be A) 4000.0.
upvoted 0 times
...
Andra
10 months ago
I agree, the answer is A) 4000.0.
upvoted 0 times
...
Cammy
10 months ago
Great, we all agree on A) 4000.0 as the answer.
upvoted 0 times
...
Argelia
10 months ago
Yes, the correct answer is A) 4000.0.
upvoted 0 times
...
Huey
10 months ago
I think so too, it should be A) 4000.0.
upvoted 0 times
...
Irma
11 months ago
I agree, the answer is A) 4000.0.
upvoted 0 times
...
...

Save Cancel