Struts2 Mock Test


Advertisements

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 II

Answer : C

Explanation

These objects include #application, #session, #request, #attr and #parameters and refer to the corresponding servlet scopes.

Answer : D

Explanation

All of the above options are correct.

Q 4 - Which interceptor is responsible for file upload support?

A - FileUpload

B - File

C - Upload

D - None of the above.

Answer : A

Explanation

File uploading in Struts is possible through a pre-defined interceptor called FileUpload interceptor which is available through the org.apache.struts2.interceptor.

Q 5 - What are the Struts2 configuration properties that control file uploading process?

A - struts.multipart.maxSize

B - struts.multipart.parser

C - struts.multipart.saveDir

D - All of the above.

Answer : D

Explanation

All of the above are Struts2 configuration properties that control file uploading process.

Answer : D

Explanation

All of the above are Struts2 error message keys that can come during file uploading process.

Q 7 - Can you override the default error message that can come during file uploading process?

A - yes

B - no

Answer : A

Explanation

You can override the text of these messages in WebContent/WEB-INF/classes/messages.properties resource files.

Q 11 - What should be the name of xml file used for validation in struts?

A - '[action-class]'-validation.xml

B - validation.xml

C - Both of the above.

D - None of the above.

Answer : A

Explanation

The xml file needs to be named '[action-class]'-validation.xml.

Q 12 - What types of validators are available in xml based validation in struts2?

A - date validator

B - double validator

C - email validator

D - All of the above.

Answer : D

Explanation

All of the above validators are available in xml based validation in struts2.

Q 13 - What types of validators are available in xml based validation in struts2?

A - expression validator

B - int validator

C - regex validator

D - All of the above.

Answer : D

Explanation

All of the above validators are available in xml based validation in struts2.

Q 15 - In which of the following internationalization (i18n) support is present in Struts 2?

A - The UI Tags.

B - Messages and Errors.

C - Within action classes.

D - All of the above.

Answer : D

Explanation

Struts2 provides localization ie. internationalization (i18n) support through resource bundles, interceptors and tag libraries in all of the above places.

Q 16 - Which class of struts is responsible to converts data types from string?

A - StrutsTypeConverter

B - StringTypeConverter

C - Both of the above.

D - None of the above.

Answer : A

Explanation

StrutsTypeConverter class tells Struts how to convert Environment to a String and vice versa by overriding two methods convertFromString() and convertToString().

Q 17 - Which class of struts is responsible to convert String to data types?

A - StrutsTypeConverter

B - StringTypeConverter

C - Both of the above.

D - None of the above.

Answer : A

Explanation

StrutsTypeConverter class tells Struts how to convert Environment to a String and vice versa by overriding two methods convertFromString() and convertToString().

Q 18 - Which of the following theme comes bundled with struts 2?

A - simple theme

B - xhtml theme

C - css_xhtml theme

D - All of the above.

Answer : D

Explanation

All of the above themes comes bundled with struts 2.

Q 19 - Which of the following theme represents minimal theme with no "bells and whistles".?

A - simple theme

B - xhtml theme

C - css_xhtml theme

D - complex theme.

Answer : A

Explanation

simple theme - A minimal theme with no "bells and whistles". For example, the textfield tag renders the HTML tag without a label, validation, error reporting, or any other formatting or functionality.

Q 20 - Which of the following theme is the default theme used by Struts 2?

A - simple theme

B - xhtml theme

C - css_xhtml theme

D - complex theme.

Answer : B

Explanation

xhtml theme - This is the default theme used by Struts 2 and provides all the basics that the simple theme provides and adds several features like standard two-column table layout for the HTML, Labels for each of the HTML, Validation and error reporting etc.

Q 21 - Which of the following theme provides all the basics that the simple theme provides and adds several features like standard two-column CSS-based layout?

A - simple theme

B - xhtml theme

C - css_xhtml theme

D - complex theme.

Answer : C

Explanation

css_xhtml theme - This theme provides all the basics that the simple theme provides and adds several features like standard two-column CSS-based layout, using for the HTML Struts Tags, Labels for each of the HTML Struts Tags, placed according to the CSS stylesheet.

Answer : A

Explanation

A @Results annotation is a collection of results. Under the @Results annotation, we can have multiple @Result annotations.

Answer : B

Explanation

The @result annotations have the name that correspond to the outcome of the execute method. They also contain a location as to which view should be served corresponding to return value from execute().

Answer : C

Explanation

This is used to decorate the execute() method. The Action method also takes in a value which is the URL on which the action is invoked.

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