QuizzesMastering Java Module System & Dependency Management
advanced
java

Mastering Java Module System & Dependency Management

An advanced quiz on Java's module system and dependency management techniques.

20 minutes 10 questions Pass at 70%
Time Limit
20 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

10 questions on Mastering Java Module System & Dependency Management. Work through them here, then start the quiz to answer them and see your score.

  1. 1.In the Java Module System, which directive is used to expose a package to other modules?

    • Arequires
    • Bprovides
    • Cexports
    • Dopens
  2. 2.Which of the following statements about automatic modules in Java is true?

    • AThey are created from JAR files without module-info.java.
    • BThey require explicit 'exports' directives.
    • CThey are deprecated in Java 17.
    • DThey can only depend on other automatic modules.
  3. 3.What is the primary purpose of the 'requires transitive' directive in a module declaration?

    • ATo enable runtime service loading.
    • BTo make the module's dependencies available to its dependents.
    • CTo allow deep reflection on the module's packages.
    • DTo automatically export all packages to dependent modules.
  4. 4.In the context of Java modules, what is a 'service provider'?

    • AA module that uses 'requires' to consume a service.
    • BA module that uses 'provides' to implement an interface.
    • CA module that uses 'exports' to share a package.
    • DA module that uses 'opens' to allow reflection.
  5. 5.Which tool is used to analyze module dependencies and detect conflicts in Java?

    • Ajavap
    • Bjdeps
    • Cjmod
    • Djlink
  6. 6.How does the 'opens' directive differ from 'exports' in a module declaration?

    • A'opens' is for compile-time access, 'exports' is for runtime access.
    • B'opens' allows reflection, 'exports' does not.
    • C'opens' is deprecated, 'exports' is not.
    • D'opens' is for runtime access, 'exports' is for compile-time access.
  7. 7.What does the 'provides ... with ...' directive achieve in a module declaration?

    • AIt exports a package to specific modules.
    • BIt specifies a service implementation for a service interface.
    • CIt opens a package for deep reflection.
    • DIt declares a module's dependency on another module.
  8. 8.Which statement about unnamed modules is correct?

    • AThey are automatically exported to all other modules.
    • BThey can only be used in the module path.
    • CThey are deprecated in Java 15.
    • DThey are modules with no explicit 'module-info.java'.
  9. 9.What is the role of the 'jlink' tool in the Java Module System?

    • ATo compile Java source code into bytecode.
    • BTo analyze module dependencies.
    • CTo package modules into a JAR file.
    • DTo create a custom runtime image.
  10. 10.How does the Java Module System improve encapsulation compared to the traditional classpath?

    • ABy enabling dynamic loading of classes.
    • BBy restricting access to internal APIs.
    • CBy allowing only one version of a library.
    • DBy supporting multiple class loaders.