老夫>試卷(2020/03/28)

【阿摩】未分類題庫題庫 下載題庫

-1910 年 - 1z0-899(1-50)#84202 

選擇:50題,非選:0題
立即測驗 
我要補題 回報試卷錯誤
1.1 A web application uses a cookies to track a client as it navigates through the pages that constitutes the application. Which code snippet can be used by the web application to reduce the chance of a cross-site scripting attack by setting some property of the cookie before returning it to the client?
(A) cookie.setHttpOnly(true)
(B) cookie.setMaxAge(3600)
(C) cookie.setPath("/")
(D) cookie.setSecure(true) .

2.2 Which EL expression returns true if no session has been established with current client?
(A) ${not(pageContext.session)}
(B) ${not(requestScope.session)}
(C) ${requestScope.sessions.this}
(D) ${sessionScope.empty} .

3.3 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 the Client send language preference Information to the Server using a standard HTTP facility?
(A) In the request body
(B) In a request header
(C) In the request line
(D) In the request URL .

4.4 During initialization, a servlet finds that the database connection it requires is unavailable. As the system designer, you know that the database start up completes several minutes after the webcontainer initializes the servlet. How should this be handled?
(A) Retry the connection until it is successful, then allow the init() method to complete.
(B) Throw a ServletException
(C) Throw the IOException
(D) Throw an UnavailableException .

5.重新載圖

5 Given a war file with the following structure 5e7f1655bca61.jpg 

where wf.jar contains a valid web-fragment.xml and the class MyServlet.class. 
The following is a snippet of web.xml  5e7f16adcf21b.jpgThe following is a snippet of web-fragment.xml 
5e7f16eee64c0.jpg
The following is code snippet of MyServlet: 
5e7f17070c92d.jpg
What is the value of x inside doGet method of MyServlet?
(A) 1
(B) 0
(C) -1
(D) -2
(E) -3
.


6.6 Which JSP standard action can be used to import content from a resource called foo.jsp?
(A) <jsp:import file='foo.jsp' />
(B) <jsp:import page='foo.jsp' />
(C) <jsp:include page='foo.jsp' />
(D) <jsp:include file='foo.jsp' />
(E) <jsp:import>foo.jsp</jsp:import> (F) <jsp:include>foo.jsp</jsp:include> .

7.7 Which two actions protect a resource file from direct HTTP access within a web application? (Choose two)
(A) placing it in the /secure directory
(B) placing it in the /WEB-INF directory
(C) placing it in the /META-INF/secure directory
(D) creating a <web-resource> element within the deployment descriptor
(E) creating a <secure-resource> element within the deployment descriptor .

8.8 In order to handle time outs and errors in an asynchronous application, a web application must implement which of the following interfaces?
(A) ServletContextListener
(B) ServletContextAttributeListener
(C) HttpSessionListener
(D) AsyncListener
(E) HttpSessionAttributeListener (F) AsyncContextListener .

9.9 Which three are true about the HttpServletRequestWrapper class? (Choose three.)
(A) The HttpServletRequestWrapper is an example of the Decorator pattern.
(B) The HttpServletRequestWrapper can be used to extend the functionality of a servlet request.
(C) A subclass of HttpServletRequestWrapper CANNOT modify the behavior of the getReader method.
(D) An HttpServletRequestWrapper may be used only by a class implement the javax.servlet.Filter interface.
(E) An HttpServletRequestWrapper CANNOT be used on the request passed to the RequestDispatcher.interface. (F) An HttpServletRequestWrapper may modify the header of a request within an object implementing the javax.servlet.Filter interface. .

10.10 Which is a benefit of precompiling a JSP page?
(A) It avoids initialization on the first request.
(B) It provides the ability to debug runtime errors in the application.
(C) It provides better performance on the first request for the JSP page.
(D) It avoids execution of the _jspService method on the first request. .

