Java Programming - Struts And Hibernate Questions and Answers

Related Topics:

Java Programming : Struts And Hibernate

Struts and Hibernate Objective Types Questions With Answers and Explanations. Java Programming MCQ Quiz on Struts and Hibernate for various interviews or entrance test.
1. Which of the following methods is overridden by Action class?
[A] execute()
[B] service()
[C] run()
[D] destroy()

Answer: A. execute()


Execute method is overridden by the Action class. As this class in the struts application extends Struts 'org.apache.struts.action.Action" Class
2. Which of the following should always forwards or redirect to a resource (view) after completed?
[A] HttpResponse object
[B] ActionServlet
[C] Action class
[D] Request Processor

Answer: D. Request Processor


RequestProcessor consists of the processing logic which is being performed by ActionServlet as it receives each servlet request from the container. The processing behavior of the request can be customized by subclassing this class and overriding the method(s) as per the need and demand.
3. Which of the following acts as a bridge between user-invoked URI and a business method?
[A] HttpRequest
[B] Action class
[C] ActionServlet
[D] RequestProcessor

Answer: B. Action class


An Action class acts as a bridge between user-invoked URI and a business method.
4. What is the limitation of creating ActionServlet instances per web application?
[A] Two
[B] Three
[C] Unlimited
[D] One

Answer: D. One


ActionServlet Instance Only one instace of ActionServlet can run per web application that is the restriction from the application side. ActionServlet provides the "controller" in the Model-View-Controller (MVC) design pattern for web applications that is commonly known as "Model 2".
5. Which of the following are the struts pre-built Action classes?
[A] RequestAction,SwitchAction,LookupRequestAction,ConfigAction,ContextAction
[B] LookupDispatchAction,SwitchAction,RequestAction,ResponseAction
[C] ForwardAction,DispatchAction,IncludeAction,LookupDispatchAction,SwitchAction
[D] ForwardAction,SwitchAction,ResponseAction, ContextAction, ConfigAction

Answer: C. ForwardAction,DispatchAction,IncludeAction,LookupDispatchAction,SwitchAction


DispatchAction- provides mechanism to collect related functions into a single action and eliminates the need of creating multiple independent actions for each function.
6. Struts framework
[A] should always decouple the application from a specific model implementation
[B] provides model components
[C] does not support JavaBeans and EJB
[D] has built-in support for the model

Answer: A. should always decouple the application from a specific model implementation


The Struts Framework is a standard for developing well-architected Web applications
7. The dispatch from the controller to the Action class is based on a configuration that is provided by a
[A] struts-configs.xml
[B] struts-action-config.xml
[C] struts-processor-conifg.xml
[D] struts-config.xml

Answer: D. struts-config.xml


struts.xml provides the configuration for the dispatch from the controller to the Action class
8. Which of the following tags in struts-config.xml file defines the availability of necessary Struts JSP custom tag libraries?
[A] < jsp-lib>
[B] < struts-taglib>
[C] < taglib>
[D] < jsp-taglib>

Answer: C. < taglib>


Taglib is a component that is used to provide a set of JSP custom tag libraries. This component helps developers creating interactive form-based applications. There are tags to help with everything from displaying error messages to dealing with nested ActionForm beans.
9. Business delegate pattern
[A] Hides remote services complexity
[B] Reduces coupling and increases manageability
[C] Eases failure recovery
[D] All of the above

Answer: D. All of the above


Business Delegate Pattern provides a way to decouple presentation tier and business tier. It reduces communication or remote lookup functionality to business tier code in presentation tier code.
10. Which of the java bean tags is used to show the bean value on the web page?
[A] < bean:define>
[B] < bean:message>
[C] < bean:show>
[D] < bean:write>

Answer: D. < bean:write>


bean:write is used to show the bean value on the web page.

Comments: (Your feedback is valuable to us)