- Maven Tutorial
- Maven - Home
- Maven - Overview
- Maven - Environment Setup
- Maven - POM
- Maven - Build Life Cycle
- Maven - Build Profiles
- Maven - Repositories
- Maven - Plug-ins
- Maven - Creating Project
- Maven - Build & Test Project
- Maven - External Dependencies
- Maven - Project Documents
- Maven - Project Templates
- Maven - Snapshots
- Maven - Build Automation
- Maven - Manage Dependencies
- Maven - Deployment Automation
- Maven - Web Application
- Maven - Eclipse IDE
- Maven - NetBeans
- Maven - IntelliJ IDEA
- Maven Useful Resources
- Maven - Questions and Answers
- Maven - Quick Guide
- Maven - Useful Resources
- Maven - Discussion
Maven - Mock Test
This section presents you various set of Mock Tests related to Maven. 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.
Maven Mock Test II
Q 1 - Which of the following phase in maven life cycle processes and deploys the package if necessary into an environment where integration tests can be run?
Answer : A
Explanation
integration-test phase processes and deploys the package if necessary into an environment where integration tests can be run.
Q 2 - Which of the following phase in maven life cycle runs any checks to verify the package is valid and meets quality criteria?
Answer : B
Explanation
verify phase runs any checks to verify the package is valid and meets quality criteria.
Q 3 - Which of the following phase in maven life cycle installs the package into the local repository, for use as a dependency in other projects locally?
Answer : C
Explanation
install phase installs the package into the local repository, for use as a dependency in other projects locally.
Q 4 - Which of the following phase in maven life cycle is done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects?
Answer : D
Explanation
deploy phase is done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
Q 5 - Which of the following is true about goal in Maven terminology?
A - A goal represents a specific task which contributes to the building and managing of a project.
Answer : D
Explanation
A goal represents a specific task which contributes to the building and managing of a project. It may be bound to zero or more build phases. A goal not bound to any build phase could be executed outside of the build lifecycle by direct invocation.
Q 6 - Which of the following phases is present in 'clean' Maven life cycle?
Answer : D
Explanation
The clean lifecycle consists of the following phases: 1) pre-clean 2) clean and 3) post-clean.
Q 7 - Which of the following phases is present in 'site' Maven life cycle?
Answer : D
Explanation
The site lifecycle consists of the following phases: 1) pre-site 2) site 3) post-site and 4) site-deploy.
Q 8 - Which of the following is true about Build Profile in Maven terminology?
Answer : C
Explanation
A Build profile is a set of configuration values which can be used to set or override default values of Maven build. Using a build profile, you can customize build for different environments such as Production v/s Development environments.
Q 9 - Which of the Build Profile is defined in the project POM file, pom.xml?
Answer : A
Explanation
Per Project − Defined in the project POM file, pom.xml.
Q 10 - Which of the Build Profile is defined in Maven settings xml file (%USER_HOME%/.m2/settings.xml)?
Answer : B
Explanation
Per User − Defined in Maven settings xml file (%USER_HOME%/.m2/settings.xml).
Q 11 - Which of the Build Profile is defined in Maven global settings xml file (%M2_HOME%/conf/settings.xml)?
Answer : C
Explanation
Global − Defined in Maven global settings xml file (%M2_HOME%/conf/settings.xml).
Q 12 - Using which of the following way, you can activate a Maven Build Profile?
A - Explicitly using command console input.
Answer : D
Explanation
Using all of the above ways, you can activate a Maven Build Profile.
Q 13 - Using which of the following way, you can activate a Maven Build Profile?
Answer : C
Explanation
Using both of the above ways, you can activate a Maven Build Profile.
Q 14 - Which of the following is true about Maven repository?
Answer : C
Explanation
A repository is a place i.e. directory where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily.
Q 15 - Which of the following is a valid type of Maven repository?
Answer : D
Explanation
Maven repository are of three types: local, central, remote.
Q 16 - Which of the following is true about Maven local repository?
A - Maven local repository is a folder location on your machine.
B - It gets created when you run any maven command for the first time.
C - Maven local repository keeps your project's all dependencies (library jars, plugin jars etc).
Answer : D
Explanation
Maven local repository is a folder location on your machine. It gets created when you run any maven command for the first time. Maven local repository keeps your project's all dependencies (library jars, plugin jars etc).
Q 17 - Which of the following is true about Maven central repository?
A - It is repository provided by Maven community.
Answer : D
Explanation
It is repository provided by Maven community. It contains a large number of commonly used libraries. When Maven does not find any dependency in local repository, it starts searching in central repository using following URL: http://repo1.maven.org/maven2/.
Q 18 - Which of the following is true about Maven remote repository?
A - It is developer's own custom repository containing required libraries or other project jars.
Answer : A
Explanation
It is developer's own custom repository containing required libraries or other project jars.
Q 19 - Which of the following maven plugin executes during the build and should be configured in the element of pom.xml?
Answer : A
Explanation
Build plugins − They execute during the build and should be configured in the element of pom.xml.
Q 20 - Which of the following maven plugin executes during the site generation and they should be configured in the element of the pom.xml?
Answer : B
Explanation
Reporting plugins − They execute during the site generation and they should be configured in the element of the pom.xml.
Q 21 - Archetype is a Maven plugin whose task is to create a project structure as per its template.
Answer : A
Explanation
Archetype is a Maven plugin whose task is to create a project structure as per its template.
Q 22 - Which of the following command can be used to create a new project based on an archtype?
Answer : B
Explanation
mvn archetype:generate command can be used to create a new project based on an archtype.
Q 23 - Which of the following is true about a SNAPSHOT build?
A - SNAPSHOT is a special version that indicates a current development copy.
Answer : C
Explanation
SNAPSHOT is a special version that indicates a current development copy. Unlike regular versions, Maven checks for a new SNAPSHOT version in a remote repository for every build.
Q 24 - Which of the following is true about a SNAPSHOT build?
A - Maven will automatically fetch the latest SNAPSHOT everytime dependent project is built.
Answer : C
Explanation
Maven will automatically fetch the latest SNAPSHOT everytime dependent project is built. Unlike regular versions, Maven checks for a new SNAPSHOT version in a remote repository for every build.
Q 25 - Which of the following scope indicates that dependency is available in classpath of project?
Answer : A
Explanation
compile − This scope indicates that dependency is available in classpath of project. It is default scope.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | A |
2 | B |
3 | C |
4 | D |
5 | D |
6 | D |
7 | D |
8 | C |
9 | A |
10 | B |
11 | C |
12 | D |
13 | C |
14 | C |
15 | D |
16 | D |
17 | D |
18 | A |
19 | A |
20 | B |
21 | A |
22 | B |
23 | C |
24 | C |
25 | A |