Java Tutorial

Java Control Statements

Object Oriented Programming

Java Built-in Classes

Java File Handling

Java Error & Exceptions

Java Multithreading

Java Synchronization

Java Networking

Java Collections

Java List Interface

Java Queue Interface

Java Map Interface

Java Set Interface

Java Data Structures

Java Collections Algorithms

Java Miscellaneous

Advanced Java

Java APIs & Frameworks

Java Useful Resources

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.

Questions and Answers

Java 8 Mock Test I

Answer : C

Explanation

Both of the above options are correct.

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?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

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?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

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?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

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?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

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?

A - BooleanSupplier

B - Consumer<T>

C - DoubleBinaryOperator

D - DoubleConsumer

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?

A - BooleanSupplier

B - Consumer<T>

C - DoubleBinaryOperator

D - DoubleConsumer

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?

A - BooleanSupplier

B - Consumer<T>

C - DoubleBinaryOperator

D - DoubleConsumer

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?

A - BooleanSupplier

B - Consumer<T>

C - DoubleBinaryOperator

D - DoubleConsumer

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?

A - DoubleFunction<R>

B - DoublePredicate

C - DoubleSupplier

D - DoubleToIntFunction

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?

A - DoubleFunction<R>

B - DoublePredicate

C - DoubleSupplier

D - DoubleToIntFunction

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?

A - DoubleFunction<R>

B - DoublePredicate

C - DoubleSupplier

D - DoubleToIntFunction

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?

A - DoubleFunction<R>

B - DoublePredicate

C - DoubleSupplier

D - DoubleToIntFunction

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?

A - DoubleToLongFunction

B - DoubleUnaryOperator

C - Function<T,R>

D - IntBinaryOperator

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?

A - DoubleToLongFunction

B - DoubleUnaryOperator

C - Function<T,R>

D - IntBinaryOperator

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?

A - DoubleToLongFunction

B - DoubleUnaryOperator

C - Function<T,R>

D - IntBinaryOperator

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?

A - DoubleToLongFunction

B - DoubleUnaryOperator

C - Function<T,R>

D - IntBinaryOperator

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?

A - IntConsumer

B - IntFunction<R>

C - IntPredicate

D - IntSupplier

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
java8_questions_answers.htm
Advertisements