Unit 6 - Practice Quiz

INT331 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 What is the fundamental unit of work in Maven?

A. The Gradle File
B. The Project Object Model (POM)
C. The Ant Task
D. The Build Script

2 Which XML file is the core configuration file for a Maven project?

A. build.xml
B. config.xml
C. pom.xml
D. maven.xml

3 In the standard Maven directory structure, where should the application source code be placed?

A. src/main/java
B. src/test/java
C. target/classes
D. src/main/resources

4 What is the primary purpose of the Maven Build Lifecycle?

A. To define a clearly defined process for building and distributing a particular artifact
B. To configure the IDE settings
C. To download dependencies only
D. To write Java code automatically

5 Which of the following is NOT a built-in Maven build lifecycle?

A. site
B. debug
C. clean
D. default

6 What does the clean lifecycle do?

A. Removes all files generated by the previous build
B. Deploys the artifact to a remote repository
C. Compiles the source code
D. Runs unit tests

7 Which Maven phase is responsible for compiling the source code of the project?

A. compile
B. test
C. validate
D. package

8 In the Maven coordinate system (GAV), what does GroupId represent?

A. A unique identifier for the project's organization or group
B. The type of packaging (e.g., jar, war)
C. The name of the artifact (project)
D. The specific version of the project

9 Where are Maven dependencies stored locally on a developer's machine?

A. In the target folder of the project
B. In the Local Repository (usually ~/.m2/repository)
C. In the bin folder of the Maven installation
D. In the System32 folder

10 Which dependency scope indicates that the dependency is needed for compiling and running the application, and is the default scope?

A. provided
B. test
C. compile
D. runtime

11 What is the purpose of the test dependency scope?

A. The dependency is not required for compilation but is for execution
B. The dependency is provided by the JDK or a container
C. The dependency is required for normal use of the application
D. The dependency is only required for compiling and running tests

12 Which command is used to install the project artifact (e.g., jar) into the local repository?

A. mvn compile
B. mvn deploy
C. mvn package
D. mvn install

13 What is a Maven Plugin?

A. A library that must be included in the final WAR file
B. A collection of one or more goals that perform specific tasks during the build
C. A configuration file for database connections
D. A type of dependency scope

14 Which directory contains the compiled bytecode (.class files) after a build?

A. src/bin
B. target/classes
C. dist
D. src/main/java

15 What defines a specific task that a plugin can perform?

A. Cycle
B. Phase
C. Goal
D. Scope

16 If you want to skip running unit tests during a build, which flag should you use?

A. -DnoTest
B. -Dmaven.test.skip=false
C. --ignore-tests
D. -DskipTests

17 Which element in the pom.xml allows you to manage versions of dependencies for child projects without explicitly defining them in the child?

A. <plugins>
B. <dependencies>
C. <properties>
D. <dependencyManagement>

18 What is the Maven Central Repository?

A. A repository that only contains snapshot versions
B. A repository managed by your company
C. A repository located on your local hard drive
D. A public, community-managed repository where Maven downloads dependencies from by default

19 Which packaging type is the default if the <packaging> tag is omitted in the pom.xml?

A. pom
B. war
C. jar
D. ear

20 What is the order of execution for the default lifecycle phases?

A. test, compile, validate, install, package, deploy
B. validate, test, compile, install, package, deploy
C. compile, validate, package, test, install, deploy
D. validate, compile, test, package, install, deploy

21 What is a SNAPSHOT version in Maven?

A. A development version that is subject to change
B. A version that has been deprecated
C. A stable release version
D. A version that is final and immutable

22 Which command creates a new Maven project structure using a template?

A. mvn new
B. mvn init
C. mvn create
D. mvn archetype:generate

23 In the pom.xml, what is the <properties> section typically used for?

A. Defining reusable variables like version numbers or encoding settings
B. Configuring the build output directory
C. Defining the project name
D. Listing the developers

24 What does the provided dependency scope imply?

A. The dependency is needed for compiling and testing, but will be provided by the runtime environment (e.g., Servlet API)
B. The dependency is strictly for the site lifecycle
C. The dependency is needed only for unit tests
D. The dependency is always included in the final packaged artifact

25 Which phase comes immediately before package in the default lifecycle?

A. compile
B. install
C. test
D. validate

26 Where should non-Java resources (like application.properties or XML config) be placed in a standard Maven project?

