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

Answer : A

Explanation

System.out::println method is a static method reference to println method of out object of System class.

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 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 that accepts a single long-valued argument and returns no result?

A - LongConsumer

B - LongFunction<R>

C - LongPredicate

D - LongSupplier

Answer : A

Explanation

LongConsumer functional interface represents an operation that accepts a single long-valued argument and returns no result.

Q 5 - Which of the following functional interface represents an operation that accepts an object-valued and an int-valued argument, and returns no result?

A - ObjIntConsumer<T>

B - ObjLongConsumer<T>

C - Predicate<T>

D - Supplier<T>

Answer : A

Explanation

ObjIntConsumer<T> functional interface represents an operation that accepts an object-valued and an int-valued argument, and returns no result.

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 8 - Using lambda expression, you can refer to final variable or effectively final variable (which is assigned only once).

A - false

B - true

Answer : B

Explanation

Using lambda expression, you can refer to final variable or effectively final variable (which is assigned only once).

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