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 II

Q 1 - Which of the following functional interface represents a function that accepts an int-valued argument and produces a result?

A - IntConsumer

B - IntFunction<R>

C - IntPredicate

D - IntSupplier

Answer : B

Explanation

IntFunction<R> functional interface represents a function that accepts an int-valued argument and produces a result.

Q 2 - Which of the following functional interface represents a predicate (Boolean-valued function) of one int-valued argument?

A - IntConsumer

B - IntFunction<R>

C - IntPredicate

D - IntSupplier

Answer : C

Explanation

IntPredicate functional interface represents a predicate (Boolean-valued function) of one int-valued argument.

Q 3 - Which of the following functional interface represents a supplier of int-valued results?

A - IntConsumer

B - IntFunction<R>

C - IntPredicate

D - IntSupplier

Answer : D

Explanation

IntPredicate functional interface represents a supplier of int-valued results.

Q 4 - Which of the following functional interface represents a function that accepts an int-valued argument and produces a double-valued result?

A - IntToDoubleFunction

B - IntToLongFunction

C - IntUnaryOperator

D - LongBinaryOperator

Answer : A

Explanation

IntPredicate functional interface represents a function that accepts an int-valued argument and produces a double-valued result.

Q 5 - Which of the following functional interface represents a function that accepts an int-valued argument and produces a long-valued result?

A - IntToDoubleFunction

B - IntToLongFunction

C - IntUnaryOperator

D - LongBinaryOperator

Answer : B

Explanation

IntToLongFunction functional interface represents a function that accepts an int-valued argument and produces a long-valued result.

Q 6 - Which of the following functional interface represents an operation on a single int-valued operand that produces an int-valued result?

A - IntToDoubleFunction

B - IntToLongFunction

C - IntUnaryOperator

D - LongBinaryOperator

Answer : C

Explanation

IntUnaryOperator functional interface represents an operation on a single int-valued operand that produces an int-valued result.

Q 7 - Which of the following functional interface represents an operation upon two long-valued operands and produces a long-valued result?

A - IntToDoubleFunction

B - IntToLongFunction

C - IntUnaryOperator

D - LongBinaryOperator

Answer : D

Explanation

LongBinaryOperator functional interface represents an operation upon two long-valued operands and produces a long-valued result.

Q 8 - Which of the following functional interface represents an operation that accepts a single long-valued argument and returns no result?

A - LongConsumer

B - LongFunction<R>

C - LongPredicate

D - LongSupplier

Answer : A

Explanation

LongConsumer functional interface represents an operation that accepts a single long-valued argument and returns no result.

Q 9 - Which of the following functional interface represents a function that accepts a long-valued argument and produces a result?

A - LongConsumer

B - LongFunction<R>

C - LongPredicate

D - LongSupplier

Answer : B

Explanation

LongFunction<R> functional interface represents a function that accepts a long-valued argument and produces a result.

Q 10 - Which of the following functional interface represents a predicate (Boolean-valued function) of one long-valued argument?

A - LongConsumer

B - LongFunction<R>

C - LongPredicate

D - LongSupplier

Answer : C

Explanation

LongPredicate functional interface represents a predicate (Boolean-valued function) of one long-valued argument.

Q 11 - Which of the following functional interface represents a supplier of long-valued results?

A - LongConsumer

B - LongFunction<R>

C - LongPredicate

D - LongSupplier

Answer : D

Explanation

LongSupplier functional interface represents a supplier of long-valued results.

Q 12 - Which of the following functional interface represents a function that accepts a long-valued argument and produces a double-valued result?

A - LongToDoubleFunction

B - LongToIntFunction

C - LongUnaryOperator

D - ObjDoubleConsumer<T>

Answer : A

Explanation

LongToDoubleFunction functional interface represents a function that accepts a long-valued argument and produces a double-valued result.

Q 13 - Which of the following functional interface represents a function that accepts a long-valued argument and produces an int-valued result?

A - LongToDoubleFunction

B - LongToIntFunction

C - LongUnaryOperator

D - ObjDoubleConsumer<T>

Answer : B

Explanation

LongToIntFunction functional interface represents a function that accepts a long-valued argument and produces an int-valued result.

Q 14 - Which of the following functional interface represents an operation on a single long-valued operand that produces a long-valued result?

A - LongToDoubleFunction

B - LongToIntFunction

C - LongUnaryOperator

D - ObjDoubleConsumer<T>

