
- 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 is correct definition of view in MVC architecture?
A - The lowest level of the pattern which is responsible for maintaining data.
B - This is responsible for displaying all or a portion of the data to the user.
C - Software Code that controls the interactions between the Model and View.
Answer : B
Explanation
View - This is responsible for displaying all or a portion of the data to the user.
Q 2 - Which of the following is correct about dispatcher result type?
B - It is used to generate output using predefined templates.
Answer : A
Explanation
It is used to forward to a servlet, JSP, HTML page, and so on, on the server. It uses the RequestDispatcher.forward() method.
Q 3 - Which of the following is correct about Temporary 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 : A
Explanation
There are various temporary objects which are created during execution of a page. For example the current iteration value for a collection being looped over in a JSP tag.
Q 4 - Can you override the default error message that can come during file uploading process?
Answer : A
Explanation
You can override the text of these messages in WebContent/WEB-INF/classes/messages.properties resource files.
Q 5 - What is the purpose of @Results 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 : A
Explanation
A @Results annotation is a collection of results. Under the @Results annotation, we can have multiple @Result annotations.
Q 6 - What is the purpose of @EmailValidator 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 : B
Explanation
This validation annotation checks that a field is a valid e-mail address if it contains a non-empty String.
Q 7 - What is the purpose of @CustomValidator 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 can be used for custom validators.
D - This annotation checks that a String field is of the right length.
Answer : C
Explanation
This annotation can be used for custom validators. Use the ValidationParameter annotation to supply additional params.
Q 8 - Which of the following tag will iterate over a value?
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 9 - Which of the following tag is used to render a I18n text message?
Answer : B
Explanation
The text tag is used to render a I18n text message.
Q 10 - Which of the following is true in struts and spring integration?
A - The ContextLoaderListener is required to load the spring context file.
Answer : C
Explanation
Both of the above statements are correct.