Computer Associates - Java Questions
Question : What exception is thrown when Servlet initialization fails ?
(a) IOException
(b) ServletException
(c) RemoteException
Answer : (b)
Question : How can a Servlet call a JSP error page ?
(a) This capability is not supported.
(b) When the servlet throws the exception, it will automatically be caught by the calling JSP page.
(c) The servlet needs to forward the request to the specific error page URL. The exception is passed along as an attribute named "javax.servlet.jsp.jspException".
(d) The servlet needs to redirect the response to the specific error page, saving the exception off in a cookie.
Answer : (c)
Question : What is the key difference between using a and HttpServletResponse.sendRedirect()?
(a) forward executes on the client while sendRedirect() executes on the server.
(b) forward executes on the server while sendRedirect() executes on the client.
(c) The two methods perform identically.
Answer : (b)
Question : Why beans are used in J2EE architecture in stead of writing all the code in JSPs ?
(a) Allows separation of roles between web developers and application developers
(b) Allows integration with Content Management tools
Answer : (a)