Java Streams MCQs with answers
58 questions tagged Java Streams, each with the correct answer and an explanation. Page 2 of 3.
- Which of the following Stream operations is most suitable for counting elements matching a condition?
- Which method converts a List to a Stream?
- Which method converts a Stream into a Set?
- Which method is used to execute stream operations in parallel?
- How do you create an infinite stream?
- Which method converts a primitive stream to a boxed stream?
- Which Stream type is unordered by default?
- Which method checks if no elements in the stream match a predicate?
- Can streams be reused once consumed?
- What does `peek()` return?
- Which of these returns true if all elements match a given condition?
- What does `Collectors.joining()` do?
- Which of these is an intermediate operation?
- Which of the following operations does NOT change the number of elements in a Stream?
- Which method finds the minimum element of a Stream using a Comparator?
- Which of the following is a terminal operation?
- What is the result of calling `stream().distinct()`?
- Which method is used to convert a stream into an array?
- Which method is used to obtain a sequential stream from a collection?
- Which of the following statements is true about Streams?