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 - User sends a request to the server for requesting for some resource (i.e pages).
B - The FilterDispatcher looks at the request and then determines the appropriate Action.
C - Configured interceptors functionalities applies such as validation, file upload etc.
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 correct?
A - The Action class manages the application's state.
Answer : C
Explanation
Both of the above statements are correct.
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 - 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 @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 @RegexFieldValidator annotation?
A - This annotation validates a string field using a regular expression.
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 annotation validates a string field using a regular expression.
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 generates an iterator based on the val attribute supplied?
Answer : A
Explanation
These generator tag generates an iterator based on the val attribute supplied.
Answer : A
Explanation
Struts uses the DOJO framework for the AJAX tag implementation.
Answer : A
Explanation
Tag markups in Struts2 can be tweaked using Freemarker templates. This does not require JSP or java knowledge. Basic HTML, XML and CSS knowledge is enough to modify the tags.