Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Oracle Exam 1Z0-809 Topic 9 Question 40 Discussion

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

Given the code fragment:

List list1 = Arrays.asList(10, 20);

List list2 = Arrays.asList(15, 30);

//line n1

Which code fragment, when inserted at line n1, prints 10 20 15 30?

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

Roy
1 months ago
I hope this exam doesn't require us to flatMap our brains to solve the problem!
upvoted 0 times
...
Lynette
2 months ago
Hmm, Option C looks a bit convoluted, I'll steer clear of that one.
upvoted 0 times
Lashon
5 days ago
D) Stream.of(list1, list2).flatMapToInt(list -> list.stream()).forEach(s -> System.out.print(s + '' ''));
upvoted 0 times
...
Lashon
12 days ago
B) Stream.of(list1, list2).flatMap(list -> list.intStream()).forEach(s -> System.out.print(s + '' ''));
upvoted 0 times
...
Lashon
1 months ago
A) Stream.of(list1, list2).flatMap(list -> list.stream()).forEach(s -> System.out.print(s + '' ''));
upvoted 0 times
...
...
Frankie
2 months ago
Option A seems like the most straightforward solution, but let me review the use of flatMap() just to be sure.
upvoted 0 times
Yes, flatMap() is used to flatten the elements of streams.
upvoted 0 times
...
Tammi
3 days ago
Option A seems like the most straightforward solution.
upvoted 0 times
...
Dorinda
12 days ago
So, Option A should work to print all elements from both lists.
upvoted 0 times
...
Nathalie
14 days ago
Yes, flatMap() is used to flatten the elements of streams.
upvoted 0 times
...
Helaine
2 months ago
Option A seems like the most straightforward solution.
upvoted 0 times
...
...
Sherly
2 months ago
I'm leaning towards Option D, but I want to double-check the flatMapToInt() method.
upvoted 0 times
Alona
1 months ago
Let's double-check the flatMapToInt() method just to be sure.
upvoted 0 times
...
Arminda
1 months ago
I think Option D is correct.
upvoted 0 times
...
...
Merissa
2 months ago
Option B looks promising, but I'm not sure about the use of intStream().
upvoted 0 times
Lino
18 days ago
A) Stream.of(list1, list2).flatMap(list -> list.stream()).forEach(s -> System.out.print(s + ' '));
upvoted 0 times
...
Aimee
20 days ago
B) Stream.of(list1, list2).flatMap(list -> list.intStream()).forEach(s -> System.out.print(s + ' '));
upvoted 0 times
...
Chery
1 months ago
A) Stream.of(list1, list2).flatMap(list -> list.stream()).forEach(s -> System.out.print(s + ' '));
upvoted 0 times
...
...
Lisandra
2 months ago
I'm not sure, but I think option D could also be correct because of flatMapToInt.
upvoted 0 times
...
Kaitlyn
2 months ago
I agree with Marla, because flatMap is used to flatten the elements of the stream.
upvoted 0 times
...
Marla
3 months ago
I think the correct answer is A.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77