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

A - DoubleFunction<R>

B - DoublePredicate

C - DoubleSupplier

D - DoubleToIntFunction

Answer : C

Explanation

DoubleSupplier functional interface represents a supplier of double-valued results.

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 predicate (Boolean-valued function) of one argument?

A - ObjIntConsumer<T>

B - ObjLongConsumer<T>

C - Predicate<T>

D - Supplier<T>

Answer : C

Explanation

Predicate<T> functional interface represents a predicate (Boolean-valued function) of one argument.

Answer : C

Explanation

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

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.Decoder that decodes using the MIME type base64 decoding scheme?

A - getDecoder()

B - getEncoder()

C - getMimeDecoder()

D - getMimeEncoder

Answer : C

Explanation

getMimeDecoder() method of Base64 class returns a Base64.Decoder that decodes using the MIME type base64 decoding scheme.

Q 9 - A stream provides a set of elements of specific type in a sequential manner.

A - true

B - false

Answer : A

Explanation

A stream provides a set of elements of specific type in a sequential manner. A stream gets/computes elements on demand. It never stores the elements.

Q 10 - Optional.get method gets the value, value should be present.

A - false

B - true

Answer : B

Explanation

Optional.get method gets the value, value should be present.

java8_questions_answers.htm
Advertisements