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 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 supplier of int-valued results?

A - IntConsumer

B - IntFunction<R>

C - IntPredicate

D - IntSupplier

Answer : D

Explanation

IntPredicate functional interface represents a supplier of int-valued results.

Q 4 - Which of the following functional interface represents an operation upon two long-valued operands and produces a long-valued result?

A - IntToDoubleFunction

B - IntToLongFunction

C - IntUnaryOperator

D - LongBinaryOperator

Answer : D

Explanation

LongBinaryOperator functional interface represents an operation upon two long-valued operands and produces a long-valued result.

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

A - ToDoubleBiFunction<T,U>

B - ToDoubleFunction<T>

C - ToIntBiFunction<T,U>

D - ToIntFunction<T>

Answer : C

Explanation

ToIntBiFunction<T,U> functional interface represents a function that accepts two arguments and produces an int-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 - 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 - Functional interfaces have a single functionality to exhibit.

A - false

B - true

Answer : B

Explanation

Functional interfaces have a single functionality to exhibit.

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