Java 8 Online Quiz


Following quiz provides Multiple Choice Questions (MCQs) related to Java 8. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Answer : C

Explanation

Both of the above options are correct.

Q 2 - 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 3 - 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 4 - 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 5 - 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 6 - Which of the following functional interface represents an operation on a single operand that produces a result of the same type as its operand?

A - ToLongBiFunction<T,U>

B - ToLongFunction<T>

C - UnaryOperator<T>

D - ToIntFunction<T>

Answer : C

Explanation

UnaryOperator<T> functional interface represents an operation on a single operand that produces a result of the same type as its operand.

Q 7 - Which of the following class implements an encoder for encoding byte data using the Base64 encoding scheme in Java8?

A - Base64.Decoder

B - Base64.Encoder

C - Base64Decoder

D - Base64Encoder

Answer : B

Explanation

static class Base64.Encoder - This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

Q 8 - Which of the following method of Base64 class returns a Base64.Encoder that encodes using the Basic type base64 encoding scheme?

A - getDecoder()

B - getEncoder()

C - getMimeDecoder()

D - getMimeEncoder

Answer : B

Explanation

getEncoder() method of Base64 class returns a Base64.Encoder that encodes using the Basic type base64 encoding scheme.

Q 9 - Method references help to point to methods by their names.

A - true

B - false

Answer : A

Explanation

Method references help to point to methods by their names.

Q 10 - Optional.get method gets the value, value should be present.

A - false

B - true

Answer : B

Explanation

Optional.get method gets the value, value should be present.

java8_questions_answers.htm
Advertisements