Java 8 Online Quiz


Advertisements


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

Q 2 - 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 3 - 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 4 - 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 5 - 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.

Answer : B

Explanation

Using name of the interface.

Q 8 - Which of the following method of Base64 class returns a Base64.Decoder that decodes using the MIME type base64 decoding scheme?

A - getDecoder()

B - getEncoder()

C - getMimeDecoder()

D - getMimeEncoder

Answer : C

Explanation

getMimeDecoder() method of Base64 class returns a Base64.Decoder that decodes using the MIME type base64 decoding scheme.

Q 9 - Functional interfaces have a single functionality to exhibit.

A - false

B - true

Answer : B

Explanation

Functional interfaces have a single functionality to exhibit.

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