
- Struts 2 Tutorial
- Struts2 - Home
- Struts2 - Basic MVC Architecture
- Struts2 - Overview
- Struts2 - Environment Setup
- Struts2 - Architecture
- Struts2 - Examples
- Struts2 - Configuration
- Struts2 - Actions
- Struts2 - Interceptors
- Struts2 - Result Types
- Struts2 - Value Stack/OGNL
- Struts2 - File Uploads
- Struts2 - Database Access
- Struts2 - Sending Email
- Struts2 - Validations
- Struts2 - Localization
- Struts2 - Type Conversion
- Struts2 - Themes/Templates
- Struts2 - Exception Handling
- Struts2 - Annotations
- Struts 2 Integrations
- Struts2 - Spring
- Struts2 - Tiles
- Struts2 - Hibernate
- Struts 2 Useful Resources
- Struts2 - Questions and Answers
- Struts2 - Quick Guide
- Struts2 - Useful Resources
- Struts2 - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Struts2 Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to Struts2 Framework. 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.

Q 1 - Which of the following feature is present in Struts 2?
A - Easy integration with Spring, Tiles and SiteMesh frameworks.
Answer : D
Explanation
All of the above features are supported in Struts 2.
Answer : A
Explanation
The dispatcher result type is the default type and is used if no other result type is specified.
Q 3 - Which of the following is correct about the Named Objects?
A - There are various temporary objects which are created during execution of a page.
B - The current model object is placed before the action on the value stack.
Answer : C
Explanation
These objects include #application, #session, #request, #attr and #parameters and refer to the corresponding servlet scopes.
Q 4 - What types of validators are available in xml based validation in struts2?
Answer : D
Explanation
All of the above validators are available in xml based validation in struts2.
Q 5 - What is the purpose of @Result annotation?
A - This annotation is a collection of results.
B - This annotation have the name that correspond to the outcome of the execute method.
C - This annotation is used to decorate the execute() method.
D - This annotation marks a action method that needs to be called after the main action method.
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().
Q 6 - What is the purpose of @DoubleRangeFieldValidator annotation?
A - This annotation checks that a double field has a value within a specified range.
B - This annotation checks that a field is a valid e-mail address if it contains a non-empty String.
C - This annotation validates a supplied regular expression.
D - This annotation checks that a numeric field has a value within a specified range.
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.
Q 7 - What is the purpose of @Key Annotation?
A - This annotation sets the CreateIfNull for type conversion.
B - This annotation sets the Element for type conversion.
C - This annotation sets the Key for type conversion.
D - This annotation is a marker annotation for type conversions at Type level.
Answer : C
Explanation
This annotation sets the Key for type conversion. The Key annotation must be applied at field or method level.
Q 8 - What is the purpose of @TypeConversion Annotation?
A - This annotation sets the CreateIfNull for type conversion.
B - This annotation sets the Element for type conversion.
C - This annotation sets the Key for type conversion.
D - This annotation is used for class and application wide conversion rules.
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 9 - Which of the following tag assigns a value to a variable in a specified scope?
Answer : A
Explanation
The set tag assigns a value to a variable in a specified scope. It is useful when you wish to assign a variable to a complex expression and then simply reference that variable each time rather than the complex expression. The scopes available are application, session, request, page and action.
Q 10 - Struts2 promotes less configuration with the help of using default values for various settings.
Answer : A
Explanation
Struts2 promotes less configuration with the help of using default values for various settings. You don't have to configure something unless it deviates from the default settings set by Struts2.