Numeric Streams QuizS2C Home « Numeric Streams 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.Quiz2
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.This quiz.
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<T,A,R> 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 5

The quiz below tests your knowledge of the material learnt in Streams - Lesson 5 - Numeric Streams.

Question 1 : Which method returns a stream consisting of unique values?
- The <code>distinct()</code> method returns a stream consisting of unique values.
Question 2 : There are purpose built streams for all primitive types?
- There are only purpose built streams for <code>double</code>, <code>int</code> and <code>long</code>.
Question 3 : Which method can be used to convert a primitive stream to an object stream?
- The <code>boxed()</code> method can be used to convert a primitive stream to an object stream.
Question 4 : The reduce() method is an intermediate operator?
- The <code>reduce()</code> method is a terminal operator.
Question 5 : Which method produces a DoubleStream object?
- The <code>mapToDouble()</code> method produces a <code>DoubleStream</code> object.
Question 6 : Is the following code snippet valid where Employee.listOfStaff() returns List<Employee>?
double averageAge = Employee.listOfStaff().stream()
.map(Employee::getAge)
.sum();
interface
- There is no <code>sum()</code> method in the <code>Stream</code> interface, which is used for a list input, so the code is invalid.
Question 7 : Which simple construct can the rangeClosed() method replace?
- The <code>rangeClosed()</code> method can replace the simple <code>for</code> construct.
Quiz Progress Bar Please select an answer

What's Next?

In the next quiz we test your knowledge of different types of stream creation.