11.11 Which java code snippet roles "MANAGER" and "EMPLOYEE" in a given application?
(A) @DeclareRoles({ "MANAGER", "EMPLOYEE" })public class MyServlet extends HttpServlet {}
(B) @SecurityRoles({ "MANAGER", "EMPLOYEE" })public class MyServlet extends HttpServlet {}
(C) @DeclareRoles("MANAGER")@DeclareRoles("EMPLOYEE")public class MyServlet extends HttpServlet {}
(D) @DeclareRole("MANAGER")@DeclareRole("EMPLOYEE")public class MyServlet extends HttpServlet {} .

12.12 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) GET
(B) PUT
(C) POST
(D) SEND
(E) FORM
.

13.13 Given the element from the web application deployment descriptor: <jsp - property - group> <url - pattern>/main/page1.jsp</url - pattern> <scripting - invalid>true</scripting - invalid> </jsp-property-group> And given that /main/page1.jsp contains: <% int i = 12; %> <b> <%= i %> </b> What is the result?
(A) <b> <b>
(B) <b> l2 </b>
(C) The JSP fails to execute.
(D) <% int i = 12 %><b> <%= i % > < b> .

14.14 A Client wants to find out the size of an image file for which it has a URL, without downloading any of the bytes that comprise the image right away. Which HTTP method should it use?
(A) GET
(B) PUT
(C) HEAD
(D) DELETE .

15.15 You are building a dating web site. The client's date of birth is collected along with lots of other information. The Person class has a derived method, getAge() :int, which returns the person's age calculated from the date of birth and today's date. In one of your JSPs you need to print a special message to clients within the age group of 25 through 35. Which two EL code snippets will return true for this condition? (Choose two.)
(A) ${client.age in [25,35]}
(B) ${client.age between [25,35]}
(C) ${client.age between 25,35}
(D) ${client.age <= 35 && client.age >= 25}
(E) ${client.age le 35 and client.age ge 25} (F) ${client.age > 35 && client.age < 25} .

16.16 Given the definition of Myobject and that an instance of Myobject is bound as a session attribute: 8. package com.example; IT Certification Guaranteed, The Easy Way! 6 9. public class Myobject implements 10. javax.servlet.http.HttpSessionBindingListener { 11. // class body code here 12. } Which is true?
(A) Only a single instance of Myobject may exist within a session
(B) The unbound method of the Myobject instance is called when the session to which it is bound times out
(C) The com.example.MyObject must be declared as a servlet event listener in the web application deployment descriptor
(D) The valueUnbound method of the Myobject instance is called when the session to which it is bound times out .

17.17 Given an HttpServletRequestrequest and HttpResponseresponse, which sets a cookie "username" with the value "joe" in a servlet?
(A) request.addCookie("username", "joe")
(B) request.setCookie("username", "joe")
(C) response.addCookie("username", "joe")
(D) request.addHeader(new Cookie("username", "joe"))
(E) request.addCookie(new Cookie("username", "joe")) (F). response.addCookie(new Cookie("username", "joe")) G. response.addHeader(new Cookie("username", "joe")) .

18.18 ServletRegistration.Dynamic can be used to configure (Choose two)
(A) Filter mappings
(B) add init params
(C) set asyncSupported to true
(D) add Listeners .

19.19 A developer chooses to avoid using singieThreadModel but wants to ensure that data If; updated in a thread safe manner. Which two can support this design goal? (Choose two)
(A) Store the data in a local variable.
(B) Store the data in an instance variable.
(C) Store the data in the Httpsession object.
(D) Store the data in the sarvletContext object.
(E) Store the data in the ServletRequest object. .

20.重新載圖20 View the exhibit. 
5e7f17447bf86.jpg
 Assuming the tag library in the exhibit is imported with the prefix stock, which custom tag Invocation outputs the contents of the variable exposed by the quote tag?
(A) ${var}<stock:quote symbol= "SUNW" />
(B) <stock:quote symbol= "SUNW">$ {var}</stock:quote>
(C) <stock:quote symbol= "SUNW" var= "quote" />$ {quote}
(D) <stock:quote symbol= "SUNW" var= "quote"><%= quote %></stock:quote>
.


21.21 Which Java expression can be used to check whether the web container is currently configured to track sessions via URL rewriting?
(A) servletContext.getSessionCookiesConfiq() .isHttpOnly()
(B) servletContext.getSessionCookiesConfiq() .isSecure()
(C) servletContext.getDefaultSessionTrackingModes() .contains(SessionTrackingMode.URL)
(D) servletContext.getEffectiveSessionTrackingModes() .contains (SessionTrackingMode.URL) .

22.22 Given an HttpServletRequest request and an httpServletResponse response:
 41. HttpSession session = null; 
 42. / / insert code here
 43. if (session = = null) { 
 44. / / do something if session does not exist 
 45. } else { 
 46. / / do something if session exists 
 47. } To implement the design intent, which statement must be inserted at line 42?
(A) session = response.getSession ();
(B) session = request.getSession ();
(C) session = request.getSession (true);
(D) session = request.getSession (false);
(E) session = request.getSession ("jsessionid");
.

23.重新載圖

23 Your web site has many user-customizable features, for example font and color preferences on web pages. Your IT department has already built a subsystem for user preferences using Java SE's lang.util.prefs package APIs and you have been ordered to reuse this subsystem in your web application. You need to create an event listener that stores the user's Preference object when an HTTP session is created. Also, note that user identification information is stored in an HTTP cookie. Which partial listener class can accomplish this goal? 5e7f179315bf3.jpg 
(A) Option A
(B) Option B
(C) Option C
(D) Option D

.


24.24 Which two are true about the JSTL core iteration custom tags? (Choose two.)
(A) It may iterate over arrays, collections, maps, and strings.
(B) The body of the tag may contain EL code, but not scripting code.
(C) When looping over collections, a loop status object may be used in the tag body.
(D) It may iterate over map, but only the key of the mapping may be used in the tag body.
(E) When looping over integers (for example begin= '1' end= '10'), a loop status object may not be used in the tag body. .

25.25 ServletContextListeners are invoked in
(A) Random order
(B) contextInitialized and contextDestroyed are invoked in the order in which they are declared in the web.xml
(C) contextInitialized method are invoked in the order in which they are declared in the web.xml and the contextDestroyed method is invoked in the reverse order in which they are declared in the web.xml
(D) contextInitialized and contextDestroyed are invoked in the reverse order of which they are declared in the web.xml .

26.重新載圖

26 Given the web application deployment descriptor elements:  5e7f17b106aa8.jpg

Which element, inserted at line 27, causes the ParamAdder filter to be applied when MyServlet is IT Certification Guaranteed, The Easy Way! invoked by another servlet using the RequestDispatcher.include method?
(A) <include/>
(B) <dispatcher>INCLUDE</dispatcher>
(C) <dispatcher>include</dispatcher>
(D) <filter-condition>INCLUDE</filter-condition>
(E) <filter-condition>include</filter-condition>
.


27.27 Given the java code snippet in contextInitialized method of a ServletContextListner: ServletRegistration.Dynamic sr = (ServletRegistration.Dynamic)sc.addServlet ("myServlet", myServletClass); sr.addMapping("/abc"); sr.setServletSecurityElement(servletSecurityElement); sr.addMapping("/def"); Which statement is true?
(A) "/abc" is mapped to "myservlet". The servletSecurityElementy applies to both "/abc" and "/def".
(B) Both "/abc" and "/def" are mapped to "myservlet". The servletSecurityElementy applies to "/abc".
(C) Both "/abc" and "/def" are mapped to "myservlet". The servletSecurityElementy applies to "/def".
(D) Both "/abc" and "/def" are mapped to "myservlet". The servletSecurityElementy applies to both "/abc" and "/def".
(E) Both "/abc" and "/def" are mapped to "myservlet". The servletSecurityElementy applies to "/abc", but the behavior for "/def" is not specified. .

28.28 An application stores session data in a JavaBean object. The object is then stored in the HttpSession object. Which is true?
(A) Synchronization of all bean methods is required to ensure thread safety.
(B) Thread safety is not an issue, since concurrent access to a single session is impossible.
(C) Appropriate protection against problems caused by concurrent access should be provided by the bean.
(D) The servlet should take precautions to ensure that concurrent access to the bean is prevented.
(E) The servlet should implement SingleThreadModel .

29.重新載圖29 Given a war file with the following structure | - WEB-INF/classes/Myservlet.class | - WEB-INF/lib/wf.jaf Where wf.jar contains a valid web-fragment.xml and the following two classes: MyFilter1.class and MyFiler2.class. The web-fragment.xml is as follows:
5e7f17e644e65.jpg
 The following are some code snippets:
  5e7f180109f2e.jpg
When one access "/" of the above web application, which filters will be executed?
(A) No filters will be executed.
(B) MyFilter1
(C) MyFilter2
(D) MyFilter1 and MyFilter2
.


30.30 A Client wants to retrieve a representation of a resource, for example an HTML page, allowing a cached version to be returning by an intermediary such a proxy server. Which HTTP method should it use?
(A) GET
(B) PUT
(C) POST
(D) DELETE .

31.31 Which security mechanism uses the concept of a realm?
(A) authorization
(B) data integrity
(C) confidentiality
(D) authentication .

32.重新載圖32 Given:
5e7f1824542de.jpg Which three EL expressions, inserted at line 16, are valid and evaluate to "d"? (Choose three)
(A) ${map.c}
(B) ${map.[c]}
(C) ${map.["c"]}
(D) ${map.map.b}
(E) ${map.[map.b]} F. ${map. (map.b)}
.


33.33 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) GET
(B) HEAD
(C) OPT IONS
(D) POST .

