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 13 Question 26 Discussion

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

Given the code fragments:

class TechName {

String techName;

TechName (String techName) {

this.techName=techName;

}

}

and

List tech = Arrays.asList (

new TechName(''Java-''),

new TechName(''Oracle DB-''),

new TechName(''J2EE-'')

);

Stream stre = tech.stream();

//line n1

Which should be inserted at line n1 to print Java-Oracle DB-J2EE-?

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

Beula
1 months ago
Wait, why are we printing out 'Java-Oracle DB-J2EE-' instead of 'Java', 'Oracle DB', and 'J2EE'? Sounds like the exam writer has a weird sense of humor.
upvoted 0 times
Mozell
4 days ago
C) stre.map(a-> a).forEachOrdered(System.out::print)
upvoted 0 times
...
Fernanda
5 days ago
B) stre.map(a-> a.techName).forEach(System.out::print)
upvoted 0 times
...
Julianna
21 days ago
A) stre.forEach(System.out::print)
upvoted 0 times
...
...
Alline
2 months ago
Option D seems a bit too straightforward, doesn't it? I bet the answer is something a little more complex, like Option B.
upvoted 0 times
Dorothea
17 days ago
I agree with you. Sometimes the simplest solution is the most effective. Option D is the way to go in this case.
upvoted 0 times
...
Kate
22 days ago
I think you might be right. Option B does seem like a more complex solution, but sometimes the straightforward answer is the best one.
upvoted 0 times
...
Emilio
1 months ago
Option D is actually the correct answer. It will print Java-Oracle DB-J2EE- in the correct order.
upvoted 0 times
...
...
Sharen
2 months ago
Haha, I bet the exam writer is just trying to confuse us with all these stream operations. As long as I can remember to use map() to get the techName field, I should be good to go!
upvoted 0 times
Pearlene
2 days ago
Yeah, I agree. Using map() is the key to getting the desired output.
upvoted 0 times
...
Christiane
3 days ago
I think option B is correct because we need to use map() to get the techName field.
upvoted 0 times
...
Larae
7 days ago
B) stre.map(a-> a.techName).forEach(System.out::print)
upvoted 0 times
...
Casie
8 days ago
D) stre.forEachOrdered(System.out::print)
upvoted 0 times
...
Alisha
17 days ago
C) stre.map(a-> a).forEachOrdered(System.out::print)
upvoted 0 times
...
Rutha
1 months ago
B) stre.map(a-> a.techName).forEach(System.out::print)
upvoted 0 times
...
Cristina
1 months ago
A) stre.forEach(System.out::print)
upvoted 0 times
...
...
Peter
2 months ago
I'm not sure why we need to use forEachOrdered() in options C and D. Isn't that just for maintaining the original order of the stream?
upvoted 0 times
...
Leonor
2 months ago
Option B looks like the correct answer to me. The stream needs to be mapped to the techName field before printing it out.
upvoted 0 times
Judy
1 months ago
Yes, I agree. Mapping the stream to the techName field before printing makes sense.
upvoted 0 times
...
Judy
2 months ago
I think option B is the correct answer.
upvoted 0 times
...
...
Verdell
2 months ago
I'm not sure, but I think D could also work since it ensures the elements are printed in order.
upvoted 0 times
...
Paul
3 months ago
I agree with Stephaine, because we need to map the techName before printing.
upvoted 0 times
...
Stephaine
3 months ago
I think the answer is B.
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