- 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 is true in the life cycle of a request in Struct2 application?
A - Selected action is executed to perform the requested operation.
B - Configured interceptors are applied to do any post-processing if required.
C - Finally the result is prepared by the view and returns the result to the user.
Answer : D
Explanation
All of the above steps are part of the life cycle of a request in Struct2 application.
Q 2 - Which of the following is true about action tag in struts.xml?
A - We define action tags corresponds to every URL we want to access.
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 - 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 @Action 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 : 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.
Q 6 - What is the purpose of @Before annotation?
B - This annotation marks a action method that needs to be executed before the result.
D - This annotation checks that a date field has a value within a specified range.
Answer : A
Explanation
The @Before annotation marks a action method that needs to be called before the main action method and the result was executed. Return value is ignored.
Q 7 - What is the purpose of @StringLengthFieldValidator annotation?
A - This annotation validates a string field using a regular expression.
B - This annotation checks that a field is non-null.
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 : 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.
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.
Answer : A
Explanation
Struts uses the DOJO framework for the AJAX tag implementation.
Q 10 - Struts2 is popular and mature web application framework based on the MVC design pattern.
Answer : A
Explanation
Struts2 is popular and mature web application framework based on the MVC design pattern.
To Continue Learning Please Login
Login with Google