34.34 You have a simple wpb application that has a single Front Controller servlet that dispatches to JSPs generate a variety of views. Several of these views require further database processing to retrieve the necessary order object using the orderID request parameter. To do this additional processing, you pass the request first to a servlet that is mapped to the URL pattern /WEB - INF / retrieveOrder.do. in the deployment descriptor. This servlet takes two request parameters, the orderID and the jspURL. It handles the database calls to retrieve and build the complex order objects and then it dispatches to the jspURL. Which code snippet in the Front Controller servlet dispatches the request to the order retrieval servlet? IT Certification Guaranteed, The Easy Way!
(A) reques.setAttribute ("orderID", orderID);request.setAttribute("jspURL", jspURL);RequestDispatcher view= context.getRequestDispathcher ("/WEB - INF / retrieveOrder.do");view.forward(request, response)
(B) reques.setParameter ("orderID", orderID);request.setParameter("jspURL", jspURL);Dispatcher view= request.getDispatcher ("/WEB - INF / retrieveOrder.do");View.forwardRequest (request, response);
(C) String T= "/WEB - INF / retrieveOrder.do?orderID = %d&jspURl = %s";String url = String.format (T, orderID, jspURL);RequestDispatcher view = context.getRequestDispatcher (url);View.forward (request, response);
(D) String T= "/WEB - INF / retrieveOrder.do?orderID = %d&jspURl = %s";String url = String.format (T, orderID, jspURL);Dispatcher view= context.getDispatcher (url);View.forwardRequest (request, response); .

35.35 Given: 
 11. <% 
 12. request.setAttribute ("vals", new String[] {"1", "2", "3", "4"}); 
 13. request.setAttribute ("index", "2"); 
 14. %>
 15. <% - - insert code here - - %> Which three EL expressions, inserted at line 15, are valid and evaluate to "3"? (Choose three)
(A) ${vals.2}
(B) ${vals ["2"] }
(C) ${vals.index}
(D) ${vals[index] }
(E) ${vals} [index] (F) ${vals. (vals.index) } (G) ${vals [vals[index-1]] }
.

