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.

Questions and Answers

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?

A - integration-test

B - verify

C - install

D - deploy

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?

A - integration-test

B - verify

C - install

D - deploy

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?

A - integration-test

B - verify

C - install

D - deploy

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?

A - integration-test

B - verify

C - install

D - deploy

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.

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?

A - pre-clean

B - clean

C - post-clean

D - All of the above.

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?

A - pre-site

B - site

C - site-deploy

D - All of the above.

Answer : D

Explanation

The site lifecycle consists of the following phases: 1) pre-site 2) site 3) post-site and 4) site-deploy.

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?

A - Per Project

B - Per User

C - Global

D - None of the above.

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)?

A - Per Project

B - Per User

C - Global

D - None of the above.

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)?

A - Per Project

B - Per User

C - Global

D - None of the above.

Answer : C

Explanation

Global − Defined in Maven global settings xml file (%M2_HOME%/conf/settings.xml).

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?

A - OS Settings (for example, Windows family).

B - Present/missing files.

C - Both of the above.

D - None of the above.

Answer : C

Explanation

Using both of the above ways, you can activate a Maven Build Profile.

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?

A - local

B - central

C - remote

D - All of the above.

Answer : D

Explanation

Maven repository are of three types: local, central, remote.

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).

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/.

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?

A - Build plugins

B - Reporting plugins

C - Both of the above

D - None of the above.

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?

A - Build plugins

B - Reporting plugins

C - Both of the above

D - None of the above.

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.

A - true

B - false

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?

A - mvn archetype:archetype

B - mvn archetype:generate

C - mvn generate:archetype

D - None of the above.

Answer : B

Explanation

mvn archetype:generate command can be used to create a new project based on an archtype.

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.

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?

A - compile

B - provided

C - runtime

D - test

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
maven_questions_answers.htm
Advertisements