About Question enthuware.ocpjp.v11.2.3324 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

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 3928 times

admin
Site Admin
Posts: 10384
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!

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: 10384
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!

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests