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 : B

Explanation

POM stands for Project Object Model.

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

A - developers

B - mailing list

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 takes the compiled code and package it in its distributable format, such as a JAR?

A - validate

B - compile

C - test

D - package

Answer : D

Explanation

package phase takes the compiled code and package it in its distributable format, such as a JAR.

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 final name of the file created when the built project is packaged?

A - ${pom.build.finalName}

B - ${project.build.finalName}

C - ${maven.build.finalName}

D - ${build.finalName}

Answer : A

Explanation

${pom.build.finalName} refers to the final name of the file created when the built project is packaged.

Answer : D

Explanation

A mojo is a Maven plain Old Java Object. Each mojo is an executable goal in Maven, and a plugin is a distribution of one or more related mojos.

Answer : C

Explanation

This is the version of the project.Along with the groupId, It is used within an artifact's repository to separate versions from each other. For example: com.company.bank:consumer-banking:1.0, com.company.bank:consumer-banking:1.1.

Q 9 - Which of the following phase in maven life cycle generates resources to be included in the package?

A - generate-resources

B - generate-sources

C - generate-test-sources

D - None of the above.

Answer : A

Explanation

generate-resources generates resources to be included in the package.

Q 10 - When dependency in central repository is not found, then Maven searches dependency in remote repository.

A - true

B - false

Answer : A

Explanation

Maven searches dependency in remote repository or repositories, if found then it is downloaded to local repository for future reference otherwise Maven as expected stop processing and throws error (Unable to find dependency).


maven_questions_answers.htm

Advertisements