There must be a typo in the answers since only 1 results in 100. Which is B
A: System.out.println(IntStream.range(0, 99).count()); --> 99
B: System.out.println(IntStream.rangeClosed(1, 100).count()); --> 100
C: System.out.println(IntStream.range(1, 100).count()); --> 99
D: System.out.println(IntStream.rangeClosed(0, 100).map(x -> x).count()); --> 101
The code fragment generates an IntStream using the generate() method with a Supplier that always returns the value of z1, which is 1. The stream is then limited to 100 elements using the limit() method and the sum of all elements is calculated using the sum() method. The result is the sum of 100 ones, which is 100.
Both statements generate an IntStream with 100 elements and then count the number of elements in the stream using the count() method. The result of both statements is 100, which is the same as the value of result.
This section is not available anymore. Please use the main Exam Page.1z0-819 Exam Questions
Log in to ExamTopics
Sign in:
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.
[Removed]
Highly Voted 7 months, 3 weeks agod7bb0b2
Most Recent 4 months, 1 week agoStavok
9 months agoObalt
1 year, 2 months ago