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 an operation upon two operands of the same type, producing a result of the same type as the operands?

A - BiConsumer<T,U>

B - BiFunction<T,U,R>

C - BinaryOperator<T>

D - BiPredicate<T,U>

Answer : C

Explanation

BinaryOperator<T> functional interface represents an operation upon two operands of the same type, producing a result of the same type as the operands.

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

A - IntConsumer

B - IntFunction<R>

C - IntPredicate

D - IntSupplier

Answer : A

Explanation

IntConsumer functional interface represents an operation that accepts a single int-valued argument and returns no 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 : A

Explanation

Using super keyword along with interface name.

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.Encoder that encodes using the URL and Filename safe type base64 encoding scheme?

A - getUrlDecoder()

B - getUrlEncoder()

C - getMimeDecoder()

D - getMimeEncoder

Answer : B

Explanation

getUrlEncoder() method of Base64 class returns a Base64.Encoder that encodes using the URL and Filename safe type base64 encoding scheme.

Q 9 - Functional interfaces have a single functionality to exhibit.

A - false

B - true

Answer : B

Explanation

Functional interfaces have a single functionality to exhibit.

Q 10 - In which of the following type of Base64 encoding, Output is mapped to MIME friendly format?

A - Simple

B - URL

C - MIME

D - None of the above.

Answer : C

Explanation

MIME − Output is mapped to MIME friendly format. Output is represented in lines of no more than 76 characters each, and uses a carriage return ' ' followed by a linefeed ' ' as the line separator. No line separator is present to the end of the encoded output.

java8_questions_answers.htm
Advertisements