Java 9 - Online Quiz



Following quiz provides Multiple Choice Questions (MCQs) related to Java 9. 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 is/are introduced in Java 9?

A - Module System

B - JShell

C - Multiresolution Image API

D - All of the above

Answer : D

Explanation

All of the above are introduced in Java 9.

Answer : A

Explanation

REPL stands for Read-Eval-Print Loop.

Answer : C

Explanation

Both of the options are correct.

Q 4 - Which of the following is a not valid member of interface till Java 8?

A - Private static methods

B - Default method

C - Static methods

D - All of the above.

Answer : A

Explanation

Private static method support is added in Java 9.

Answer : C

Explanation

takeWhile method takes all the values until the predicate returns false. It returns, in case of ordered stream, a stream consisting of the longest prefix of elements taken from this stream matching the given predicate.

Answer : C

Explanation

Both of the above options are correct.

Answer : C

Explanation

Optional Class was introduced in Java 8 to avoid null checks and NullPointerException issues.

Answer : A

Explanation

If a value is present, it returns a sequential Stream containing only that value, otherwise returns an empty Stream.

Answer : B

Explanation

getResolutionVariants() − Gets a readable list of all resolution variants.

Answer : A

Explanation

newIncompleteFuture() − Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method. Subclasses of CompletableFuture class should override this method to return an instance of the same class as this CompletableFuture. The default implementation returns an instance of class CompletableFuture.

java9_questions_answers.htm
Advertisements