Struts2 Mock Test



This section presents you various set of Mock Tests related to Struts2. 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

Struts2 Mock Test III

Answer : D

Explanation

The @After annotation marks a action method that needs to be called after the main action method and the result was executed. Return value is ignored.

Answer : A

Explanation

This validation annotation checks that a double field has a value within a specified range. If neither min nor max is set, nothing will be done.

Answer : D

Explanation

This validation annotation checks that a numeric field has a value within a specified range. If neither min nor max is set, nothing will be done.

Answer : B

Explanation

This validation annotation checks that a field is non-null. The annotation must be applied at method level.

Answer : C

Explanation

This validation annotation checks that a String field is not empty (i.e. non-null with a length > 0).

Answer : D

Explanation

This validator checks that a String field is of the right length. It assumes that the field is a String. If neither minLength nor maxLength is set, nothing will be done.

Answer : B

Explanation

If you want to use several annotations of the same type, these annotation must be nested within the @Validations() annotation.

Answer : C

Explanation

This annotation can be used for custom validators. Use the ValidationParameter annotation to supply additional params.

Answer : D

Explanation

This is a marker annotation for type conversions at Type level. The Conversion annotation must be applied at Type level.

Answer : A

Explanation

This annotation sets the CreateIfNull for type conversion. The CreateIfNull annotation must be applied at field or method level.

Answer : B

Explanation

This annotation sets the Element for type conversion. The Element annotation must be applied at field or method level.

Answer : C

Explanation

This annotation sets the Key for type conversion. The Key annotation must be applied at field or method level.

Answer : D

Explanation

This annotation sets the KeyProperty for type conversion. The KeyProperty annotation must be applied at field or method level.

Answer : A

Explanation

This annotation annotation is used for class and application wide conversion rules. The TypeConversion annotation can be applied at property and method level.

Q 23 - Which of the following tag performs basic if-else conditional flow?

A - if and else tags.

B - iterator tags

C - merge tag

D - append tag

Answer : A

Explanation

These tags perform basic condition flow found in every language. 'If' tag could be used by itself or with 'Else If' Tag and/or single/multiple 'Else' Tag.

Q 24 - Which of the following tag will iterate over a value?

A - if and else tags.

B - iterator tags

C - merge tag

D - append tag

Answer : B

Explanation

These iterator will iterate over a value. An iterable value can be any of: java.util.Collection, java.util.Iterator. While iterating over an iterator, you can use Sort tag to sort the result or SubSet tag to to get a sub set of the list or array.

Q 25 - Which of the following tag takes two or more lists as parameters and merge them all together?

A - if and else tags.

B - iterator tags

C - merge tag

D - append tag

Answer : C

Explanation

These merge tag take two or more lists as parameters and merge them all together.

Answer Sheet

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