- 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
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.
Q 2 - Which of the following is true about web.xml?
Answer : C
Explanation
Both of the above statements are correct.
Q 3 - Which of the following is correct about FreeMaker result type?
B - It is used to generate output using predefined templates.
Answer : B
Explanation
It is used to generate output using predefined templates.
Q 4 - What are the Struts2 error message keys that can come during file uploading process?
A - struts.messages.error.uploading
B - struts.messages.error.file.too.large
Answer : D
Explanation
All of the above are Struts2 error message keys that can come during file uploading process.
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 @IntRangeFieldValidator 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 : 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.
Q 7 - What is the purpose of @Validations annotation?
A - This annotation checks that a field is a valid URL.
B - This annotation is used to nest several annotations of same type.
C - This annotation checks that a String field is not empty
D - This annotation checks that a String field is of the right length.
Answer : B
Explanation
If you want to use several annotations of the same type, these annotation must be nested within the @Validations() annotation.
Q 8 - Which of the following tag generates an iterator based on the val attribute supplied?
Answer : A
Explanation
These generator tag generates an iterator based on the val attribute supplied.
Q 9 - Which of the following tag is used to get the property of a value, which will default to the top of the stack if none is specified?
Answer : C
Explanation
The property tag is used to get the property of a value, which will default to the top of the stack if none is specified.
Answer : B
Explanation
Struts2 offers integrated profiling to debug and profile the application. In addition to this, Struts also offers integrated debugging with the help of built in debugging tools.