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 aspects of a project can be managed using Maven?

A - Builds

B - Documentation

C - Reporting

D - All of the above.

Answer : D

Explanation

All of the above aspects of a project can be managed using Maven.

Answer : C

Explanation

A Build Lifecycle is a well defined sequence of phases which define the order in which the goals are to be executed. Here phase represents a stage in life cycle.

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

Q 6 - Which of the following scope indicates that dependency is to be provided by JDK or web-Server/Container at runtime?

A - compile

B - provided

C - runtime

D - test

Answer : B

Explanation

provided − This scope indicates that dependency is to be provided by JDK or web-Server/Container at runtime.

Q 7 - Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

A - true

B - false

Answer : A

Explanation

Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

Q 8 - Which of the following phase in maven life cycle generates any source code to be included in compilation phase?

A - generate-sources

B - generate-resources

C - generate-test-sources

D - None of the above.

Answer : A

Explanation

generate-sources generates any source code to be included in compilation phase.

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