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

Answer : C

Explanation

Both of the above options are correct.

Q 7 - Can you execute javascript code from java 8 code base?

A - true

B - false

Answer : A

Explanation

Yes! Using ScriptEngineManager, JavaScript code can be called and interpreted in Java.

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

A - getUrlDecoder()

B - getUrlEncoder()

C - getMimeDecoder()

D - getMimeEncoder

Answer : B

Explanation

getUrlEncoder() method of Base64 class returns a Base64.Encoder that encodes using the URL and Filename safe type base64 encoding scheme.

Q 9 - Optional object is used to represent non null value with absent value.

A - true

B - false

Answer : B

Explanation

Optional object is used to represent null with absent value.

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 : B

Explanation

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


java8_questions_answers.htm

Advertisements