Grouping & Partitioning Streams QuizJ8 Home « Grouping & Partitioning Streams Quiz

Streams Quiz 11

The quiz below tests your knowledge of the material learnt in Streams - Lesson 11 - Grouping & Partitioning Streams.

Question 1 : When using multilevel grouping on streams we will always end up with?
- When using multilevel grouping on streams we will always end up with a map within a map.
Question 2 : There are two variants of the groupingBy() static method in the Collectors class?
- There are THREE variants of the <code>groupingBy()</code> static method in the <code>Collectors</code> class.
Question 3 : What kind of function do we pass as the first parameter to the groupingBy() static method?
- We always pass a classification function as the first parameter to the <code>groupingBy()</code> static method.
Question 4 : We can acheive multi-level grouping using the groupingBy() static method?
- We CAN acheive multi-level grouping using the <code>groupingBy()</code> static method.
Question 5 : We can use the groupingBy() or partitioningBy() static methods but not both in tandem?
- We CAN use the <code>groupingBy()</code> static method as the second argument to the <code>partitioningBy()</code> static method, so we CAN use them in tandem.
Question 6 : Which Stream interface method is the groupingBy() static method of the Collectors class used in conjunction with?
- The <code>groupingBy()</code> static method of the <code>Collectors</code> class is used in conjunction with the <code>collect()</code>, method of the <code>Stream</code> interface.
Question 7 : The collectingAndThen() static method of the Collectors class adapts a Collector to perform an additional finishing transformation?
- The <code>collectingAndThen()</code> static method of the <code>Collectors</code> class DOES adapt a <code>Collector</code> to perform an additional finishing transformation.
Question 8 : What is returned from the classification function of the partitioningBy() static method of the Collectors class?
- A <code>boolean</code> is returned from the classification function of the <code>partitioningBy()</code> static method of the <code>Collectors</code> class and this is used as a key in the resultant map.
Question 9 : We can only achieve multi-level grouping using the three parameter variant of the groupingBy() static method of the Collectors class?
- We can achieve multi-level grouping using the two or three parameter variant of the <code>groupingBy()</code> static method of the <code>Collectors</code> class.
Quiz Progress Bar Please select an answer


What's Next?

In the next quiz we test your knowledge of parallel streams.