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 1 - Which of the following functional interface represents an operation that accepts two input arguments, and returns no result?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

Answer : A

Explanation

BiConsumer<T,U> functional interface represents an operation that accepts two input arguments, and returns no result.

Q 2 - Which of the following functional interface represents an operation upon two operands of the same type, producing a result of the same type as the operands?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

Answer : C

Explanation

BinaryOperator<T> functional interface represents an operation upon two operands of the same type, producing a result of the same type as the operands.

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

Answer : C

Explanation

The 'filter' method is used to eliminate elements based on a criteria.

Q 7 - Which of the following API represents a specialized date-time API to deal with various timezones in java8?

A - Local

B - Zoned

C - Both of the above.

D - None of the above.

Answer : B

Explanation

Zoned − Specialized date-time API to deal with various timezones.

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

A - getDecoder()

B - getEncoder()

C - getMimeDecoder()

D - getMimeEncoder

Answer : D

Explanation

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

Q 9 - Optional is a container object which is used to contain not-null objects.

A - true

B - false

Answer : A

Explanation

Optional is a container object which is used to contain not-null objects.

Q 10 - java.util.Date is not thread safe, thus developers have to deal with concurrency issue while using date.

A - true

B - false

Answer : A

Explanation

java.util.Date is not thread safe, thus developers have to deal with concurrency issue while using date.

java8_questions_answers.htm
Advertisements