Java Streams MCQs with answers
58 questions tagged Java Streams, each with the correct answer and an explanation. Page 3 of 3.
- What does `flatMap()` do in Java Streams?
- Which Stream method is used for debugging purposes by peeking at elements?
- What is the output type of `Stream.map()`?
- Which stream operation is lazy?
- Which method skips the first n elements of the stream?
- Which method returns an Optional describing the first element?
- Which method creates a stream from an array?
- Which method checks if any element matches the given predicate?
- What is the use of `reduce()` in streams?
- What is a terminal operation in a stream?
- Which method limits the number of elements in the stream?
- Which method is used to sort elements of a Stream?
- Which method returns the count of elements in the Stream?
- Which operation is terminal in Stream API?
- Which Stream method is used to perform an action for each element?
- Which method converts a Stream into a List?
- What does the filter() method do in a Stream?
- Which method is used to transform elements in a Stream?