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

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 an operation upon two int-valued operands and produces an int-valued result?

A - DoubleToLongFunction

B - DoubleUnaryOperator

C - Function<T,R>

D - IntBinaryOperator

Answer : D

Explanation

FunctionIntBinaryOperator functional interface represents an operation upon two int-valued operands and produces an int-valued result.

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

A - LongToDoubleFunction

B - LongToIntFunction

C - LongUnaryOperator

D - ObjDoubleConsumer<T>

Answer : A

Explanation

LongToDoubleFunction functional interface represents a function that accepts a long-valued argument and produces a double-valued 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 : C

Explanation

Both of the above options are correct.

Q 8 - Which of the following method of Base64 class returns a Base64.Encoder that encodes using the MIME type base64 encoding scheme?

A - getDecoder()

B - getEncoder()

C - getMimeDecoder()

D - getMimeEncoder

Answer : D

Explanation

getMimeEncoder() method of Base64 class returns a Base64.Encoder that encodes using the MIME type base64 encoding scheme.

Q 9 - Stream operations do the iterations internally over the source elements provided.

A - false

B - true

Answer : B

Explanation

Stream operations do the iterations internally over the source elements provided, in contrast to Collections where explicit iteration is required.

Q 10 - java.util.Date is not thread safe, thus developers have to deal with concurrency issue while using date.

A - true

B - false

Answer : A

Explanation

java.util.Date is not thread safe, thus developers have to deal with concurrency issue while using date.

java8_questions_answers.htm
Advertisements