- 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 correct definition of Controller 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 : C
Explanation
Controller - Software Code that controls the interactions between the Model and View.
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 redirect result type?
B - It is used to generate output using predefined templates.
Answer : C
Explanation
It calls the standard response.sendRedirect() method, causing the browser to create a new request to the given location.
Q 4 - In which of the following internationalization (i18n) support is present in Struts 2?
Answer : D
Explanation
Struts2 provides localization ie. internationalization (i18n) support through resource bundles, interceptors and tag libraries in all of the above places.
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 @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 @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 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 is used to create a URL?
Answer : C
Explanation
The url tag is used to create a URL.
Q 10 - Struts2 promotes less configuration with the help of using default values for various settings.
Answer : A
Explanation
Struts2 promotes less configuration with the help of using default values for various settings. You don't have to configure something unless it deviates from the default settings set by Struts2.
To Continue Learning Please Login
Login with Google