Professional Documents
Culture Documents
Version : R6.1
www.Prepking.com
www.Prepking.com
1. A developer wants to measure how many times a servlet has been invoked. Which listener could be used to accomplish this task? A. HttpSessionListener B. ServletContextListener C. ServletRequestListener D. ServletRequestAttributeListener Answer: C
What does this indicate about the JSP? A. That an exception will be thrown within the JSP page B. That the JSP page will have access to an implicit object called exception C. That any exceptions thrown within the JSP page should be ignored D. That if any errors or exceptions occur within the current JSP page, they will be handled by another JSP page Answer: B
3. A Web application contains a single servlet that handles all types of requests.
application there is an HTML page that contains a form that uses a POST type request. There are also hyperlinks with query strings associated with them. The servlet must handle both HTML form and
hyperlink requests. Which two methods of the HttpServlet class should be overridden by the servlet programmer? A. doGet() B. doPut() C. doPost() D. doQuery() E. doForm() Answer: AC
www.Prepking.com
4. Which two of the following situations will result in the init() method of a servlet being invoked? A. Every time a new client accesses the servlet B. When the server automatically reloads the servlet C. When a HTTP INIT type request is made by a client D. When the servlet is put into service after loading and instantiation Answer: BD
5. If a server has URL rewriting enabled, what is the result of using the encodeURL() method of the HttpResponse interface? A. Encryption of sensitive client data in the URL B. Increased performance due to browser specific information being encoded in the URL C. Redirection of all subsequent requests to a unique domain specified as a URL parameter D. Addition of a client's session ID to the URL in a query string Answer: D
6. A client has accessed a servlet via a form that uses an HTTP POST request. Which two methods could be used by the servlet to obtain information input within the form? A. Using the servlet object's getServletInfo() method B. Using the request object's getAttribute() method C. Using the request object's getParameter() method D. Using the request object's getParameterValues() method E. Using the request object's getAttributeValues() method Answer: CD
7. Which method would be used to call a registered servlet within the same Web application and with the following attributes?
www.Prepking.com
8. Which of the following would be legal parameters for the include() method of the RequestDispatcher object? A. ServletHttpRequest, ServletHttpResponse B. HttpServletReq, HttpServletResp C. ServletRequest, ServletResponse D. ServletReq, ServletResp Answer: C
9. What is the BEST scope to store an object containing display data that is to be sent from a servlet to a JSP page with session disabled? A. page B. request C. session D. application/servletContext Answer: B
10. Which method in the ServletContext interface could be used to get the value of a variable named times_Accessed ? A. getAttribute("times_Accessed")
www.Prepking.com
11. A servlet has been configured in a deployment descriptor file with servlet specific initialization parameters. Through which interface can a servlet access these initialization parameters? A. ServletConfig B. ServletContext C. HttpServletRequest D. HttpServletResponse Answer: A
12. Which two of the following may be contained in a WAR file? A. Enterprise JavaBeans B. Servlets C. JSP pages D. Client-side Java Applications Answer: BC
13. Which three of the following would be individually registered in a WAR file deployment descriptor? A. JavaBeans B. Servlet event listeners C. Servlet filters D. Servlets E. HTML pages Answer: BCD
14. A Web banking application assigns a unique transaction number to every online banking operation. A servlet acquires the transaction number with the following line of code:
www.Prepking.com
Upon completion of the banking operation, the servlet forwards the request to a JSP that displays the transaction number in the confirmation response. What is the BEST way for the servlet to ensure that every banking operation has a unique transaction number? A. Use transactionId only as a local variable in methods of the servlet class and store it in the HttpSession object. B. Ensure only one transaction ID is ever stored in the HTTP session and exists only while the request is being processed. C. Declare the servlet to implement SingleThreadModel and store transactionId in the HttpSession object. D. Declare transactionId as an instance variable of the servlet class and store it in the HttpSession object. Answer: B
15. Which method will cause the session to be automatically invalidated if it is not used during a specified time interval? A. setTimeOutInterval() B. setInactiveTimeOutInterval() C. setInvalidateInterval() D. setMaxInactiveInterval() Answer: D
16. In a Web application that is layered in accordance with the MVC design pattern, which object or layer of code is responsible for deciding whether the user request should be accepted given the current state of the application? A. JavaScript within the HTML page that submits the request B. The servlet that receives the request C. The transaction manager object that ensures consistency of persistent data D. The core business logic of the application Answer: B
www.Prepking.com
17. In a travel booking Web application, a servlet uses JAX-RPC to call a Web service to alter the date on an airline ticket. The Web service throws an exception indicating it cannot change the flight because no seats are available on the requested new date. How does the servlet know that the request was not successful? A. The servlet receives a SOAP message that contains a fault element. B. The servlet receives a SOAP message that contains an empty body. C. The servlet catches a java.rmi.RemoteException or a service-specific exception. D. The servlet catches a javax.xml.rpc.JAXRPCException. Answer: C
18. All of the following are a recommended use for servlet filters EXCEPT: A. Authentication B. Encryption C. Protocol converter D. XSLT Answer: C
19. Which two of the following BEST describes the behavior of the Web container in a distributed HTTP session management environment? A. It must call the readObject() and writeObject() methods of a serialized object when the session is passivated. B. It must call the methods in the HttpSessionActivationListener interface in the case of session migration. C. It must preserve session state when the session is passivated. D. It must store the state of static variables when the session is passivated. Answer: BC
20. What Struts class must be extended to hold the state of a form? A. StrutsHTMLForm B. HTMLForm C. ActionForm
www.Prepking.com
D. PageSubmit Answer: C
21. In a standard JavaServer Faces page request processing life cycle, which two of the following phases must be executed no matter what kind of request is received? A. Restore View B. Invoke Application C. Process Validation D. Render Response Answer: AD
22. All of the following are valid elements in the JavaServer Faces configuration resource file faces-config.xml EXCEPT: A. <managed-bean> B. <faces-servlet> C. <navigation-rule> D. <validator> Answer: B
www.Prepking.com
Assume a servlet receives the request submitted through this form. number information from the ServletRequest object? A. response.getParameterMap().get("phone")[0]; B. request.getParameterValues("phone"); C. response.getAttribute("phone"); D. request.getParameter("phone"); E. request.getParameters("phone") [0];W Answer: BD
24. Which two reasons is it important to use an alt attribute within an image tag of an HTML document? A. It allows for an alternate image to be displayed if the primary image cannot be found. B. It allows for descriptive text to be displayed when the image cannot be rendered normally. C. It allows for contents of a text file to be displayed while the mouse hovers over the image area. D. It improves accessibility by allowing an audio file to be played while the mouse hovers over the image area. E. It improves accessibility by providing text to be used by speech synthesizers. Answer: BE 25. All of the following are appropriate uses of JavaScript in a Web application EXCEPT: A. displaying expanding menus, graphs, and other user interface elements beyond the capabilities of
www.Prepking.com
100% Pass Guaranteed or Full Refund Word to Word Real Exam Questions from Real Test Buy full version of exam from this link below http://www.prepking.com/000-150.htm