exam questions

Exam 1z0-829 All Questions

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

Exam 1z0-829 topic 1 question 38 discussion

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

Given:

What is the result?

  • A. Compilation fails.
  • B. wTablewChair TableChair
  • C. TableChair TableChair
  • D. A RuntimeException is thrown.
  • E. wTableChair TableChair
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
Tojose
Highly Voted 1 year, 3 months ago
the right answer is B. wTablewChair TableChair
upvoted 6 times
...
c6437d5
Highly Voted 1 year, 1 month ago
Selected Answer: B
B tested correct
upvoted 5 times
...
jugue
Most Recent 3 weeks, 6 days ago
Selected Answer: B
package streampac; import java.util.List; public class Q38 { public String attach1 ( List<String> data) { return data.parallelStream().reduce("w", (n,m) -> n+m, String ::concat); } public String attach2 ( List<String> data) { return data.parallelStream().reduce( (l,p) -> l + p).get(); } public static void main(String[] args) { // TODO Auto-generated method stub Q38 t= new Q38(); var list = List.of("Table", "chair"); String x= t.attach1(list); String y= t.attach2(list); System.out.print(x +" " +y); } } //the output is B wTablewchair Tablechair
upvoted 1 times
...
mery17
1 month, 1 week ago
Selected Answer: A
The answer is A. You can't use a numeric in (1,p)
upvoted 1 times
...
SrinivasJasti
4 months ago
Selected Answer: B
attach1 -----> identity is w accumulator --> combines two elements into one n and m combiner ---->combines results: wTablewChair. attach2 ------>no identity provided only a combiner :TableChair
upvoted 1 times
...
Tangaizw
5 months, 3 weeks ago
The answer is A. You can't use a numeric literal for the accumulated result variable. The code won't compile.
upvoted 1 times
...
xplorerpj
10 months, 1 week ago
Selected Answer: A
Compilation error
upvoted 2 times
...
xplorerpj
10 months, 2 weeks ago
A This code has a compilation error because the reduce method expects elements of the same type as the accumulator function's arguments.
upvoted 2 times
...
supersquax
1 year, 3 months ago
B correct! verified in online compiler.
upvoted 4 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago