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

Answer : B

Explanation

POM stands for Project Object Model.

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 tests the compiled source code using a suitable unit testing framework?

A - validate

B - compile

C - test

D - package

Answer : C

Explanation

test phase tests the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed.

Q 4 - 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 : 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 6 - Which of the following scope is only used when dependency is of type pom?

A - system

B - import

C - runtime

D - test

Answer : B

Explanation

import: This scope is only used when dependency is of type pom. This scope indicates that the specified POM should be replaced with the dependencies in that POM's <dependencyManagement> section.

Answer : C

Explanation

Maven provides a comprehensive model for projects which is reusable, maintainable, and easier to comprehend and provides plugins or tools that interact with its declarative model.

Q 8 - Which of the following is correct about artifactId in Maven pom.xml?

A - This is an Id of the project.

B - This is generally name of the project.

C - Both of the above.

D - None of the above.

Answer : C

Explanation

This is an Id of the project.This is generally name of the project. For example, consumer-banking. Along with the groupId, the artifactId defines the artifact's location within the repository.

Q 9 - Which of the following phase in maven life cycle processes the generated files from test code file compilation?

A - process-test-classes

B - process-test-sources

C - generate-test-sources

D - None of the above.

Answer : A

Explanation

process-test-classes processes the generated files from test code file compilation.

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

A - true

B - false

Answer : A

Explanation

Maven searches dependency in central repository, if not found and remote repository/repositories is/are mentioned then searches in remote repositories else if found, then it is downloaded to local repository for future reference.

maven_questions_answers.htm
Advertisements