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 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 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 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 5 - 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.

Answer : D

Explanation

The 'limit' method is used to reduce the size of the stream.

Answer : C

Explanation

Both of the above options are correct.

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 - Stream supports aggregate operations like filter, map, limit, reduce, find and match.

A - false

B - true

Answer : B

Explanation

Stream supports aggregate operations like filter, map, limit, reduce, find, match, and so on.

Q 10 - In which of the following type of Base64 encoding, Output is mapped to a set of characters lying in A-Za-z0-9+/?

A - Simple

B - URL

C - MIME

D - None of the above.

Answer : A

Explanation

Simple − Output is mapped to a set of characters lying in A-Za-z0-9+/.


java8_questions_answers.htm

Advertisements