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

Java Miscellaneous

Advanced Java

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

Answer : C

Explanation

Both of the above options are correct.

Q 2 - Which of the following functional interface represents a predicate of one double-valued argument?

A - DoubleFunction<R>

B - DoublePredicate

C - DoubleSupplier

D - DoubleToIntFunction

Answer : B

Explanation

DoublePredicate functional interface represents a predicate (Boolean-valued function) of one double-valued argument.

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

A - IntToDoubleFunction

B - IntToLongFunction

C - IntUnaryOperator

D - LongBinaryOperator

Answer : B

Explanation

IntToLongFunction functional interface represents a function that accepts an int-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 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.

Answer : D

Explanation

The 'limit' method is used to reduce the size of the stream.

Q 7 - Which of the following class implements an encoder for encoding byte data using the Base64 encoding scheme in Java8?

A - Base64.Decoder

B - Base64.Encoder

C - Base64Decoder

D - Base64Encoder

Answer : B

Explanation

static class Base64.Encoder - This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

Q 8 - Lambda expressions are used primarily to define inline implementation of a functional interface.

A - true

B - false

Answer : A

Explanation

Lambda expressions are used primarily to define inline implementation of a functional interface.

Q 9 - Stream supports aggregate operations like filter, map, limit, reduce, find and match.

A - false

B - true

Answer : B

Explanation

Stream supports aggregate operations like filter, map, limit, reduce, find, match, and so on.

Q 10 - Optional.ofNullable method allows passed parameter to be null.

A - true

B - false

Answer : A

Explanation

Optional.ofNullable method allows passed parameter to be null.

java8_questions_answers.htm
Advertisements