Java 8 MCQ Online Test – Part 1
This collection of Java Multiple Choice Questions and Answers (MCQs): Quizzes & Practice Tests with Answer focuses on “Java 8”.
1. Lambdas introduced in Java 8 allow us to process_____
A Data as code
B Code as data
C None of the above
D All the answers are true
2. The newly introduced “Streams API” is available in which java 8 package?
A java.io.streams
B java.io.stream
C java.util.streams
D java.util.stream
3. What class can be used instead of System.getCurrentTimeMillis()
to get date and time in Java 8?
A Clock
B Timer
C Time
D Date
4. Lambda expressions in java 8 are based on _____
A Procedural programming
B Functional programming
C Data programming
D All the answers are true
5. How many methods exist in a functional interface in Java 8?
A 3
B 2
C 1
D 0
6. In Java 8 interfaces, methods can be ______
A default
B abstract
C Both A and B are true.
D None of the above
7. Which of the following is not introduced with Java 8?
A API Stream
B Spliterator
C Lambda Expression
D Serialization
8. What is the return type of the lambda expression?
A String
B Object
C Function
D void
9. What is the new method introduced in java 8 to iterate through a collection?
A List.for()
B StringList.forEach()
C foreach(String i : StringList)
D for(String i : StringList)
10. What are the two types of Streams proposed by Java 8?
A Random and synchronized
B Parallel and random
C Sequential and random
D Sequential and parallel