- 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 not a part of Struts architecture?
Answer : C
Explanation
MDBs are not a part of Struts architecture.
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 components are available using ActionContext map?
A - application - application scoped variables.
B - session - session scoped variables.
Answer : D
Explanation
All of the above options are correct.
Q 4 - What should be the name of xml file used for validation in struts?
Answer : A
Explanation
The xml file needs to be named '[action-class]'-validation.xml.
Q 5 - Which class of struts is responsible to convert String to data types?
Answer : A
Explanation
StrutsTypeConverter class tells Struts how to convert Environment to a String and vice versa by overriding two methods convertFromString() and convertToString().
Q 6 - What is the purpose of @ExpressionValidator annotation?
A - This annotation checks that a double field has a value within a specified range.
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 : C
Explanation
This non-field level validator validates a supplied 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 performs basic if-else conditional flow?
Answer : A
Explanation
These tags perform basic condition flow found in every language. 'If' tag could be used by itself or with 'Else If' Tag and/or single/multiple 'Else' Tag.
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.
To Continue Learning Please Login
Login with Google