- 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 Mock Test
This section presents you various set of Mock Tests related to Struts2. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Struts2 Mock Test I
Q 1 - Which of the following is correct definition of model 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 : A
Explanation
Model - The lowest level of the pattern which is responsible for maintaining data.
Q 2 - 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.
Q 3 - 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 4 - Which of the following feature is present in Struts 2?
Answer : D
Explanation
All of the above features are supported in Struts 2.
Q 5 - Which of the following feature is present in Struts 2?
A - Easy integration with Spring, Tiles and SiteMesh frameworks.
Answer : D
Explanation
All of the above features are supported in Struts 2.
Q 6 - Which of the following is not a part of Struts architecture?
Answer : C
Explanation
EJBs are not a part of Struts architecture.
Q 7 - Which of the following is not a part of Struts architecture?
Answer : C
Explanation
MDBs are not a part of Struts architecture.
Q 8 - 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 9 - 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 10 - 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 11 - Which of the following is true about struts.xml?
B - This file can be used to override default settings for an application.
C - This file can be created under the folder WEB-INF/classes.
Answer : D
Explanation
All of the above statements are correct.
Q 12 - Which of the following is true about web.xml?
Answer : C
Explanation
Both of the above statements are correct.
Q 13 - Which of the following is true about action tag in struts.xml?
A - We define action tags corresponds to every URL we want to access.
Answer : C
Explanation
Both of the above statements are correct.
Q 14 - 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 15 - Which of the following is true about struts-config.xml?
B - In controller section, you can configure Struts internals.
Answer : D
Explanation
All of the above statements are correct.
Q 16 - Which of the following is true about Interceptors?
A - Interceptors are conceptually the same as servlet filters or the JDKs Proxy class.
Answer : C
Explanation
Both of the above statements are correct.
Q 17 - Which of the following can be achieved using interceptors?
A - Providing preprocessing logic before the action is called.
B - Providing postprocessing logic after the action is called.
C - Catching exceptions so that alternate processing can be performed.
Answer : D
Explanation
All of the above statements are correct.
Q 18 - 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 19 - What is defeult result type?
Answer : A
Explanation
The dispatcher result type is the default type and is used if no other result type is specified.
Q 20 - Which of the following is correct about dispatcher result type?
B - It is used to generate output using predefined templates.
Answer : A
Explanation
It is used to forward to a servlet, JSP, HTML page, and so on, on the server. It uses the RequestDispatcher.forward() method.
Q 21 - 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 22 - 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 23 - 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 24 - 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 25 - Which of the following is correct about the Model 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 : B
Explanation
If you are using model objects in your struts application, the current model object is placed before the action on the value stack.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 |