A. src/resources
B. src/main/resources
C. src/main/java
D. src/main/config

27 What is a Transitive Dependency?

A. A dependency that is manually copied into the project
B. A dependency that is only used for testing
C. A dependency of a dependency that Maven automatically includes
D. A dependency that is excluded from the build

28 How can you exclude a specific transitive dependency in the pom.xml?

A. Using the <exclusions> tag within the dependency declaration
B. Using the <remove> tag
C. Deleting the jar from the local repository
D. Using the <ignore> tag

29 What is the Super POM?

A. A plugin for managing large projects
B. A POM file that inherits from all other POMs
C. The largest POM file in the project
D. The default parent POM that all Maven projects inherit from implicitly

30 Which Maven plugin is primarily responsible for running unit tests?

A. maven-jar-plugin
B. maven-compiler-plugin
C. maven-surefire-plugin
D. maven-deploy-plugin

31 Which Maven command is used to generate a project documentation site?

A. mvn documentation
B. mvn doc
C. mvn report
D. mvn site

32 What does the validate phase do?

A. Validates the XML syntax of the pom.xml only
B. Compiles the code
C. Validates that the project is correct and all necessary information is available
D. Checks if the tests pass

33 In a multi-module project, what packaging type must the Parent POM have?

A. war
B. jar
C. bundle
D. pom

34 Which command would you use to run a Maven build in offline mode?

A. mvn -o package
B. mvn --offline package
C. mvn -offline package
D. mvn -no-net package

35 What is the purpose of the deploy phase?

A. To generate the source code
B. To copy the final package to the local repository
C. To copy the final package to the remote repository for sharing with other developers and projects
D. To run the application on a local server

36 The <modules> tag in a pom.xml is used for:

A. Configuring Java modules (Jigsaw)
B. Listing sub-projects (aggregating) in a multi-module build
C. Defining plugin configurations
D. Defining external libraries

37 What is the Effective POM?

A. The result of merging the project's POM with its parent POMs and the Super POM
B. A POM that has no errors
C. The POM file located in the target directory
D. A plugin that optimizes the POM

38 Which directory holds the source code for unit tests?

A. test/java
B. src/main/test
C. src/test/java
D. src/tests

39 If a dependency is defined in <dependencies>, what happens if the version is missing?

A. Maven asks the user for the version
B. Maven downloads the latest version
C. The build fails, unless the version is managed in <dependencyManagement> of a parent
D. Maven downloads the release version

40 What is the Maven command to remove the target directory?

A. mvn delete
B. mvn erase
C. mvn clean
D. mvn remove

41 Which plugin is used to compile Java sources?

A. maven-compiler-plugin
B. maven-javac-plugin
C. maven-build-plugin
D. maven-source-plugin

42 How do you specify the Java version for compilation in the pom.xml?

A. Using <java.version> tag in dependencies
B. It is automatically detected from the OS
C. Using maven.compiler.source and maven.compiler.target properties
D. Using the <jdk> tag

43 What is the result of mvn package for a project with <packaging>war</packaging>?

A. A WAR file in the target directory
B. A JAR file
C. A ZIP file
D. An EAR file

44 Which of the following describes the Dependency Mediation rule: 'Nearest Definition'?

A. Maven uses the newest version available
B. Maven uses the version of the dependency declared deepest in the dependency tree
C. Maven uses the version of the dependency closest to your project in the dependency tree
D. Maven errors out if duplicate dependencies are found

45 What is the purpose of the settings.xml file in Maven?

A. To define project dependencies
B. To configure the compiler version
C. To configure Maven installation settings, such as proxy servers and local repository location
D. To write unit tests

46 Which scope should be used for a JDBC driver implementation needed only at runtime?

A. compile
B. provided
C. runtime
D. test

47 What is the syntax to execute a specific goal from a plugin directly?

A. mvn plugin:goal
B. mvn -run plugin goal
C. mvn plugin-goal
D. mvn plugin::goal

48 Which command displays the dependency tree of the project?

A. mvn dependency:tree
B. mvn tree:list
C. mvn show:dependencies
D. mvn list:dependency

49 In the pom.xml, the <modelVersion> element usually contains which value?

A. 3.0.0
B. 4.0.0
C. 5.0.0
D. 1.0.0

50 Where does Maven look for the settings.xml file by default?

A. In the .m2 directory of the user's home directory
B. In the Java installation folder
C. In the Windows Registry
D. Inside the project folder