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 an int-valued result?

A - DoubleFunction<R>

B - DoublePredicate

C - DoubleSupplier

D - DoubleToIntFunction

Answer : D

Explanation

DoubleToIntFunction functional interface represents a function that accepts a double-valued argument and produces an int-valued result.

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

A - LongConsumer

B - LongFunction<R>

C - LongPredicate

D - LongSupplier

Answer : D

Explanation

LongSupplier functional interface represents a supplier of long-valued results.

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.

Q 6 - Which of the following functional interface represents an operation on a single operand that produces a result of the same type as its operand?

A - ToLongBiFunction<T,U>

B - ToLongFunction<T>

C - UnaryOperator<T>

D - ToIntFunction<T>

Answer : C

Explanation

UnaryOperator<T> functional interface represents an operation on a single operand that produces a result of the same type as its operand.

Q 7 - Which of the following class implements a decoder for decoding byte data using the Base64 encoding scheme in Java8?

A - Base64.Decoder

B - Base64.Encoder

C - Base64Decoder

D - Base64Encoder

Answer : A

Explanation

static class Base64.Decoder - This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

Q 8 - Which of the following method of Base64 class returns a Base64.Decoder that decodes using the Basic type base64 encoding scheme?

A - getDecoder()

B - getEncoder()

C - getMimeDecoder()

D - getMimeEncoder

Answer : A

Explanation

getDecoder() method of Base64 class returns a Base64.Decoder that decodes using the Basic type base64 encoding 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.isPresent method checks the value is present or not.

A - false

B - true

Answer : B

Explanation

Optional.isPresent method checks the value is present or not.

java8_questions_answers.htm
Advertisements