Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 4 MCQs Maven Build Automation

INT332 — Devops Virtualization And Configuration Management 60 questions. Pick an option to check it.

Read the notes

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Why build tools exist Easy

    What is the primary purpose of a build tool like Maven in software development?

  2. Question 2 of 60 Problems solved by automated builds Easy

    Which of the following problems is commonly solved by using automated builds?

  3. Question 3 of 60 Project Object Model (POM) Easy

    Which file serves as the core configuration file for a Maven project, defining dependencies and plugins?

  4. Question 4 of 60 Directory structure Easy

    In Maven's standard directory layout, where is the main Java source code expected to be placed?

  5. Question 5 of 60 Build lifecycle phases Easy

    What is a Maven build lifecycle?

  6. Question 6 of 60 compile Easy

    Which Maven lifecycle phase translates the raw Java source code into bytecode (.class files)?

  7. Question 7 of 60 package Easy

    What is the primary function of the Maven package phase?

  8. Question 8 of 60 install Easy

    Which Maven phase copies the packaged artifact into the local repository, making it available as a dependency for other local projects?

  9. Question 9 of 60 Parent POM Easy

    What is the main purpose of a Parent POM in Maven?

  10. Question 10 of 60 Dependency scope Easy

    Which Maven dependency scope should be used for a library like JUnit, which is only needed when executing unit tests?

  11. Question 11 of 60 Transitive dependencies Easy

    How does Maven handle dependencies of dependencies (i.e., when a library you need requires another library)?

  12. Question 12 of 60 Using dependency Management Easy

    Which POM section allows you to centralize the versioning of dependencies without actually including them in the project?

  13. Question 13 of 60 Surefire plugin (unit testing) Easy

    Which Maven plugin is responsible for running unit tests during the test phase?

  14. Question 14 of 60 Shade plugin (uber jar) Easy

    What is the primary use of the Maven Shade plugin?

  15. Question 15 of 60 Maven wrapper (mvnw) Easy

    What is the main benefit of including the Maven Wrapper (mvnw) in a project's repository?

  16. Question 16 of 60 Maven and Docker Integration: dockerfile-maven-plugin Easy

    What does a plugin like dockerfile-maven-plugin allow developers to do?

  17. Question 17 of 60 Dockerizing Maven-based applications Easy

    When Dockerizing a Maven application, what is typically copied into the final Docker image?

  18. Question 18 of 60 Pushing artifacts to registries Easy

    In a continuous integration pipeline, where are final build artifacts (like JARs or Docker images) usually pushed for sharing and deployment?

  19. Question 19 of 60 Version conflicts & resolution Easy

    How does Maven typically resolve version conflicts when the same transitive dependency is included multiple times with different versions?

  20. Question 20 of 60 deploy Easy

    Which Maven phase copies the final packaged artifact to a remote repository to share it with other developers and projects?

  21. Question 21 of 60 Why build tools exist Medium

    A development team manually compiles their Java code, packages it, and copies it to a server. They frequently encounter the 'it works on my machine' syndrome. How does a build tool like Maven directly mitigate this specific issue?

  22. Question 22 of 60 Problems solved by automated builds Medium

    When integrating an application into a CI/CD pipeline, which of the following is the primary problem solved by utilizing an automated build process rather than a manual one?

  23. Question 23 of 60 Project Object Model (POM) Medium

    You need to define a custom version string 1.5.0 that will be used by multiple dependencies in your pom.xml. How should you define and reference this property?

  24. Question 24 of 60 Directory structure Medium

    You are adding an application configuration file (app-config.xml) that must be present on the classpath during the execution of unit tests, but it MUST NOT be included in the final production JAR. Where should you place this file in the standard Maven directory structure?

  25. Question 25 of 60 Build lifecycle phases Medium

    A developer runs the command mvn install on a Maven project. Based on the default Maven lifecycle, which of the following phases will NOT be executed?

  26. Question 26 of 60 validate, compile, test, package, verify, install, deploy Medium

    You want to ensure that your integration tests run and pass, and that the project meets quality criteria BEFORE it is copied into your local Maven repository. Which phase represents the culmination of these checks?

  27. Question 27 of 60 Parent POM Medium

    In a multi-module Maven project, you want to ensure that all child modules use version 2.5.4 of a library if they choose to declare it, but you do not want to force the library to be included in modules that don't need it. How do you configure this in the Parent POM?

  28. Question 28 of 60 Dependency scope Medium

    You are developing a Java web application that uses the Servlet API. The application server (like Tomcat) will provide this API when the application is deployed. Which dependency scope should you use for javax.servlet-api to prevent it from being packaged in the final WAR file?

  29. Question 29 of 60 Transitive dependencies Medium

    Your project depends on Library A, which internally depends on Library B (v1.0). However, your project also requires Library B directly, but you specifically need version 2.0. To avoid unpredictable classpath behavior, how should you handle this?

  30. Question 30 of 60 Version conflicts & resolution Medium

    Your POM declares Dependency X first and Dependency Y second. Dependency X transitively brings in log-lib version 1.0. Dependency Y transitively brings in log-lib version 2.0. Both transitive dependencies are at the same depth in the dependency tree. According to Maven's mediation rules, which version of log-lib will be used?

  31. Question 31 of 60 Using dependency Management Medium

    What is the primary operational difference between declaring a dependency in <dependencies> versus <dependencyManagement>?

  32. Question 32 of 60 Maven Plugins & Execution: Compiler plugin Medium

    Your local machine runs Java 11 by default, but you need the Maven Compiler Plugin to compile your code strictly for Java 17. How can you configure this in the pom.xml?

  33. Question 33 of 60 Surefire plugin (unit testing) Medium

    During an emergency hotfix deployment, you need to build the project and compile the test classes, but you want to SKIP the actual execution of the unit tests to save time. Which command achieves this?

  34. Question 34 of 60 Shade plugin (uber jar) Medium

    You are developing a standalone Java utility and want to package the application along with all of its dependencies into a single, executable 'uber-jar'. Which Maven plugin is best suited for this task and resolving potential classpath overlaps?

  35. Question 35 of 60 Maven wrapper (mvnw) Medium

    A new developer clones your project repository but does not have Maven installed on their system. The repository contains mvnw and mvnw.cmd files. What is the correct way for them to build the project?

  36. Question 36 of 60 Maven and Docker Integration: dockerfile-maven-plugin Medium

    When using a Maven plugin to build Docker images (like dockerfile-maven-plugin or similar), how is the finalized JAR file name dynamically passed into the Dockerfile so that it can be copied into the image?

  37. Question 37 of 60 Dockerizing Maven-based applications Medium

    You are writing a multi-stage Dockerfile to build a Maven application. To optimize the Docker build cache and avoid re-downloading dependencies every time the source code changes, what is the best sequence of instructions?

  38. Question 38 of 60 Pushing artifacts to registries Medium

    When configuring Maven to deploy a built artifact to a remote private registry (like Nexus or Artifactory), you must provide authentication credentials. According to Maven security best practices, where should these credentials be stored?

  39. Question 39 of 60 Dependency scope Medium

    Your Java application connects to a MySQL database. You need the MySQL JDBC driver to connect at runtime, but your code is written exclusively using the generic java.sql interfaces, so the driver is not needed for compilation. Which dependency scope is most appropriate for the MySQL driver?

  40. Question 40 of 60 validate, compile, test, package, verify, install, deploy Medium

    A CI/CD pipeline executes the command mvn clean deploy. How does Maven process this command?

  41. Question 41 of 60 Version conflicts & resolution Hard

    In a Maven dependency tree, Project A depends on Lib B and Lib C. Lib B depends on Lib D (version 2.0). Lib C depends on Lib E, which in turn depends on Lib D (version 1.0). If Lib B is declared before Lib C in Project A's POM, which version of Lib D is included in the final artifact, and why?

  42. Question 42 of 60 Using dependency Management Hard

    Project A imports a Bill of Materials (BOM) in its <dependencyManagement> section, which specifies com.example:core-lib:1.0. In the <dependencies> section of Project A, com.example:core-lib is declared with version 2.0. Module B, a child of Project A, declares com.example:core-lib without a version. What version of core-lib does Module B resolve?

  43. Question 43 of 60 Parent POM Hard

    A parent POM defines the maven-antrun-plugin exclusively inside the <pluginManagement> section and binds an execution to the validate phase. A child module inherits from this parent but does not mention the maven-antrun-plugin in its own POM. What happens when mvn validate is run on the child module?

  44. Question 44 of 60 Shade plugin (uber jar) Hard

    When creating an Uber JAR using the maven-shade-plugin for an application heavily utilizing the Spring Framework, the resulting JAR throws schema errors at runtime. This happens because multiple dependencies contain different META-INF/spring.handlers files. How must this be resolved in the Shade plugin configuration?

  45. Question 45 of 60 Dependency scope Hard

    A project declares Dependency X with <scope>provided</scope>. Dependency X transitively depends on Dependency Y with <scope>compile</scope>. What is the effective scope of Dependency Y in the root project?

  46. Question 46 of 60 verify Hard

    When running integration tests with the maven-failsafe-plugin, what is the key functional difference between stopping at the integration-test phase versus proceeding to the verify phase?

  47. Question 47 of 60 Maven wrapper (mvnw) Hard

    You are utilizing the Maven Wrapper (mvnw) to ensure uniform build environments. A developer's machine resides behind a strict corporate firewall that blocks direct access to Maven Central, preventing mvnw from downloading the Maven distribution. How can you configure the wrapper to fetch the Maven distribution from an internal Artifactory server?

  48. Question 48 of 60 Maven and Docker Integration: dockerfile-maven-plugin Hard

    When utilizing the dockerfile-maven-plugin to build a Docker image, you want to dynamically pass the final built JAR filename into the Dockerfile as an argument. How is this correctly accomplished mapping Maven coordinates to Docker ARGs?

  49. Question 49 of 60 Pushing artifacts to registries Hard

    A CI pipeline needs to push a compiled Maven artifact to a private Nexus repository. The repository URL is defined in the project's POM under <distributionManagement>. Authentication is required. Where and how must the credentials be configured to ensure Maven successfully authenticates during the deploy phase?

  50. Question 50 of 60 Surefire plugin (unit testing) Hard

    A developer executes mvn package -DskipTests. Which of the following accurately describes the behavior of the maven-surefire-plugin and the build lifecycle in this scenario?

  51. Question 51 of 60 Problems solved by automated builds Hard

    To solve the problem of non-reproducible builds where two builds from identical source code generate JARs with different SHA-256 hashes, what Maven property should be configured to ensure deterministic archive entries?

  52. Question 52 of 60 Directory structure Hard

    A legacy Java project contains source code in both src/main/java and src/legacy/java. How can you correctly configure Maven to compile sources from both directories without breaking standard plugin lifecycles?

  53. Question 53 of 60 deploy Hard

    A project is defined with <packaging>pom</packaging>. You execute the command mvn deploy. Which of the following statements is true regarding the execution of the compiler and surefire plugins during this run?

  54. Question 54 of 60 Project Object Model (POM) Hard

    When resolving the Effective POM, which of the following configuration sources has the highest overriding precedence for defining a specific property value?

  55. Question 55 of 60 Compiler plugin Hard

    When configuring the maven-compiler-plugin to run a custom annotation processor (e.g., MapStruct or Lombok), what is the effect of declaring the processor dependency inside the <annotationProcessorPaths> configuration tag rather than in the project's general <dependencies>?

  56. Question 56 of 60 Dockerizing Maven-based applications Hard

    When writing a multi-stage Dockerfile for a Maven application to optimize build caching, what is the correct order of operations to ensure that dependency downloading is cached as a separate Docker layer?

  57. Question 57 of 60 Transitive dependencies Hard

    Project A declares direct dependencies on Module B and Module C. Module B depends on Lib D (v1.0). Module C also depends on Lib D (v1.0). If you explicitly declare an <exclusion> for Lib D inside the dependency block for Module B in Project A's POM, what happens to Lib D?

  58. Question 58 of 60 Dependency scope Hard

    Which of the following restrictions applies to the import dependency scope in Maven?

  59. Question 59 of 60 Build lifecycle phases Hard

    A custom Maven plugin has a goal specifically bound to the process-classes phase. A developer executes mvn test-compile. Will the custom plugin execute?

  60. Question 60 of 60 Version conflicts & resolution Hard

    In a Maven tree, Dependency A requests Lib X with version range [1.0, 2.0). Dependency B requests Lib X with version range [1.5, 2.5]. If both A and B are included in a project, what version constraint will Maven use to resolve Lib X?

That's unit 4

Answer a few questions and your score shows up here.