- Java 9 Tutorial
- Java 9 - Home
- Java 9 - Overview
- Java 9 - Environment Setup
- Java 9 - Module System
- Java 9 - REPL (JShell)
- Java 9 - Improved JavaDocs
- Java 9 - Multirelease JAR
- Java 9 - Collection Factory Methods
- Java 9 - Private Interface Methods
- Java 9 - Process API Improvements
- Java 9 - Stream API Improvements
- Try With Resources improvement
- Enhanced @Deprecated Annotation
- Inner Class Diamond Operator
- Optional Class Improvements
- Java 9 - Multiresolution Image API
- CompletableFuture API Improvements
- Java 9 - Miscellaneous Features
- java9 Useful Resources
- Java 9 - Questions and Answers
- Java 9 - Quick Guide
- Java 9 - Useful Resources
- Java 9 - Discussion
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.
Java 9 Mock Test IV
Q 1 - In which of the following version of java MultiResolutionImage Interface was introduced?
Answer : C
Explanation
With Java 9, a new multi-resolution image API has been introduced which supports multiple images with different resolution variants.
Q 2 - What is goal behind MultiResolutionImage Interface?
A - It 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.
Q 3 - Which of the following correctly describes the getResolutionVariant() method of MultiresolutionImage Interface?
Answer : A
Explanation
getResolutionVariant() − Gets a specific image which is best variant to represent this logical image at the indicated size.
Q 4 - Which of the following correctly describes the getResolutionVariants() method of MultiresolutionImage Interface?
Answer : B
Explanation
getResolutionVariants() − Gets a readable list of all resolution variants.
Q 5 - Which of the following correctly describes the getResolutionVariants() method of MultiresolutionImage Interface?
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?
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.
Q 7 - What is goal behind CompletableFuture Class?
A - To represent the Future which can be completed by setting its value and status explicity.
B - It can be used as java.util.concurrent.CompletionStage.
C - It supports dependent functions and actions which got triggered upon the future's completion.
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.
Answer : D
Explanation
All of the above mentioned enhancements are made in java 9.
Q 9 - Which of the following correctly describes the completeOnTimeout() method of CompletableFuture Interface?
Answer : A
Explanation
completeOnTimeout() − This method completes this CompletableFuture with the given value if not otherwise completed before the given timeout.
Q 10 - Which of the following correctly describes the orTimeout() method of CompletableFuture Interface?
Answer : B
Explanation
orTimeout() − This method exceptionally completes this CompletableFuture with a TimeoutException if not otherwise completed before the given timeout.
Q 11 - Which of the following correctly describes the defaultExecutor() method of CompletableFuture Interface?
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.
Q 12 - Which of the following correctly describes the newIncompleteFuture() method of CompletableFuture Interface?
B - Returns a new CompletableFuture which is already completed with the given value.
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.
Q 13 - Which of the following correctly describes the completedFuture() method of CompletableFuture Interface?
B - Returns a new CompletableFuture which is already completed with the given value.
Answer : B
Explanation
completedFuture() − Returns a new CompletableFuture which is already completed with the given value.
Q 14 - Which of the following correctly describes the completedStage() method of CompletableFuture Interface?
B - Returns a new CompletableFuture which is already completed with the given value.
Answer : C
Explanation
completedStage() − Returns a new CompletionStage which is already completed with the given value and supports only those methods present in interface CompletionStage.
Q 15 - Which of the following correctly describes the failedStage() method of CompletableFuture Interface?
B - Returns a new CompletableFuture which is already completed with the given value.
Answer : D
Explanation
failedStage() − Returns a new CompletionStage which is already completed exceptionally with the given exception and supports only those methods present in interface CompletionStage.
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 |
To Continue Learning Please Login
Login with Google