Maven - Online Quiz


Advertisements

Following quiz provides Multiple Choice Questions (MCQs) related to Maven. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Answer : C

Explanation

POM contains information about the project and various configuration details used by Maven to build the project(s) and it always resides in the base directory of the project as pom.xml.

Q 2 - Which of the following configuration element is present in POM.xml?

A - build profiles

B - project version

C - Both of the above.

D - None of the above.

Answer : C

Explanation

Both of the above configuration elements are present in POM.xml.

Q 3 - Which of the following phase in maven life cycle compiles the source code of the project?

A - validate

B - compile

C - test

D - package

Answer : B

Explanation

compile phase compile the source code of the project.

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

Q 6 - Which of the following refers to the version of the project?

A - ${pom.version}

B - ${project.version}

C - ${maven.version}

D - ${version}

Answer : A

Explanation

${pom.version} refers to the version of the project.

Answer : C

Explanation

When a Maven project is created, Maven creates default project structure. Developer is only required to place files accordingly and he/she need not to define any configuration in pom.xml.

Answer : C

Explanation

Maven use the effective pom (configuration from super pom plus project configuration) to execute relevant goal. It helps developer to specify minimum configuration detail in his/her pom.xml. Although configurations can be overridden easily.

Q 9 - Which of the following phase in maven life cycle copies and processes the resources into the destination directory, ready for packaging phase?

A - process-sources

B - process-resources

C - process-test-sources

D - None of the above.

Answer : B

Explanation

process-resources copies and processes the resources into the destination directory, ready for packaging phase.

Answer : C

Explanation

Maven plugins are used to do both of the above mentioned tasks.

maven_questions_answers.htm
Advertisements