Streams Quiz 12
The quiz below tests your knowledge of the material learnt in Streams - Lesson 12 - Parallel Streams.
Question 1 : Which framework do parallel streams use.
- Parallel Streams use the <code>fork/join</code> framework.
Question 2 : We can run a parallel stream wherever we can run a sequential stream?
- We CAN run a parallel stream wherever we can run a sequential stream although this might not always be the best course of action!
Question 3 : Where is the
parallel() method defined?
-The <code>parallel()</code> method is defined in the <code>BaseStream</code> interface.
Question 4 : Parallel streams are always faster than sequential streams?
- Parallel streams are NOT always faster than sequential streams and if used incorrectly can be a lot slower.
Question 5 : Which of these methods is not suitable for parallelizing?
- The <code>iterate()</code> method is NOT suitable for parallelizing as it is quintissentially sequential.
Question 6 : The
parallel() method of the
BaseStream interface is a terminal operation?
- The <code>parallel()</code> methof of the <code>BaseStream</code> class is an INTERMEDIATE operation.
Question 7 : Which of these primitive types works best with streams?
- The <code>int</code> primitive types works best with streams.
Question 8 : Parallel Streams are consumed after use?
- All Streams, parallel or squential, ARE consumed after use, meaning they can only be traversed once.
Quiz Progress Bar Please select an answer
Thats it for the streams quizzes, the next quizzes are on concurrency.