Stream Pipelines QuizS2C Home « Stream Pipelines Quiz

The questions in this quiz on Java are on the topics covered in the Streams section of the site. The table below lists the lesson used for each quiz, a description of the lesson content and the quiz number and questions associated with that lesson.

Lesson Summary

Click on a lesson in the table to go to that lesson for a refresher on the topics for that quiz.

Click on a quiz in the table to go straight to the quiz for a particular lesson.

Generics Lessons Description Quiz Info.
Lesson 1 - Introducing StreamsIn our first lesson on on Streams we test your knowledge of the topics covered in the Introducing Streams lesson.Quiz1
9 questions
Lesson 2 - Stream PipelinesIn this lesson on streams we look at stream pipelines and how they work.This quiz.
9 questions
Lesson 3 - Stream Operations OverviewIn this lesson on streams we present an overview of the intermediate and terminal operations available.Quiz3
9 questions
Lesson 4 - Array Type StreamsIn this streams lesson we look at the various ways of creating streams from arrays.Quiz4
8 questions
Lesson 5 - Numeric StreamsIn this lesson on streams we look at numeric streams and the operations associated with them.Quiz5
7 questions
Lesson 6 - Other Stream CreationIn this lesson we take a final look at stream creation by creating streams from files, functions and iterations and also find out about creating infinite streams.Quiz6
9 questions
Lesson 7 - Finding & MatchingIn this streams lesson we look at the various ways of finding and matching values within our streams.Quiz7
9 questions
Lesson 8 - Reduction OperationsIn this streams lesson we look at reduction operations and how to use them.Quiz8
7 questions
Lesson 9 - Stream CollectorsIn this lesson we take a high level look at stream collectors by investigating the Collector interface and the Collectors class implementation of it.Quiz9
8 questions
Lesson 10 - Collecting & Aggregating StreamsIn this lesson we look at how to create collections and aggregations from our streams.Quiz9
8 questions
Lesson 11 - Grouping & Partitioning StreamsThis lesson on streams is all about grouping & partitioning our streams.Quiz11
9 questions
Lesson 12 - Parallel StreamsThis lesson is all about parallel streams.Quiz12
8 questions

Streams Quiz 2

The quiz below tests your knowledge of the material learnt in Streams - Lesson 2 - Stream Pipelines.

Question 1 : There must be one or more Intermediate operations in a stream pipeline?
- A stream pipeline can have ZERO or more intermediate operations.
Question 2 : How are the intermediate operations in a stream pipeline invoked?
- Intermediate operations in a stream pipeline are invoked by the terminal operation.
Question 3 : Is the following code snippet valid?
Employee.listOfStaff().stream()
.filter(e -> e.getAge() > 21)
.skip(2)
.limit(2)
.count()
.forEach(System.out::println);
- There were two terminal operations within the code snippet which the compiler doesn't like, so the code snippet is INVALID.
Question 4 : Terminal operations always produce a stream?
- Terminal operations always produce a <code>void</code> or non-stream result.
Question 5 : Which Stream interface methods primary purpose is debugging?
- The <code>peek()</code> methods primary purpose is debugging.
Question 6 : Is the following code snippet valid?
Employee.listOfStaff().stream()
.filter(e -> e.getAge() > 21)
.skip(2)
.limit(2);
- There are no terminal operations within the code snippet but the code will still compile and run it will just never get invoked.
Question 7 : What type of operations are Intermediate stream operations?
- Intermediate stream operations are <i>lazy</i> and are invoked by the terminal operation.
Question 8 : We can alter the inner state of an element within a pipeline, such as capitalising text?
- We can alter the inner state of an element within a pipeline using the <code>peek()</code> methods.
Question 9 : Is the following code snippet valid?
Employee.listOfStaff().stream()
.forEach(System.out::println);
- There are no intermediate opertions but the code is still valid, the terminal operation processes and prints off the whole stream.
Quiz Progress Bar Please select an answer

What's Next?

In the next quiz we test your knowledge of the different intermediate and terminal operations.