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 1 - Which of the following functional interface represents an operation that accepts two input arguments, and returns a result?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

Answer : B

Explanation

BiFunction<T,U> functional interface represents an operation that accepts two input arguments, and returns a result.

Q 2 - Which of the following functional interface represents an operation that accepts a single double-valued argument and returns no result?

A - BooleanSupplier

B - Consumer<T>

C - DoubleBinaryOperator

D - DoubleConsumer

Answer : D

Explanation

DoubleConsumer functional interface represents an operation that accepts a single double-valued argument and returns no result.

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

A - DoubleToLongFunction

B - DoubleUnaryOperator

C - Function<T,R>

D - IntBinaryOperator

Answer : B

Explanation

DoubleUnaryOperator functional interface represents an operation on a single double-valued operand that produces a double-valued result.

Q 4 - Which of the following functional interface represents an operation that accepts an object-valued and a double-valued argument, and returns no result?

A - LongToDoubleFunction

B - LongToIntFunction

C - LongUnaryOperator

D - ObjDoubleConsumer<T>

Answer : D

Explanation

ObjDoubleConsumer<T> functional interface represents an operation that accepts an object-valued and a double-valued argument, and returns no 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 : B

Explanation

Using name of the interface.

Q 7 - Which of the following API represents a simplified date-time API with no complexity of timezone handling in java8?

A - Local

B - Zoned

C - Both of the above.

D - None of the above.

Answer : A

Explanation

Local − Simplified date-time API with no complexity of timezone handling.

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 - Stream takes Collections, Arrays, or I/O resources as input source.

A - true

B - false

Answer : A

Explanation

Stream takes Collections, Arrays, or I/O resources as input source.

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 : A

Explanation

Simple − Output is mapped to a set of characters lying in A-Za-z0-9+/.

java8_questions_answers.htm
Advertisements