Multiple Choice
Which statement creates an infinite stream of lottery numbers in the range of 1 to 50?
A) Stream<Integer> lotteryNumbers = Stream.iterate(() -> 1 + (int) (50 * Math.random() ) ) ;
B) Stream<Integer> lotteryNumbers = Stream.generator(() -> 1 + (int) (50 * Math.random() ) ) ;
C) Stream<Integer> lotteryNumbers = Stream.range(() -> 1 + (int) (50 * Math.random() ) ) ;
D) Stream<Integer> lotteryNumbers = Stream.generate(() -> 1 + (int) (50 * Math.random() ) ) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q1: Which statement creates one comma-separated String from
Q2: Complete the following code snippet, assuming that
Q3: Which method yields a stream obtained by
Q4: You want to create a stream from
Q6: Which statement creates a list of names
Q7: Which of the following expressions returns an
Q8: You want to save a stream of
Q9: You want to save stream values in
Q10: The constructor reference Student[]::new is a shorthand
Q11: Complete the following statement that creates a