Maven - Mock Test



This section presents you various set of Mock Tests related to Maven. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

Maven Mock Test IV

Answer : C

Explanation

All POMs inherit from a parent (despite explicitly defined or not). This base POM is known as the Super POM, and contains values inherited by default.

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 3 - Which of the following command can be used to look at the default configurations of the super POM?

A - mvn help:effective-pom

B - mvn help

C - mvn help:super-pom

D - None of the above.

Answer : A

Explanation

mvn help − effective-pom command can be used to look at the default configurations of the super POM.

Answer : D

Explanation

A goal represents a specific task which contributes to the building and managing of a project. It may be bound to zero or more build phases. A goal not bound to any build phase could be executed outside of the build lifecycle by direct invocation.

Q 5 - 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 6 - Which of the following phase in maven life cycle processes the source code, for example, filter any value?

A - process-resources

B - process-sources

C - process-test-sources

D - None of the above.

Answer : B

Explanation

process-sources processes the source code, for example, filter any value.

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

Q 9 - Which of the following phase in maven life cycle post-processes the generated files from compilation, for example to do bytecode enhancement/optimization on Java classes?

A - process-classes

B - process-test-sources

C - process-test-classes

D - None of the above.

Answer : A

Explanation

process-classes post-processes the generated files from compilation, for example to do bytecode enhancement/optimization on Java classes.

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

A - process-classes

B - process-test-sources

C - generate-test-sources

D - None of the above.

Answer : C

Explanation

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

Q 11 - Which of the following phase in maven life cycle processes the test source code, for example, filter any values?

A - process-classes

B - process-test-sources

C - generate-test-sources

D - None of the above.

Answer : B

Explanation

process-test-sources processes the test source code, for example, filter any values.

Q 12 - 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 13 - 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 14 - Which of the following phase in maven life cycle performs any operations necessary to prepare a package before the actual packaging?

A - process-resources

B - process-test-sources

C - prepare-package

D - None of the above.

Answer : C

Explanation

prepare-package performs any operations necessary to prepare a package before the actual packaging.

Q 15 - Which of the following phase in maven life cycle performs actions required before integration tests are executed. For example, setting up the required environment?

A - process-resources

B - pre-integration-test

C - prepare-package

D - None of the above.

Answer : B

Explanation

pre-integration-test performs actions required before integration tests are executed. For example, setting up the required environment.

Q 16 - Which of the following phase in maven life cycle processes and deploys the package if necessary into an environment where integration tests can be run?

A - process-resources

B - pre-integration-test

C - integration-test

D - None of the above.

Answer : C

Explanation

integration-test processes and deploys the package if necessary into an environment where integration tests can be run.

Q 17 - Which of the following phase in maven life cycle performs actions required after integration tests have been executed? For example, cleaning up the environment.

A - post-integration-test

B - pre-integration-test

C - integration-test

D - None of the above.

Answer : A

Explanation

post-integration-test performs actions required after integration tests have been executed. For example, cleaning up the environment.

Answer : D

Explanation

This repository is managed by Maven community. It is not required to be configured. It requires internet access to be searched.

Q 19 - Which of the following plugin run the JUnit unit tests and creates test reports?

A - surefile

B - jar

C - war

D - antrun

Answer : A

Explanation

surefire plugin run the JUnit unit tests and creates test reports.

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

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

Q 22 - 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).

Answer : D

Explanation

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

Answer : C

Explanation

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

Answer : C

Explanation

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

Answer Sheet

Question Number Answer Key
1 C
2 C
3 A
4 D
5 A
6 B
7 A
8 B
9 A
10 C
11 B
12 A
13 A
14 C
15 B
16 C
17 A
18 D
19 A
20 A
21 A
22 A
23 D
24 C
25 C
maven_questions_answers.htm
Advertisements