- Java 8 Tutorial
- Java 8 - Home
- Java 8 - Overview
- Java 8 - Environment Setup
- Java 8 - Lambda Expressions
- Java 8 - Method References
- Java 8 - Functional Interfaces
- Java 8 - Default Methods
- Java 8 - Streams
- Java 8 - Optional Class
- Java 8 - Nashorn JavaScript
- Java 8 - New Date/Time API
- Java 8 - Base64
- Java 8 Useful Resources
- Java 8 - Questions and Answers
- Java 8 - Quick Guide
- Java 8 - Useful Resources
- Java 8 - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java 8 Mock Test
This section presents you various set of Mock Tests related to Java 8. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Java 8 Mock Test I
Q 1 - Which of the following is correct about Java8?
A - Lambda expression - Adds functional processing capability to Java.
C - Default method - Interface to have default method implementation.
Answer : D
Explanation
All of the above options are correct.
Q 2 - Which of the following is correct about Java8?
A - New compiler tools and utilities are added like 'jdeps' to figure out dependencies.
B - New stream API to facilitate pipeline processing is added.
Answer : D
Explanation
All of the above options are correct.
Q 3 - Which of the following is correct about Java 8 lambda expression?
Answer : C
Explanation
Both of the above options are correct.
Q 4 - Which of the following is correct about Java 8 lambda expression?
Answer : C
Explanation
Both of the above options are correct.
Q 5 - Which of the following is correct about Java 8 lambda expression?
A - Lambda expressions are used primarily to define inline implementation of a functional interface.
Answer : C
Explanation
Both of the above options are correct.
Q 6 - Which of the following is correct about Java 8 lambda expression?
B - Lambda expression throws a compilation error, if a variable is assigned a value the second time.
Answer : C
Explanation
Both of the above options are correct.
Q 7 - Which of the following is correct about Java 8 method references?
A - Method references help to point to methods by their names.
B - A method reference is described using :: (double colon) symbol.
Answer : C
Explanation
Both of the above options are correct.
Q 8 - Which of the following is correct about System.out::println expression?
Answer : A
Explanation
System.out::println method is a static method reference to println method of out object of System class.
Q 9 - Which of the following functional interface represents an operation that accepts two input arguments, and returns no result?
Answer : A
Explanation
BiConsumer<T,U> functional interface represents an operation that accepts two input arguments, and returns no result.
Q 10 - Which of the following functional interface represents an operation that accepts two input arguments, and returns a result?
Answer : B
Explanation
BiFunction<T,U> functional interface represents an operation that accepts two input arguments, and returns a result.
Q 11 - Which of the following functional interface represents an operation upon two operands of the same type, producing a result of the same type as the operands?
Answer : C
Explanation
BinaryOperator<T> functional interface represents an operation upon two operands of the same type, producing a result of the same type as the operands.
Q 12 - Which of the following functional interface represents a predicate (Boolean-valued function) of two arguments?
Answer : D
Explanation
BiPredicate<T,U> functional interface represents a predicate (Boolean-valued function) of two arguments.
Q 13 - Which of the following functional interface represents a supplier of Boolean-valued results?
Answer : A
Explanation
BooleanSupplier functional interface represents a supplier of Boolean-valued results.
Q 14 - Which of the following functional interface represents an operation that accepts a single input argument and returns no result?
Answer : B
Explanation
Consumer<T> functional interface represents an operation that accepts a single input argument and returns no result.
Q 15 - Which of the following functional interface represents an operation upon two double-valued operands and producing a double-valued result?
Answer : C
Explanation
DoubleBinaryOperator functional interface represents an operation upon two double-valued operands and producing a double-valued result.
Q 16 - Which of the following functional interface represents an operation that accepts a single double-valued argument and returns no result?
Answer : D
Explanation
DoubleConsumer functional interface represents an operation that accepts a single double-valued argument and returns no result.
Q 17 - Which of the following functional interface represents a function that accepts a double-valued argument and produces a result?
Answer : A
Explanation
DoubleFunction<R> functional interface represents a function that accepts a double-valued argument and produces a result.
Q 18 - Which of the following functional interface represents a predicate of one double-valued argument?
Answer : B
Explanation
DoublePredicate functional interface represents a predicate (Boolean-valued function) of one double-valued argument.
Q 19 - Which of the following functional interface represents a supplier of double-valued results?
Answer : C
Explanation
DoubleSupplier functional interface represents a supplier of double-valued results.
Q 20 - Which of the following functional interface represents a function that accepts a double-valued argument and produces an int-valued result?
Answer : D
Explanation
DoubleToIntFunction functional interface represents a function that accepts a double-valued argument and produces an int-valued result.
Q 21 - Which of the following functional interface represents a function that accepts a double-valued argument and produces a long-valued result?
Answer : A
Explanation
DoubleToLongFunction functional interface represents a function that accepts a double-valued argument and produces a long-valued result.
Q 22 - Which of the following functional interface represents an operation on a single double-valued operand that produces a double-valued result?
Answer : B
Explanation
DoubleUnaryOperator functional interface represents an operation on a single double-valued operand that produces a double-valued result.
Q 23 - Which of the following functional interface represents a function that accepts one argument and produces a result?
Answer : C
Explanation
Function<T,R> functional interface represents a function that accepts one argument and produces a result.
Q 24 - Which of the following functional interface represents an operation upon two int-valued operands and produces an int-valued result?
Answer : D
Explanation
FunctionIntBinaryOperator functional interface represents an operation upon two int-valued operands and produces an int-valued result.
Q 25 - Which of the following functional interface represents an operation that accepts a single int-valued argument and returns no result?
Answer : A
Explanation
IntConsumer functional interface represents an operation that accepts a single int-valued argument and returns no result.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | D |
2 | D |
3 | C |
4 | C |
5 | C |
6 | C |
7 | C |
8 | A |
9 | A |
10 | B |
11 | C |
12 | D |
13 | A |
14 | B |
15 | C |
16 | D |
17 | A |
18 | B |
19 | C |
20 | D |
21 | A |
22 | B |
23 | C |
24 | D |
25 | A |