Maven - Online Quiz



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

Q 1 - Which of the following command can tell the version of maven?

A - mvn --version

B - maven -version

C - mvn version

D - maven --version

Answer : A

Explanation

mvn --version tells the version of maven.

Answer : C

Explanation

A maven artifact is a file, usually a JAR that gets deployed to a Maven repository. A Maven build produces one or more artifacts, such as a compiled JAR and a 'sources' JAR.

Q 3 - Which of the following command quickly builds Maven site?

A - mvn clean

B - mvn build

C - mvn compile

D - mvn site

Answer : D

Explanation

mvn site command can quickly builds Maven site.

Q 4 - 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.

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 6 - Which of the following scope indicates that the dependency is only available for the test compilation and execution phases?

A - compile

B - provided

C - runtime

D - test

Answer : D

Explanation

test − This scope indicates that the dependency is only available for the test compilation and execution phases.

Q 7 - What is the value for packaging element in pom for a project that is purely meta-data?

A - ear

B - war

C - jar

D - pom

Answer : D

Explanation

pom is the value for packaging element in pom for a project that is purely meta-data.

Q 8 - Projects notation in repository is groupId:artifactId:version.

A - false

B - true

Answer : B

Explanation

Projects notation in repository is groupId:artifactId:version.

Q 9 - Which of the following phase in maven life cycle compiles the test source code into the test destination directory?

A - test-compile

B - process-test-sources

C - generate-test-sources

D - None of the above.

Answer : A

Explanation

test-compile compiles the test source code into the test destination directory.

Q 10 - When Maven starts looking for dependency libraries, it first searches dependency in local repository.

A - true

B - false

Answer : A

Explanation

When Maven starts looking for dependency libraries, it first searches dependency in local repository.

maven_questions_answers.htm
Advertisements