Java 9 Mock Test



This section presents you various set of Mock Tests related to Java 9. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

Java 9 Mock Test IV

Q 1 - In which of the following version of java MultiResolutionImage Interface was introduced?

A - Java 7

B - Java 8

C - Java 9

D - None of the above

Answer : C

Explanation

With Java 9, a new multi-resolution image API has been introduced which supports multiple images with different resolution variants.

Answer : C

Explanation

With Java 9, a new multi-resolution image API has been introduced which supports multiple images with different resolution variants. This API allows a set of images with different resolution to be used as a single multi-resolution image.

Answer : A

Explanation

getResolutionVariant() − Gets a specific image which is best variant to represent this logical image at the indicated size.

Answer : B

Explanation

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

Answer : B

Explanation

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

Q 6 - In which of the following version of java CompletableFuture Class was introduced?

A - Java 7

B - Java 8

C - Java 9

D - None of the above

Answer : B

Explanation

CompletableFuture class was introduced in Java 8 to represent the Future which can be completed by setting its value and status explicity.

Answer : D

Explanation

CompletableFuture class was introduced in Java 8 to represent the Future which can be completed by setting its value and status explicity. It can be used as java.util.concurrent.CompletionStage. It supports dependent functions and actions which got triggered upon the future's completion.

Q 8 - Which of the enhancement is added to CompletableFuture Class in Java 9?

A - Support for delays and timeouts.

B - Improved support for subclassing.

C - New factory methods added.

D - All of the above

Answer : D

Explanation

All of the above mentioned enhancements are made in java 9.

Answer : A

Explanation

completeOnTimeout() − This method completes this CompletableFuture with the given value if not otherwise completed before the given timeout.

Answer : B

Explanation

orTimeout() − This method exceptionally completes this CompletableFuture with a TimeoutException if not otherwise completed before the given timeout.

Answer : C

Explanation

defaultExecutor() − 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.

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.

Answer Sheet

Question Number Answer Key
1 C
2 C
3 A
4 B
5 B
6 B
7 D
8 D
9 A
10 B
11 C
12 A
13 B
14 C
15 D
java9_questions_answers.htm
Advertisements