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 III

Q 1 - Which of the following scope is the default scope?

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 2 - 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 3 - Which of the following scope indicates that dependency is not required for compilation, but is required during execution?

A - compile

B - provided

C - runtime

D - test

Answer : C

Explanation

runtime − This scope indicates that dependency is not required for compilation, but is required during execution.

Q 4 - 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 5 - Which of the following scope indicates that you have to provide the system path?

A - system

B - import

C - runtime

D - test

Answer : A

Explanation

system − This scope indicates that you have to provide the system path.

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.

Q 7 - Which of the following refers to the name of the project?

A - ${pom.name}

B - ${project.name}

C - ${maven.name}

D - ${name}

Answer : A

Explanation

${pom.name} refers to the name of the project.

Q 8 - Which of the following refers to the version of the project?

A - ${pom.version}

B - ${project.version}

C - ${maven.version}

D - ${version}

Answer : A

Explanation

${pom.version} refers to the version of the project.

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

Q 10 - Which of the following is the default value of packaging?

A - ear

B - war

C - jar

D - pom

Answer : C

Explanation

If no packaging value has been specified, it will default to jar.

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

Answer : A

Explanation

The <execution> element contains information's required for the execution of a plugin.

Answer : B

Explanation

A mojo is a Maven plain Old Java Object.

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.

Q 15 - Apache Maven is a software project management and comprehension tool.

A - true

B - false

Answer : A

Explanation

Apache Maven is a software project management and comprehension tool.

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

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.

Answer : C

Explanation

When a Maven project is created, Maven creates default project structure. Developer is only required to place files accordingly and he/she need not to define any configuration in pom.xml.

Q 19 - There should be a single POM file for each project.

A - true

B - false

Answer : A

Explanation

There should be a single POM file for each project.

Q 20 - All POM files require the project element and three mandatory fields: groupId, artifactId,version.

A - false

B - true

Answer : B

Explanation

All POM files require the project element and three mandatory fields: groupId, artifactId,version.

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

A - false

B - true

Answer : B

Explanation

Projects notation in repository is groupId:artifactId:version.

Q 22 - Root element of POM.xml is project.

A - true

B - false

Answer : A

Explanation

Root element of POM.xml is project.

Answer : C

Explanation

This is an Id of project's group. This is generally unique amongst an organization or a project. For example, a banking group com.company.bank has all bank related projects.

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

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.

Answer Sheet

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