- 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.
Answer : A
Explanation
The dispatcher result type is the default type and is used if no other result type is specified.
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 - How Struts 2 validation works?
B - Struts 2 will automatically add the error messages just above the form filed.
Answer : C
Explanation
Both of the above statements are correct.
Q 5 - Which of the following theme is the default theme used by Struts 2?
Answer : B
Explanation
xhtml theme - This is the default theme used by Struts 2 and provides all the basics that the simple theme provides and adds several features like standard two-column table layout for the HTML, Labels for each of the HTML, Validation and error reporting etc.
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 @CreateIfNull Annotation?
A - This annotation sets the CreateIfNull for type conversion.
B - This annotation is used to nest several annotations of same type.
C - This annotation can be used for custom validators.
D - This annotation is a marker annotation for type conversions at Type level.
Answer : A
Explanation
This annotation sets the CreateIfNull for type conversion. The CreateIfNull annotation must be applied at field or method level.
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 class acts as Listener class in struts and spring integration?
A - org.springframework.web.context.ContextLoaderListener
Answer : A
Explanation
org.springframework.web.context.ContextLoaderListener acts as Listener class in struts and spring integration.
Q 10 - Which of the following is true in Struts and Apache tiles integration?
A - We need to tell tiles, where to find tiles configuration file tiles.xml.
B - We need to initialize the Tiles listener that comes with Struts2 download.
Answer : C
Explanation
Both of the above statements are correct.