- 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 struts-config.xml?
B - In form-beans section, you can map your ActionForm subclass to a name.
C - In global-forwards section you can map a page on your webapp to a name
Answer : D
Explanation
All of the above statements are correct.
Q 3 - Which of the following is correct about the OGNL?
Answer : C
Explanation
Both of the above options are correct.
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 @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 @ConversionErrorFieldValidator 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 : C
Explanation
This validation annotation checks if there are any conversion errors for a field and applies them if they exist.
Q 7 - What is the purpose of @RequiredStringValidator 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 numeric field has a value within a specified range.
Answer : C
Explanation
This validation annotation checks that a String field is not empty (i.e. non-null with a length > 0).
Q 8 - Which of the following tag enables developers to call actions directly from a JSP page by specifying the action name and an optional namespace?
Answer : B
Explanation
The action tag enables developers to call actions directly from a JSP page by specifying the action name and an optional namespace. The body content of the tag is used to render the results from the Action.
Q 9 - Which of the following tag will allow you to format a Date in a quick and easy way?
Answer : A
Explanation
The date tag will allow you to format a Date in a quick and easy way.
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.
To Continue Learning Please Login
Login with Google