Java Tutorial

Java Control Statements

Object Oriented Programming

Java Built-in Classes

Java File Handling

Java Error & Exceptions

Java Multithreading

Java Synchronization

Java Networking

Java Collections

Java List Interface

Java Queue Interface

Java Map Interface

Java Set Interface

Java Data Structures

Java Collections Algorithms

Advanced Java

Java Miscellaneous

Java APIs & Frameworks

Java Useful Resources

Java 8 Online Quiz



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 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 upon two int-valued operands and produces an int-valued result?

A - DoubleToLongFunction

B - DoubleUnaryOperator

C - Function<T,R>

D - IntBinaryOperator

Answer : D

Explanation

FunctionIntBinaryOperator functional interface represents an operation upon two int-valued operands and produces an int-valued result.

Q 4 - Which of the following functional interface represents a function that accepts a long-valued argument and produces a result?

A - LongConsumer

B - LongFunction<R>

C - LongPredicate

D - LongSupplier

Answer : B

Explanation

LongFunction<R> functional interface represents a function that accepts a long-valued argument and produces a result.

Q 5 - Which of the following functional interface represents a function that accepts two arguments and produces a double-valued result?

A - ToDoubleBiFunction<T,U>

B - ToDoubleFunction<T>

C - ToIntBiFunction<T,U>

D - ToIntFunction<T>

Answer : A

Explanation

ToDoubleBiFunction<T,U> functional interface represents a function that accepts two arguments and produces a double-valued result.

Q 8 - Which of the following is the correct lambda expression which add two numbers and return their sum?

A - (int a, int b) -> { return a + b;};

B - (a, b) -> {return a + b;};

C - Both of the above.

D - None of the above.

Answer : C

Explanation

Both of the above options are correct.

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 - The new date-time API in java 8 is immutable and does not have setter methods.

A - true

B - false

Answer : A

Explanation

The new date-time API in java 8 is immutable and does not have setter methods.

java8_questions_answers.htm
Advertisements