36.36 When using the @WebListener annotation, the class on which the annotation is applied to must also implement at least one of the following interfaces (Choose two):
(A) RequestListener
(B) AttributeListener
(C) ServletContextListener
(D) HttpSessionListener
(E) SessionAttributeListener (F) AsyncListener .

37.37 The jquery_1_3_2.jar file contains the JQuery Ajax framework in its META-INF/ resources directory. Where should the jar file be placed inside the web application to ensure the resources it contains are accessible by clients?
(A) WEB-INF/classes
(B) WEB-INF/jar
(C) WEB-INF/lib
(D) WEB INF/resources .

38.38 Which java code snippet checks whether the user is of the role "MANAGER" for a given HttpServRequest, httpServletRequest?
(A) httpServletRequest.isUserInRole("MANAGER");
(B) httpServletRequest.isCallerInRole("MANAGER");
(C) httpServletRequest.isPrincipalInRole("MANAGER");
(D) httpServletRequest.isAuthnticatedUserInRole("MANAGER"); .

39.39 You need to create a servlet filter that stores all request headers to a database for all requests to the web application's home page "/index.jsp". Which HttpServletRequest method allows you to retrieve all of the request headers?
(A) String[] getHeaderNames ()
(B) String[] getRequestHeaders ()
(C) java.util.Iterator getHeaderNames ()
(D) java.util.Iterator getRequestHeaders ()
(E) java.util.Enumeration getHeaderNames () F. java.util.Enumeration getRequestHeaders () .

40.40 Which annotation specifies the metadata as a javax.servlet.http.HttpSessionListener?
(A) @Listener
(B) @WebListener
(C) @WebSessionListener
(D) @HttpSessionListener .

41.41 Given an HttpServletRequest request: 
 22. String id = request.getParameter("jsessionid");
 23. // insert code here 
 24. String name = (String) session.getAttribute("name")
 Which three can be placed at line 23 to retrieve an existing HttpSession object? (Choose three)
(A) HttpSession session = request.getSession();
(B) HttpSession session = request.getSession(id);
(C) HttpSession session = request.getSession(true);
(D) HttpSession session = request.getSession(false);
(E) HttpSession session = request.getSession("jsessionid");
.

42.42 You have built a web application that you license to small businesses. The webapp uses a context parameter, called licenseExtension, which enables certain advanced features based on your client's license package. When a client pays for a specific service, you provide them with a license extension key that they insert into the <context-param> of the deployment descriptor. Not every client will have this context parameter so you need to create a context listener to set up a default value in the licenseExtension parameter. Which code snippet will accomplish this goal?
(A) You cannot do this because context parameters CANNOT be altered programmatically.
(B) String ext = context.getParameter('licenseExtension');if ( ext == null ) { context.setParameter('licenseExtension' DEFAULT);}
(C) String ext = context.getAttribute('licenseExtension');if ( ext == null ) { context.setAttribute('licenseExtension' DEFAULT);}
(D) String ext = context.getInitParameter('licenseExtension')if ( ext == null ) { context.resetInitParameter('licenseExtension' DEFAULT);}
(E) String ext = context.getInitParameter('licenseExtension')if ( ext == null ) { context.setInitParameter('licenseExtension' DEFAULT);} .

43.43 You have been contracted to create a web site for a free dating service. One feature is the ability for one client to send a message to another client, which is displayed in the latter client's private page. Your contract explicitly states that security is a high priority. Therefore, you need to prevent cross-site hacking in which one user inserts JavaScript code that is then rendered and invoked when another user views that content. Which two JSTL code snippets will prevent cross-site hacking in the scenario above? (Choose two.) IT Certification Guaranteed, The Easy Way! 17
(A) <c:out>${message}</c:out>
(B) <c:out value= '${message}' />
(C) <c:out value= '${message}' escapeXMl= 'true' />
(D) <c:out eliminateXml= 'true'>${message}</c:out>
(E) <c:out value='${message}' eliminateXml= 'true' /> .

