PART 1 OF 5 QUESTION 1 Which code snippet specifies the metadata for a servlet with: (i) url mapping "/mytest"' (ii) Initial

parameter with name "debug" and value "10"' (iii) Support asynchronous operation? A. @WebServlet("/mytest") @InitParam(name-"debug" va1ue = "10") @Asynchronous public class TestServlet extends HttpServlet {} B. @WebServlet ("/myset") @WebParam(name = "debug" value = "10") Public class testServlet {} C. @WebServlet (urlPatterns = { / "mytest"}, Initparams = {@InitParam (name = "debug", value = "10") }, supportAsync = true) public class TestServlet extends HttpServlet {} D. @WebServlet (urlPatterns = { / "mytest"}, Initparams = {@InitParam (name = "debug", value= "10") }, asyncSupported = true) public class TestServlet extends HttpServlet {} E. @WebServlet (urlPatterns = { / "mytest"}, Initparam = @WebInitParam (name = "debug", value = "10"), supportAsync = true) p ublic class testServlet {} Correct Answer: D QUESTION 2 Which annotation specifies the metadata as a javax.servlet.http.HttpSessionListe ner? A. B. C. D. @Listener @WebListener @WebSessionListener @HttpSessionListener

Correct Answer: A QUESTION 3 You are creating a new ISP page and you need to execute some code that acts when the- page is first executed, but only once. Which three are possible mechanisms for performing this initialization code? (Choose three) A. B. C. D. In In In In the init method. the jspInit method. the constructor of the JSP's Java code. a JSP declaration, which includes an initializer block.

E. In a JSP declaration, which includes a static initializer block. Correct Answer: BDE QUESTION 4 You are creating a web form with this HTML: 11. <form action="sendOrder.jsp"> 12. <input type="text" name="creditCard"> 13. <input type="text" name="expirationDate"> 14. <input type="submit"> 15. </form> Which HTTP method is used when sending this request from the browser? A. B. C. D. E. GET PUT POST SEND FORM

Correct Answer: A QUESTION 5 Your web application requires the ability to load and remove web files dynamical ly to the web container's file system? Which two HTTP methods are used to perform these actions? (Choose two) A. B. C. D. E. F. PUT POST SEND DELETE REMOVE DESTROY

Correct Answer: AD QUESTION 6 A web application wants to expose to its clients an operation that results in a transaction being performed across several systems, for example the transfer of money from one bank account to another. Which HTTP method should it use? A. B. C. D. GET HEAD OPT IONS POST

Correct Answer: D QUESTION 7 A Client wants to retrieve a representation of a resource, e.g. an XML document, localized according to the preferences of the user. Each user is allowed to specify one or more languages, in order of preference. Such preferences are application independent. How can th e Client send language preference Information to the Server using a standard HTT P facility? A. In the request body

