- 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 - 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.
Q 1 - Java 9 main goals are
B - To improve the overall security of the JDK and Java Implementations.
Answer : C
Explanation
Both of the above options are correct.
Q 2 - Which of the following is correct w.r.t Java Documentation?
A - Java documentation can be generated using javadoc tool.
B - Java currently generates documentation in html 4.0 format.
Answer : D
Explanation
All of the above options are correct.
Q 3 - Which of the following method is correct about Map in Java 9?
A - For Map interfaces, of(...) method is overloaded to have 0 to 10 parameters.
B - For Map interfaces, ofEntries(...) method is having var arg as parameter.
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?
Answer : A
Explanation
Private static method support is added in Java 9.
Q 5 - Which of the following is a correct statement about dropWhile() method of Stream class in Java 9?
A - dropWhile method throw away all the values at the start until the predicate returns true.
Answer : C
Explanation
dropWhile method throw away all the values at the start until the predicate returns true. It returns, in case of ordered stream, a stream consisting of the remaining elements of this stream after dropping the longest prefix of elements matching the given predicate.
Q 6 - Which of the following is a correct statement about @Deprecated Annoation?
A - @Deprecated annotation was introduced in java 5 version.
B - Compiler generates warnings whenever a deprecated element is used.
Answer : C
Explanation
Both of the above options are correct.
Q 7 - What is the purpose of Optional Class?
Answer : C
Explanation
Optional Class was introduced in Java 8 to avoid null checks and NullPointerException issues.
Q 8 - 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 9 - 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 10 - 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.