About Question enthuware.ocpjp.v11.2.3324 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
olakesh
Posts: 1
Joined: Mon Mar 29, 2021 6:48 am
Contact:

About Question enthuware.ocpjp.v11.2.3324 :

Post by olakesh »

Hi,
Please can you kindly help clarify this question. (Please see attached).
Explanation ended up saying a count of 3 is printed and that was what I chose but the right answer is chosen as 3573
Attachments
Test1 Question 29.png
Test1 Question 29.png (162.72 KiB) Viewed 2548 times

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v11.2.3324 :

Post by admin »

Actually, the explanation does contain a note about the peek method, which is what is generating the first 357 in the output.

Explanation has now been enhanced to make it more clear.
Observe the invocation of the peek method in the stream pipeline. The peek method does not remove any element from the stream. It simply performs the given operation (System.out.print, in this case) for each of the elements (which prints 3, 5, and 7). The resulting stream contains the same elements as the original stream on which peek is invoked.

Finally, count returns 3, which is printed by the last println statement. Thus, the output is 3537.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

uisang
Posts: 2
Joined: Wed Apr 21, 2021 2:49 pm
Contact:

Re: About Question enthuware.ocpjp.v11.2.3324 :

Post by uisang »

At the end of the explanation, "Thus, the output is 3537" should be "Thus, the output is 3573" :cheers:

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v11.2.3324 :

Post by admin »

Right! Fixed.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 55 guests