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 function that accepts a double-valued argument and produces a result?

A - DoubleFunction<R>

B - DoublePredicate

C - DoubleSupplier

D - DoubleToIntFunction

Answer : A

Explanation

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

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

A - DoubleToLongFunction

B - DoubleUnaryOperator

C - Function<T,R>

D - IntBinaryOperator

Answer : A

Explanation

DoubleToLongFunction functional interface represents a function that accepts a double-valued argument and produces a long-valued result.

Q 4 - Which of the following functional interface represents an operation on a single long-valued operand that produces a long-valued result?

A - LongToDoubleFunction

B - LongToIntFunction

C - LongUnaryOperator

D - ObjDoubleConsumer<T>

Answer : C

Explanation

LongUnaryOperator functional interface represents an operation on a single long-valued operand that produces a long-valued 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.

Answer : B

Explanation

Using name of the interface.

Answer : D

Explanation

The 'sorted' method is used to sort the stream.

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 - Method references help to point to methods by their names.

A - true

B - false

Answer : A

Explanation

Method references help to point to methods by their names.

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