44.44 When using Servlet asynchronous API if you want to dispatch the request back to a particular url - "url" within the same ServletContext which of the following API would you use?
(A) AsyncContext.dispatch();
(B) AsyncContext.dispatch("/url");
(C) AsyncContext.dispatch(servletContext, "/url");
(D) AsyncContext.start(runnable);
(E) RequestDispatcher.forward("/url"); F. RequestDispatcher.forward(servletContext, "/url"); G. RequestDispatcher.include("/url"); .

45.重新載圖

45 Your web page includes a Java SE v1.5 applet with the following declaration: 5e7f185b3f1b4.jpg

Which HTTP method is used to retrieve the applet code?
(A) GET
(B) PUT
(C) POST
(D) RETRIEVE

.


46.46 Which method must be used to encode a URL passed as an argument to HttpServletResponse. sendRedirect when using URL rewriting for session tracking?
(A) ServletResponse.encodeURL
(B) HttpServletResponse.encodeURL
(C) ServletResponse.encodeRedirectURL
(D) HttpServletResponse.encodeRedirectURL .

47.47 A web browser need NOT always perform a complete request for a particular page that it suspects might NOT have changed. The HTTP specification provides a mechanism for the browser to retrieve only a partial response from the web server; this response includes information, such as the Last-Modified date but NOT the body of the page. Which HTTP method will the browser use to retrieve such a partial response? IT Certification Guaranteed, The Easy Way!
(A) GET
(B) ASK
(C) SEND
(D) HEAD
(E) TRACE (F) OPTIONS .

48.重新載圖48 View the Exhibit.
5e7f1879dd55f.jpg Assume the product attribute does NOT yet exist in any scope. Which two create an instance of com.example.Product and initialize the name and price properties to the name and price request parameters? (Choose two)
(A) <jsp:useBean id="product" class="com.example.Product" /><jsp:setProperty name="product" property="*" />
(B) <jsp:useBean id="product" class="com.example.Product" /><% product.setName( request.getParameter( "name" ) ); %><% product.setPrice( request.getParameter( "price" ) ); %>
(C) <jsp:useBean id="product" class="com.example.Product" /><jsp:setProperty name="product" property="name"value="${param.name}" /><jsp:setProperty name="product" property="price"value="${param.price}" /> IT Certification Guaranteed, The Easy Way!
(D) <jsp:useBean id="product" class="com.example.Product"><jsp:setProperty name="product" property="name"value="${name}" /><jsp:setProperty name="product" property="price"value="${price}" /></jsp:useBean>
.


49.重新載圖

49 A web component accesses a local EJB session bean with a component interface of com.example.Account with a home interface of com.example.AccountHome and a JNDI reference of ejb/Account. Which makes the local EJB component accessible to the web components in the web application deployment descriptor? 5e7f18993458f.jpg
(A) Option A
(B) Option B IT Certification Guaranteed, The Easy Way!
(C) Option C
(D) Option D

.


50.50. Servlet A forwarded a request to servlet B using the forward method of RequestDispatcher. What attribute in B's request object contains the URI of the original request received by servlet A?
(A) REQUEST_URI
(B) javax.servlet.forward.request_uri
(C) javax.servlet.forward.REQUEST_URI
(D) javax.servlet.request_dispatcher.request_uri
(E) javax.servlet.request_dispatcher.REQUEST_URI .

懸賞詳解

國三社會下第二次

7.一九三〇年代,某國領導人為解決國內問題,提出1.推動公共建設 2.解決就業問題 3.鼓勵人民消費等「新政」減緩經濟的衝擊,根據判斷,這位領導人...

50 x

前往解題

-1910 年 - 1z0-899(1-50)#84202-阿摩線上測驗

-1910 年 - 1z0-899(1-50)#84202