Answer : C

Explanation

LongUnaryOperator functional interface represents an operation on a single long-valued operand that produces a long-valued result.

Q 15 - Which of the following functional interface represents an operation that accepts an object-valued and a double-valued argument, and returns no result?

A - LongToDoubleFunction

B - LongToIntFunction

C - LongUnaryOperator

D - ObjDoubleConsumer<T>

Answer : D

Explanation

ObjDoubleConsumer<T> functional interface represents an operation that accepts an object-valued and a double-valued argument, and returns no result.

Q 16 - Which of the following functional interface represents an operation that accepts an object-valued and an int-valued argument, and returns no result?

A - ObjIntConsumer<T>

B - ObjLongConsumer<T>

C - Predicate<T>

D - Supplier<T>

Answer : A

Explanation

ObjIntConsumer<T> functional interface represents an operation that accepts an object-valued and an int-valued argument, and returns no result.

Q 17 - Which of the following functional interface represents an operation that accepts an object-valued and a long-valued argument, and returns no result?

A - ObjIntConsumer<T>

B - ObjLongConsumer<T>

C - Predicate<T>

D - Supplier<T>

Answer : B

Explanation

ObjLongConsumer<T> functional interface represents an operation that accepts an object-valued and a long-valued argument, and returns no result.

Q 18 - Which of the following functional interface represents a predicate (Boolean-valued function) of one argument?

A - ObjIntConsumer<T>

B - ObjLongConsumer<T>

C - Predicate<T>

D - Supplier<T>

Answer : C

Explanation

Predicate<T> functional interface represents a predicate (Boolean-valued function) of one argument.

Q 19 - Which of the following functional interface represents a supplier of results?

A - ObjIntConsumer<T>

B - ObjLongConsumer<T>

C - Predicate<T>

D - Supplier<T>

Answer : D

Explanation

Supplier<T> functional interface represents a supplier of results.

Q 20 - Which of the following functional interface represents a function that accepts two arguments and produces a double-valued result?

A - ToDoubleBiFunction<T,U>

B - ToDoubleFunction<T>

C - ToIntBiFunction<T,U>

D - ToIntFunction<T>

Answer : A

Explanation

ToDoubleBiFunction<T,U> functional interface represents a function that accepts two arguments and produces a double-valued result.

Q 21 - Which of the following functional interface represents a function that produces a double-valued result?

A - ToDoubleBiFunction<T,U>

B - ToDoubleFunction<T>

C - ToIntBiFunction<T,U>

D - ToIntFunction<T>

Answer : B

Explanation

ToDoubleFunction<T> functional interface represents a function that produces a double-valued result.

Q 22 - Which of the following functional interface represents a function that accepts two arguments and produces an int-valued result?

A - ToDoubleBiFunction<T,U>

B - ToDoubleFunction<T>

C - ToIntBiFunction<T,U>

D - ToIntFunction<T>

Answer : C

Explanation

ToIntBiFunction<T,U> functional interface represents a function that accepts two arguments and produces an int-valued result.

Q 23 - Which of the following functional interface represents a function that produces an int-valued result?

A - ToDoubleBiFunction<T,U>

B - ToDoubleFunction<T>

C - ToIntBiFunction<T,U>

D - ToIntFunction<T>

Answer : D

Explanation

ToIntFunction<T> functional interface represents a function that produces an int-valued result.

Q 24 - Which of the following functional interface represents a function that accepts two arguments and produces a long-valued result?

A - ToLongBiFunction<T,U>

B - ToLongFunction<T>

C - UnaryOperator<T>

D - ToIntFunction<T>

Answer : A

Explanation

ToLongBiFunction<T,U> functional interface represents a function that accepts two arguments and produces a long-valued result.

Q 25 - Which of the following functional interface represents a function that produces a long-valued result?

A - ToLongBiFunction<T,U>

B - ToLongFunction<T>

C - UnaryOperator<T>

D - ToIntFunction<T>

Answer : B

Explanation

ToLongFunction<T> functional interface represents a function that produces a long-valued result.

Answer Sheet

Question Number Answer Key
1 B
2 C
3 D
4 A
5 B
6 C
7 D
8 A
9 B
10 C
11 D
12 A
13 B
14 C
15 D
16 A
17 B
18 C
19 D
20 A
21 B
22 C
23 D
24 A
25 B
java8_questions_answers.htm
Advertisements