homeAddress}' /> C. In the request line D. and postal code. In a request header C. D. In the request URL Correct Answer: B QUESTION 8 Which JSTL code snippet can be used to import content from another web resource? A. Correct Answer: A QUESTION 9 In a jsp-centric shopping cart application cart application to move a client's h ome address of Customer object into the shipping address of the order object.jsp"/> <c:include url = "foo.homeA ddress}' /> D. country. In the JSP you are creating. E.jsp"/> <c:include page = "foo.homeAddress}' /> B. you need to split this string into its elements sep arated by commas and generate an HTML <ul> list from the data. Th e address data is stored in a value object class called Address with properties for: street address. <c:import url = "foo. This servlet takes on request parame ter: objoctID. <c:setProperty name='${order}' property='shipAddress'> <jsp:getProperty name='client' property='homeAddress' /> </c:setProperty> Correct Answer: BE QUESTION 10 You are creating a JSP page to display a collection of data. C.jsp"/> <c:import page = "foo. Which two code sn ippets can be used to accomplish this goal? A. A standard action must be used instead. <c:set var='order' property='shipAddress'> <jsp:getProperty name='client' property='homeAddress' /> </c:store> E.jsp"/> Importing cannot be done in JSTL. province. city.B.split(". Assume that this servlet is mapped to the URL pattern: /WEB-INF/data.")}' var='item'> <li>${item}</li> . <c:set target='${order}' property='shipAddress'> <jsp:getProperty name='client' property='homeAddress' /> </c:set> F. <c:set var='order' property='shipAddress' value='${client. This data can be di splayed in several different ways so the architect on your project decided to cr eate a generic servlet that generates a comma delimited string so that various p ages can render the data in different ways. <c:import varReader='dataString' url='/WEB-INF/data'> <c:param name='objectID' value='${currentOID}' /> </c:import> <ul> <c:forTokens items'${dataString. Which JSTL code snippet will accomplish this goal? A. B. <c:set target='${order}' property='shipAddress' value='${client. <jsp:setProperty name='${order}' property='shipAddress' value='${client.

")}' var='item'> <li>${item}</li> </c:forTokens> </ul> D. B. Access is to be permitted independent of authentication state and identity.jsp' /> <jsp:import>foo. C. F. <c:import varReader='dataString' url='/WEB-INF/data'> <c:param name='objectID' value='${currentOID}' /> </c:import> <ul> <c:forTokens items'${dataString}' delims='. B.jsp</jsp:include> PART 2 OF 5 QUESTION 1 Given the annotation for MyServlet: @WebServlet{"/abc") @ServletSecurity (value=@HttpConstraint) public class Myservlet extends Httpservlet { Which two are true? (Choose two) A. All user data must be encrypted by the transport.jsp' /> <jsp:include file='foo.' var='item'> <li>${item}</li> </c:forTokens> </ul> Correct Answer: D QUESTION 11 Which JSP standard action can be used to import content from a resource called f oo.jsp? A. Correct Answer: C Correct Answer: BC . D. No protection of user data must be performed by the transport.split(". D. <c:import var='dataString' url='/WEB-INF/data'> <c:param name='objectID' value='${currentOID}' /> </c:import> <ul> <c:forTokens items'${dataString. E. C. Only authenticated users are to be permitted. Access is to be denied independent of authentication state and identity.</c:forTokens> </ul> B.jsp</jsp:import> <jsp:include>foo. <c:import var='dataString' url='/WEB-INF/data'> <c:param name='objectID' value='${currentOID}' /> </c:import> <ul> <c:forTokens items'${dataString}' delims='.jsp' /> <jsp:import page='foo. E.jsp' /> <jsp:include page='foo.' var='item'> <li>${item}</li> </c:forTokens> </ul> C. <jsp:import file='foo.

D. D. E. D. B. C. <exclude-http-method> <neglect-http-method> <http-method-omission> <http-method-excluded> <exceptional-http-method> Correct Answer: C QUESTION 4 Which two statements are true about the security-related tags in a valid Java EE deployment descriptor? (Choose two) A. Correct Answer: BE QUESTION 5 A cookie may be set to be an HttpOnly cookie. (i) only (i) and (iii) (iv) and (v) (iii) and (v) (ii) and (iv) Correct Answer: C QUESTION 3 Which element of a web application deployment descriptor <web-resource-collectio n> element is used to specify a HTTP method to which the corresponding <security -constraint> will not apply? A. Every <security-constraint> tag must have at least one <http-method> tag. Client to not expose the cookie to client side scripting code Does not work with https protocol prevent certain types of cross-site scripting attacks There is no such thing as an HttpOnly cookie Correct Answer: AC . A given <web-resource-collection> tag can contain from zero to many <url-patt ern> tags. for a given resource user roles can access that resource. C. A given <auth-constraint> tag can apply to only one <web-resource-collection> tag.QUESTION 2 Which of the following annotations relate to security in a servlet? (i) @WebSecurity (ii) @RolesAllowed (iii) @WebConstraint (iv) @HttpConstraint (v) @Servletsecurity A. E. A <security-constraint> tag can have many <web-resource-collection> tags. D. B. B. It is possible to construct a valid <security-constraint> tag such that. C. B. C. Setting a cookie to be HttpOnly re sults in (Choose two) A. E.

C. placing it placing it placing it creating a creating a in the /secure directory in the /WEB-INF directory in the /META-INF/secure directory <web-resource> element within the deployment descriptor <secure-resource> element within the deployment descriptor Correct Answer: BC QUESTION 8 In which two locations can library dependencies be defined for a web application ? (Choose two) A. B. B. B. D.ess.html). the the the the web application deployment descriptor /META-INF/dependencies. D. Where should th e framework's files be placed inside a jar file to enable this kind of reuse? A. . D. WEB-INF/classes WEB-INF/jar WEB-INF/lib WEB INF/resources Correct Answer: C QUESTION 10 . . Furthermore.js.QUESTION 6 A popular Ajax framework and its companion widget library contain several hundre ds of files of different types (. D. under under under under resources META-INF/resources META-INF/web-contents WEB-INF/resources Correct Answer: B QUESTION 7 Which two actions protect a resource file from direct HTTP access within a web a pplication? (Choose two) A. web applications sho uld only include the entire jar.xml file /META-INF/MANIFEST. C. Where should the jar file be placed inside the web application to ensure the resources it contains are accessible by clients? A. without subsetting or modification.jar file contains the JQuery Ajax framework in its META-INF/ re sources directory. C. B. E.MF manifest file /META-INF/MANIFEST.MF manifest of a JAR in the web application classpath Correct Answer: CD QUESTION 9 The jquery_1_3_2. C. Your company has mandated tha t all its web applications use only specific versions of this framework approved by IT and repackaged internally as jar files.

jsp</welcome-file> <welcome-file>/index.jsp</welcome-file> </welcome> <welcome> <welcome-file>/index-html</welcome-file> </welcome> B. <we1come-file-list> <welcome-file> welcome .Y.Given a jar file packaged with three web fragments with names X.xml. (iii). C. (iv) and (v) Correct Answer: C QUESTION 11 Which defines the welcome files in a web application deployment descriptor? A. Z? (i) <absolute-ordering> <name>X</name> <name>Y</name> <name>Z</name> </absolute-ordering> (ii) <absolute-ordering> <name>X</name> <name>Y</name> </absolute-ordering> (iii) <absolute-ordering> </others> <name>Y</name> <name>Z</name> </absolute-ordering> (iv) <absolute-ordering> <name>X</name> </others> <name>Z</name> </absolute-ordering> (v) <absolute-ordering> <name>X</name> <name>Y</name> </others> </absolute-ordering> A. Which of the following deployment descriptor.jsp</welcome </we1come > </welcome > <welcome-file>index. <welcome> <welcome-file>welcome.file >/ welcome . <welcome> .html</welcome-file> </welcome-file-list> E.html<//welcome-file> </we1come > D. snippets correspon d to the web fragment processing orders of X.jsp</welcome-file> <welcome-file>index. <we1come-file-list> <welcome-file> welcome . D. B.html</welcome-file> </welcome-file-list> C. Y and Z respect ively. web. (i) only (i) and (ii) (i) and (iv) (i). <welcome> <welcome.

request. / / insert code here 43.<welcome-file> <welcome-name> welcome </welcome-name> <location> welcome. } To implement the design intent. When deploying the applicatio n to the server. Correct Answer: AD QUESTION 2 Given an HttpServletRequest request and an httpServletResponse response: 41. Given this scenario. request. D. E. } else { 46. which statement must be inserted at line 42? A. if (session = = null) { 44. B. the doployer marks it as distributable in the web application d eployment descriptor to take advantage of this feature. The company recently purchased the Acme Application Serve r. C. C. the J2EE web container ensures that distributed Htt psassion objects will be stored in a database. B. Correct Answer: D QUESTION 3 Users of your web application have requested that they should be able to set the duration of their sessions.getSession ("jsessionid"). D. 42.jsp </location> </welcome-file> <welcome-file> <welcome-name>index</welcome-name> <location> index </location> </welcome-file> </welcome> Correct Answer: B PART 3 OF 5 QUESTION 1 The Squeaky Beans Inc. shopping application was initially developed for a non-di stributed environment.getSession (true). whi ch two must be true? (Choose two) A. The J2EE web container must support migration of objects that implement seria lizable. / / do something if session exists 47. request.getSession ().getSession (). Storing references to Enterprise JavaBeans components in the HttpSession obje ct might NOT supported by J2EE web contain. which supports distributed Httpsession objects. As per the specification. The J2EE web container must use the native JVM Serialization mechanism for di stributing HttpSesaion objects. session session session session session = = = = = response. . request.getSession (false). / / do something if session does not exist 45. HttpSession session = null.

User user = / / retrieves the etMaxInactiveInterval (user. D.s user objects object from the database session. getSessionDuration()). getSessionDuration()).set URLRewriting method. Access to session-scoped attributes is guaranteed to be thread-safe by the we b container. E. C. the developer must use the HttpServletResponse.setInact user objects object from the database session. Correct Answer: E QUESTION 4 Which interface must a class implement so that instances of the class are notifi ed after any object added to a session? A. If the web application uses HTTPS. User user = / / retrieves the etDuration (user. C. User user = / / retrieves the iveInterval (user. Which code snippet in the login servlet will accomplish this goal? A. javax. B.s user objects object from the database session.HttpSessionBindingListener javax. You want to augment this code to set up the user's specified session duration.So for example.get. D.HttpSessionValueListener javax. then the web container may use the data on the HTTPS request stream to identify the client. User user = / / retrieves the etMaxDurationInterval (user. getSessionDuration()). B.s User objects from the database session. you have a special login servlet that pe rforms user authentication and retrieves the object from the database.http. getSessionDuration()).s Correct Answer: D QUESTION 5 Which statement is true about web container session management? A. getSessionDuration()). F.servlet.http.servlet. C. Correct Answer: C QUESTION 6 A method call inside your servlet has thrown an IOException resulting from a los . D. B. User user = / / retrieves the etDurationInterval (user.http.HttpSessionAttributeListener user objects object from the database session.http. another user might want to stay connected for a whole day. The JSESSIONID cookie is stored permanently on the client so that a user may return to the web application and the web container will rejoin that session. Furthermore.servlet. To activate URL rewriting. SessionDuration()). User user = / / retrieves the etInactiveInterval (user. one user might want a webapp to stay connected for an hour rathe r than the webapp's default of fifteen minutes.servlet.s user objects object from the database session.HttpSessionListener javax.

How should you address this? A. If a servlet fails to initialize. The C. throw a servletException to the web container. The D. a servlet finds that the database connection it requires is unavailable. Throw the IOException D. This expression is not necessary. Correct Answer: C QUESTION 7 During initialization. but expects to be able to resume operation after that period. Throw an UnavailableException Correct Answer: D QUESTION 8 A servlet wishes to indicate that it is unable to initialize at the present time . Correct Answer: C QUESTION 10 . you know that the database start up comp letes several minutes after the webcontainer initializes the servlet. but that the initialization might succeed at some future time. D. the conta iner will try again later each time a request is received that attempts to invoke that servlet. Surround the problem area with a try/catch block and implement appropriate re covery or fallback behavior.t network connection to a necessary resource. then allow the init () method to complete. the reby avoiding that risk of connection failure. A servlet either initializes correctly or fails. The ge. Retry the connection until it is successful. The B. The servlet should throw an UnavailableException E. The servlet servlet servlet servlet should should should should re-throw the exception to the web container. B. C. Provide an error handler page. B. B. The servlet should throw a servletException Correct Answer: E QUESTION 4 You are implementing a model component. redirect to an error page that reports the exception messa servlet should retry the request until the method returns successfully. throw an unavailableException to the web container. The servlet has determined that it will be unable to operate successfully fen few minutes. Use the JSTL <c:catch> tag to take control if the exception arises. The servlet should delay until it is ready to complete initialization success fully. Implement multipathing to provide redundant connectivity to the database. This cannot be expressed. How should this be handled? A. How should this situation handled? A. E. Which is true? A. C. D. You realize that an IOException might ar ise if you lose connection to the database. Throw a ServletException C. and use the page directive in the invoking ISP to redirect to that page if the error arises. As the system designer.

%> Which three EL expressions. "2". new String[] {"1". <% . <title> $ {titlestr} </title> B.insert code here . Which two properly set the title in the scenario? (Choose two) A. <title> $ {initParam [`titleStr'] } </title> F. <% 12..Which is a valid value for the enum EmptyRoleSemantic in Javax.. "2"). request.jsp contains: <% int i = 12. ADMIT PERMIT EXCLUDE DENYALL ALLOWALL Correct Answer: B PART 4 OF 5 QUESTION 1 Given the element from the web application deployment descriptor: <jsp property group> <url pattern>/main/page1. D. <b> <b> B. %> <b> <%= i %> </b> What is the result? A. D. <title> $ {param [0]. %> 15. 13.titleStr} </title> E. <% int i = 12 %> <b> <%= i % > < b> Correct Answer: C QUESTION 2 A web application allows the HTML title banner to be set using a context initial ization parameter called titlestr. C. <title> $ {servletParams. The JSP fails to execute.get ("titleStr") } </title> Correct Answer: BE QUESTION 3 Given: 11. "3". "4"}). are valid and evaluate to "3"? (Choose three) A. titlestr} </title> D.titleStr} </title> G.jsp</url pattern> <scripting invalid>true</scripting invalid> </jsp--property--group> And given that /main/page1. <b> l2 </b> C. inserted at line 15. <title> $ {request. request. B. 14.2} B. <title> $ {paramValues. ${vals. <title> $ {initparam. E.servlet. ${vals ["2"] } .setAttribute ("vals".ServletSecurity? A.titlestr}</title> C.annotatio n.setAttribute ("index".

On the JSP.util.setAttribute("foo". D. <! .420. D. Which EL code snippet will display Nth element of the user's selected hobbles? A. G.and more options .hobbyEnum[N]) } ${hobbies [paramValues. C. E. S(requestScope['foo'][0] ne 10 div0> 5. F. nums). Part of the form to submit a client' s profile is a group of radio buttons for the person's hobbies: 20. holds a map between the hobby enumerated type and th e display name. you need to show the current date. C.. true true false true false true 0 true true Infinity false true Infinity An exception is thrown Compilation or translation fails Correct Answer: E QUESTION 6 You are building a web application with a scheduling component.C. and the date of th e next week. (vals.util. ${10 div 0} What is the result? A. the date of the previous week. signature: java. Assume that an application-scoped hobbies. <input type = `radio' name = `hobbyEnum' value = `SKING'> Sking <br> 22.Date. signature: java.>> After the user submits this form. To help you present this information. B. 2. F.utilDa te CurrentDate() Name : curData.4200}. %> 3. ${vals. <% int[] nums = {42. <input type = `radio' name = `hobbyEnum' value = `SCUBA'> SCUBA <br> 23.get(paramValues.utilDate addweek (java. G. D.String getD .hobbyEnum[N]]} ${hobbies [paramValues @ `hobbyEnum' @N] ${hobbies. ${hobbies [hobbyEnum[N]} ${hobbies [paramValues..index} ${vals[index] } ${vals} [index] ${vals. E. ${5 + 3 It 6} 4.util.hobbyEnum.index) } ${vals [vals[index-1]] } Correct Answer: BDG QUESTION 4 You are building a dating service web site. you have created the followin g EL functions in the `d' namespace: Name : curData. B. <input type = `radio' name = `hobbyEnum' value = `HIKING'> Hiking <br> 21.util. E. a confirmation screen is displayed with these hobbies listed. signature: java.get(N)] } Correct Answer: B QUESTION 5 Given: 1. request. int) Name: dateString.

"joe")) response. "joe") request.get(0) request.1]] } ${d:dateString (d:addWeek(d:curDate(). G. E.addCookie("username". Any time C. request. D. which sets a cookie "username" with the value "joe" in a servlet? A. B. D. .addCookie(new Cookie("username". Context initialization time B.addCookie(new Cookie("username".setCookie("username". B. -1)) } Correct Answer: D QUESTION 7 Given a header in an HI IP request: X-Retries: 4 A Which two retrieve the value of the header from a given HttpServletRequest req uest? (Choose two) A. D. C. There is no way to dynamically register servlets and filters .addHeader(new Cookie("username".getRequestHeaders("X-Retries"). "joe") request. F. D. C. ${d:dateString(affWeek(curDate(). B. "joe")) request. E. C.]] } ${d:dateString [d:addWeek[d:curDate[]. -1)) } ${d:dateString [addWeek[curDate[]. "joe")) Correct Answer: F QUESTION 9 Which annotation enables a servlet to efficiently process requests of typo multi part/form-data that involve large files being uploaded by the client? A.getHeaders{"X-Retries").get(0) Correct Answer: AB QUESTION 8 Given an HttpServletRequestrequest and HttpResponseresponse.ataString (jave. C.addHeader(new Cookie("username".Data) Which EL code snippet will generate the string for the previous week? A.getRequestHeader("X-Retries") request.addCookie("username". "joe") response.getlntHeader("X-Retries") request. request-getHeader("X-Retries") request. @AcceptMultipart @MultiPartConfig @MultiPartFormData @WebServlet (multipart = true) Correct Answer: B QUESTION 10 APIs for dynamically registering servlets and filters can be called at: A. B. "joe")) response.util. .

B. B. orderIS). reques. you pass the request first to a servlet that is mapped to the URL pattern /WEB INF / retrieveOrder. AsyncListner. The method that your filter invokes on the object it received that implements javax servlet.Filter. D. Injected into a servlet context Correct Answer: A QUESTION 11 ServletRegistration. To do this additional processing.setAttribute ("orderID".contextInitialize ServletrequestListener.init ServletContextListener. It handles the database calls to retrieve a nd build the complex order objects and then it dispatches to the jspURL. This servlet takes two request parameters. E.do . Several of these views require further database processing to retrieve the necessary order object using the or derID request parameter. Your filter class must implement an init method and a destroy method.Filterchain can invoke either another filter or a servlet.contextInitialize Correct Answer: C QUESTION 13 You want to create a filter for your web application and your filter will implem ent .servlet. Which two statements are true? (Choose two) A. B. in the deployment descriptor. D. Correct Answer: AD QUESTION 14 You have a simple wpb application that has a single Front Controller servlet tha t dispatches to JSPs generate a variety of views. Your filter class must implement a doFilter method that takes. Your filter class must also implement javax. it should pass the same arguments it received in its doFilter method.oncomplete Servlet. an HttpServletRequest object and an HttpServletresponse object.addServlet methods.Dynamic can be used to configure (Choose two) A. C. .D. When your filter chains to the next filter. Filter mappings add init params set asyncSupported to true add Listeners Correct Answer: AB QUESTION 12 A web application wants to register a new servlet at runtime using one of the se rvletContext.sarvlat. among other th ings. Context destruction time E. the o rdered and the jspID and the jspURL. C. Which code snippet in the Front Controller servlet dispatches the request to the order retrieval servlet? A. C. In the implementation of which method is it leg al to perform this operation? A. D.FilterChain.

View.setAttribute ("orderID".do?orderID = %d&jspURl = %s".request. AsyncContext.dispatch(). ordered. jspURL). "/url").setAttribute("jspURL". orderIS). String T= "/WEB INF / retrieveOrder. C. String url = String.forward(servletContext.do"). url of a servlet relative to the ServletRequest url of a servlet relative to the Context name of a servlet absolute url to any servlet in any Context Correct Answer: B QUESTION 2 When using Servlet asynchronous API if you want to dispatch the request back to a particular url .do?orderID = %d&jspURl = %s". D. String url = String. jspURL).getRequestDispatcher (url). = context.dispatch("/url").getRequestDispatcher (url). RequestDispatcher.dispatch(servletContext. = context. response). RequestDispatcher.format (T."/url" within the same Servlet Context which of the following API would you use? A. C. = context. E. View. reques. Correct Answer: AC QUESTION 3 Which describes a trigger that causes a call to an AsyncListener? A. request.forwardRequest (request. F. "/url"). B. D. String T= "/WEB INF / retrieveOrder. D.forward (request.getRequestDispathcher ("/WEB INF / retrieveOrder. C. view.WEB INF / retrieveOrder.do"). View. B. G. B. response) .include("/url").getNamedDispatcher(string arg0) arg0 is the A. jspURL). AsyncContext. AsyncContext. jspURL). Dispatcher view = request.start(runnable). ordered. C.fotward("/url"). response) B.setAttribute("jspURL".forward(re quest.getDispatcher (". RequestDispatcher.format (T. PART 5 OF 5 QUESTION 1 In ServletContext. Completion of processing Receipt of a new request from the same client Addition of a new filter to the processing stream for this request Completion of each timer interval Correct Answer: B . response) . D.forwardRequest (re quest. ASyncContext.

<jsp:useBean id = `pageBean' type = `com. B. C. E. It must NOT be accessible to any other page including those that this page m ight import.MyBean' /> <jsp:makeBean id = `pageBean' class = `com. the Httpsession object.in accomplish this goal? A.example. and inserted the bean into the application scope using the name "myBean". Which JSP standard action < . the manage attribute. Which two can support this design goal? (Choose two) A. E. C.MyBean' /> <jsp:makeBean id = `pageBean' class = `com. B.example. C. D.MyBean' /> <jsp:useBean id = `pageBean' class = `com. is r . Store Store Store Store Store the the the the the data data data data data in in in in in a local variable. public MyBean () {} public Boolean isRoasted () { returned roasted } public void setRoasted (Boolean roasted) { this.MyBean' /> Correct Answer: B QUESTION 5 Given the JavaBean class: public class MyBean { private Boolean roasted = false. D. updated in a thread safe manner. ] } Assume a controller has created an instance of this bean. A JSP contains these two tags: <jsp: useBean id = "aBean" class = "MyBean" scope = "page" \ /> <jsp: getProprty name = "aBean" property = "roasted" \ /> Which is true? A.example. D. called setRoasted (tru e).example.MyBean' /> <jsp:useBean id = `pageBean' class = `com. E. F.roasted = roasted.MyBean' /> <jsp:makeBean id = `pageBean' type = `com.QUESTION 4 You need to create a JavaBean object that is used only within the current ISP pa ge. B.example. the sarvletContext object. At the end of the use case.example. the the the the the page page page page page will will will will will include the include the report that report that report that output false output the property roasted does not exist the syntax of the useBean tag is incorrect the syntax of the getProperty tag ls incorrect Correct Answer: E QUESTION 6 A developer chooses to avoid using singieThreadModel but wants to ensure that da ta If. an instance variable. one of these objects. the ServletRequest object. Correct Answer: AE QUESTION 7 You have a use in your web application that adds several session-scoped attribut es.

B. Given this scenario. The object of the manager attribute should implement the HttpSessionBindingLi stener rind it should call the deleteAttribute method on the appropriate session attributes. C. shopping application was initially developed for a non-di stributed environment. Storing references to Enterprise JavaBeans components in the HttpSession obje ct might NOT supported by J2EE web contain. B. C. As per the specification. 43. request. C. D.getSession (false). How can this goal be accomplished? A. 45. Correct Answer: A QUESTION 8 The Squeaky Beans Inc. which supports distributed Httpsession objects. D. 44. the doployer marks it as distributable in the web application d eployment descriptor to take advantage of this feature.getSession (true). The J2EE web container must support migration of objects that implement seria lizable. request. 47. B.getSession ("jsessionid"). The object of the manager attribute should implement the HttpSessionListenar and it should call the removeAttribute method on the appropriate session attributes. When deploying the applicatio n to the server. request.getSession (). the J2EE web container ensures that distributed Htt psassion objects will be stored in a database.emoved and then it needs to decide which of the other session-scoped attributes to remove. To A. which statement must be inserted at line 42? response. whi ch two must be true? (Choose two) A. D. Correct Answer: D . The J2EE web container must use the native JVM Serialization mechanism for di stributing HttpSesaion objects. The object of the manager attribute should implement the HttpSessionBindingLi stener and it should call the removeAttribute method on the appropriate session attributes. request. E.getSession (). / / insert code here if (session = = null) { / / do something if session does not exist } else { / / do something if session exists } implement session = session = session = session = session = the design intent. The object of the manager attribute should implement the HttpsessionListener and it should call the deleteAttribute method on the appropriate session attribu tes. The company recently purchased the Acme Application Serve r. Correct Answer: AD QUESTION 9 Given an HttpServletRequest request and an httpServletResponse response: 41. 46. HttpSession session = null. 42.

. AsyncContext. D. RequestDispatcher.example.start(runnable). RequestDispatcher.example.MyBean' /> Correct Answer: B QUESTION 5 Given the JavaBean class: public class MyBean { private Boolean roasted = false. Completion of processing Receipt of a new request from the same client Addition of a new filter to the processing stream for this request Completion of each timer interval Correct Answer: B QUESTION 4 You need to create a JavaBean object that is used only within the current ISP pa ge.QUESTION 1 In ServletContext. C.dispatch("/url"). F.MyBean' /> <jsp:makeBean id = `pageBean' class = `com. RequestDispatcher.example. B. E. D. "/url"). B. B. <jsp:useBean id = `pageBean' type = `com. E. C.in accomplish this goal? A. D.example.fotward("/url"). G.getNamedDispatcher(string arg0) arg0 is the A.dispatch()."/url" within the same Servlet Context which of the following API would you use? A.forward(servletContext.MyBean' /> <jsp:useBean id = `pageBean' class = `com. Which JSP standard action < .MyBean' /> <jsp:makeBean id = `pageBean' class = `com.MyBean' /> <jsp:useBean id = `pageBean' class = `com. C. F.include("/url"). ASyncContext.dispatch(servletContext. C. AsyncContext.example. url of a servlet relative to the ServletRequest url of a servlet relative to the Context name of a servlet absolute url to any servlet in any Context Correct Answer: B QUESTION 2 When using Servlet asynchronous API if you want to dispatch the request back to a particular url . B. D. "/url"). Correct Answer: AC QUESTION 3 Which describes a trigger that causes a call to an AsyncListener? A. AsyncContext.MyBean' /> <jsp:makeBean id = `pageBean' type = `com. It must NOT be accessible to any other page including those that this page m ight import.example.

one of these objects. the Httpsession object. B. D. the ServletRequest object. an instance variable. Which two can support this design goal? (Choose two) A. updated in a thread safe manner. Correct Answer: A QUESTION 8 . D. the manage attribute. called setRoasted (tru e). At the emoved and to remove. ] } Assume a controller has created an instance of this bean. C. The object of the manager attribute should implement the HttpSessionBindingLi stener and it should call the removeAttribute method on the appropriate session attributes. is r then it needs to decide which of the other session-scoped attributes How can this goal be accomplished? A. The object of the manager attribute should implement the HttpSessionBindingLi stener rind it should call the deleteAttribute method on the appropriate session attributes. E. Store Store Store Store Store the the the the the data data data data data in in in in in a local variable. D. The object of the manager attribute should implement the HttpsessionListener and it should call the deleteAttribute method on the appropriate session attribu tes. the the the the the page page page page page will will will will will include the include the report that report that report that output false output the property roasted does not exist the syntax of the useBean tag is incorrect the syntax of the getProperty tag ls incorrect Correct Answer: E QUESTION 6 A developer chooses to avoid using singieThreadModel but wants to ensure that da ta If. C. Correct Answer: AE QUESTION 7 You have a es. C. A JSP contains these two tags: <jsp: useBean id = "aBean" class = "MyBean" scope = "page" \ /> <jsp: getProprty name = "aBean" property = "roasted" \ /> Which is true? A.public MyBean () {} public Boolean isRoasted () { returned roasted } public void setRoasted (Boolean roasted) { this. use in your web application that adds several session-scoped attribut end of the use case. The object of the manager attribute should implement the HttpSessionListenar and it should call the removeAttribute method on the appropriate session attributes. B.roasted = roasted. and inserted the bean into the application scope using the name "myBean". the sarvletContext object. E. B.

The JSP fails to execute. 46. which statement must be inserted at line 42? response. 43. C.getSession (). D. C. E. the doployer marks it as distributable in the web application d eployment descriptor to take advantage of this feature. request. Correct Answer: D PART 4 OF 5 QUESTION 1 Given the element from the web application deployment descriptor: <jsp property group> <url pattern>/main/page1. The J2EE web container must support migration of objects that implement seria lizable. request. Storing references to Enterprise JavaBeans components in the HttpSession obje ct might NOT supported by J2EE web contain. B. D.jsp contains: <% int i = 12. <b> l2 </b> C. <b> <b> B. To A. Correct Answer: AD QUESTION 9 Given an HttpServletRequest request and an httpServletResponse response: 41. whi ch two must be true? (Choose two) A. which supports distributed Httpsession objects. request.getSession (false). shopping application was initially developed for a non-di stributed environment.jsp</url pattern> <scripting invalid>true</scripting invalid> </jsp--property--group> And given that /main/page1. %> <b> <%= i %> </b> What is the result? A. request.getSession ("jsessionid"). The J2EE web container must use the native JVM Serialization mechanism for di stributing HttpSesaion objects. 44. Given this scenario. As per the specification. <% int i = 12 %> <b> <%= i % > < b> Correct Answer: C . / / insert code here if (session = = null) { / / do something if session does not exist } else { / / do something if session exists } implement session = session = session = session = session = the design intent. 42. 45. D. When deploying the applicatio n to the server.The Squeaky Beans Inc. HttpSession session = null.getSession (). B. 47. the J2EE web container ensures that distributed Htt psassion objects will be stored in a database.getSession (true). The company recently purchased the Acme Application Serve r.

are valid and evaluate to "3"? (Choose three) A.and more options . <title> $ {request. B. Part of the form to submit a client' s profile is a group of radio buttons for the person's hobbies: 20. E. titlestr} </title> D. <input type = `radio' name = `hobbyEnum' value = `SCUBA'> SCUBA <br> 23. new String[] {"1".index} ${vals[index] } ${vals} [index] ${vals.insert code here . inserted at line 15.titlestr}</title> C. "4"}). request.titleStr} </title> G. C.%> Which three EL expressions. <title> $ {paramValues.hobbyEnum. "2").get ("titleStr") } </title> Correct Answer: BE QUESTION 3 Given: 11. D.get(N)] } Correct Answer: B . B.hobbyEnum[N]) } ${hobbies [paramValues. (vals.get(paramValues. request. C. holds a map between the hobby enumerated type and th e display name.titleStr} </title> E..setAttribute ("index". E. F. <title> $ {param [0].2} ${vals ["2"] } ${vals. <title> $ {initParam [`titleStr'] } </title> F.>> After the user submits this form.. <% . ${vals. %> 15. <% 12.index) } ${vals [vals[index-1]] } Correct Answer: BDG QUESTION 4 You are building a dating service web site. ${hobbies [hobbyEnum[N]} ${hobbies [paramValues.QUESTION 2 A web application allows the HTML title banner to be set using a context initial ization parameter called titlestr. Which EL code snippet will display Nth element of the user's selected hobbles? A. D.. "3". a confirmation screen is displayed with these hobbies listed. <title> $ {titlestr} </title> B. Assume that an application-scoped hobbies. G..setAttribute ("vals". <title> $ {initparam. 13. <input type = `radio' name = `hobbyEnum' value = `HIKING'> Hiking <br> 21. Which two properly set the title in the scenario? (Choose two) A. 14.hobbyEnum[N]]} ${hobbies [paramValues @ `hobbyEnum' @N] ${hobbies. <title> $ {servletParams. "2". <input type = `radio' name = `hobbyEnum' value = `SKING'> Sking <br> 22. <! .

String getD ataString (jave.utilDate addweek (java.1]] } ${d:dateString (d:addWeek(d:curDate().util. C. F. On the JSP. E. %> 3. request. <% int[] nums = {42. .Data) Which EL code snippet will generate the string for the previous week? A. you have created the followin g EL functions in the `d' namespace: Name : curData.util. D. To help you present this information.getlntHeader("X-Retries") request.getRequestHeaders("X-Retries"). nums). D. request-getHeader("X-Retries") request.]] } ${d:dateString [d:addWeek[d:curDate[].Date. S(requestScope['foo'][0] ne 10 div0> 5. you need to show the current date. ${5 + 3 It 6} 4. -1)) } Correct Answer: D QUESTION 7 Given a header in an HI IP request: X-Retries: 4 A Which two retrieve the value of the header from a given HttpServletRequest req uest? (Choose two) A.utilDa te CurrentDate() Name : curData. B. ${d:dateString(affWeek(curDate().util.4200}.getHeaders{"X-Retries"). signature: java. C.get(0) Correct Answer: AB QUESTION 8 Given an HttpServletRequestrequest and HttpResponseresponse. and the date of th e next week. ${10 div 0} What is the result? A. signature: java. G. signature: java. B. . the date of the previous week. C.setAttribute("foo".420. D.getRequestHeader("X-Retries") request. which sets a cookie "username" with the value "joe" in a servlet? . E. -1)) } ${d:dateString [addWeek[curDate[]. B.util. true true false true false true 0 true true Infinity false true Infinity An exception is thrown Compilation or translation fails Correct Answer: E QUESTION 6 You are building a web application with a scheduling component.get(0) request. int) Name: dateString.util.QUESTION 5 Given: 1. 2.

addCookie("username". C. D.init ServletContextListener. D.addCookie(new Cookie("username". B. "joe")) response. G.oncomplete Servlet. "joe") request. AsyncListner. "joe")) Correct Answer: F QUESTION 9 Which annotation enables a servlet to efficiently process requests of typo multi part/form-data that involve large files being uploaded by the client? A.A.addHeader(new Cookie("username". B. "joe") request.Dynamic can be used to configure (Choose two) A. C. D. B. C. "joe")) request. E. Filter mappings add init params set asyncSupported to true add Listeners Correct Answer: AB QUESTION 12 A web application wants to register a new servlet at runtime using one of the se rvletContext. B. "joe") response. D. F.addCookie("username".contextInitialize ServletrequestListener. Any time C.addServlet methods.addHeader(new Cookie("username". request. C. @AcceptMultipart @MultiPartConfig @MultiPartFormData @WebServlet (multipart = true) Correct Answer: B QUESTION 10 APIs for dynamically registering servlets and filters can be called at: A. Context destruction time E.contextInitialize Correct Answer: C QUESTION 13 You want to create a filter for your web application and your filter will implem . Context initialization time B. "joe")) response.addCookie(new Cookie("username". There is no way to dynamically register servlets and filters D. Injected into a servlet context Correct Answer: A QUESTION 11 ServletRegistration.setCookie("username". In the implementation of which method is it leg al to perform this operation? A.

servlet. Dispatcher view = request.do .do?orderID = %d&jspURl = %s". jspURL). Which code snippet in the Front Controller servlet dispatches the request to the order retrieval servlet? A. jspURL).do"). response) . orderIS). Your filter class must implement an init method and a destroy method. = context.forwardRequest (request. String T= "/WEB INF / retrieveOrder.getRequestDispathcher ("/WEB INF / retrieveOrder. Several of these views require further database processing to retrieve the necessary order object using the or derID request parameter. It handles the database calls to retrieve a nd build the complex order objects and then it dispatches to the jspURL. To do this additional processing. you pass the request first to a servlet that is mapped to the URL pattern /WEB INF / retrieveOrder. Your filter class must implement a doFilter method that takes.Filterchain can invoke either another filter or a servlet. request.format (T. B. D. in the deployment descriptor.format (T. response) .getDispatcher (". it should pass the same arguments it received in its doFilter method.WEB INF / retrieveOrder.forwardRequest (re quest. = context.forward (request. Your filter class must also implement javax.do"). response) B. ordered.do?orderID = %d&jspURl = %s". jspURL). jspURL). request. among other th ings.Filter. C. String url = String.setAttribute ("orderID". Which two statements are true? (Choose two) A. ordered. the o rdered and the jspID and the jspURL. . String T= "/WEB INF / retrieveOrder. response).forward(re quest. an HttpServletRequest object and an HttpServletresponse object. E. orderIS). reques. reques.getRequestDispatcher (url). = context. view. String url = String. Correct Answer: AD QUESTION 14 You have a simple wpb application that has a single Front Controller servlet tha t dispatches to JSPs generate a variety of views.setAttribute ("orderID". C. View.setAttribute("jspURL". View.FilterChain.ent .getRequestDispatcher (url).sarvlat. The method that your filter invokes on the object it received that implements javax servlet. D.setAttribute("jspURL". When your filter chains to the next filter. This servlet takes two request parameters. View.