[Free] 2018(Jan) EnsurePass Examcollection Oracle 1z0-899 Dumps with VCE and PDF Download 61-70

EnsurePass 2018 Jan Oracle Official New Released 1z0-899
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-899.html

Java EE 6 Web Component Developer Certified Expert Exam

Question No: 61

A servlet wishes to indicate that it is unable to initialize at the present time, but that the initialization might succeed at some future time. Which is true?

  1. This cannot be expressed. A servlet either initializes correctly or fails.

  2. This expression is not necessary. If a servlet fails to initialize, the container will try again later each time a request is received that attempts to invoke that servlet.

  3. The servlet should delay until it is ready to complete initialization successfully.

  4. The servlet should throw an UnavailableException

  5. The servlet should throw a servletException

Answer: E

Question No: 62

A web application for business expense reporting allows uploading expense receipts. Multiple receipts can be uploaded single step using one HTTP request. The servlet that processes the request has been marked with the @MultipartConfig annotation.

Which method should the servlet use to access the uploaded files?

  1. HttpServletRequest.getParts()

  2. HttpServletRequest.getData()

  3. servletRequest.getParts()

  4. servletRequest.getAllParts()

Answer: A

Explanation: The request.getParts() method returns collections of all Part objects. If you have more than one input of type file, multiple Part objects are returned. Since Part objects are named, the getPart(String name) method can be used to access a particular Part.

Alternatively, the getParts() method, which returns an Iterablelt;Partgt;, can be used to get an Iterator over all the Part objects.

Question No: 63

When using the @WebListener annotation, the class on which the annotation is applied to must also implement at least one o the following interfaces – (Choose two):

  1. RequestListener

  2. AttributeListener

  3. ServletContextListener

  4. HttpSessionListener

  5. SessionAttributeListener

  6. AsyncListener

Answer: C,D

Explanation: @WebListener

The main task of the listener is to listen the particular events and process your own task on that event. For example, if you want to initialize a database connection before your application starts, ServletContextListener will be implemented to do that. Another good example is -when you want to do some task on the creation and destruction of a session. For this purpose you need to implement HttpSessionListener.

Question No: 64

View the Exhibit.

Ensurepass 2018 PDF and VCE

Given the web application deployment descriptor elements:

  1. lt;filtergt;

  2. lt;filter-namegt;ParamAdderlt;/filter-namegt;

  3. lt;filter-classgt;com.example.ParamAdderlt;/filter-classgt;

  4. lt;/filtergt;

  1. lt;filter-mappinggt;

  2. lt;filter-namegt;ParamAdderlt;/filter-namegt;

  3. lt;servlet-namegt;Destinationlt;/servlet-namegt;

  4. lt;/filter-mappinggt;

  1. lt;servlet-mappinggt;

  2. lt;servlet-namegt;Destinationlt;/servlet-namegt;

  3. lt;url-patterngt;/dest/Destinationlt;/url-patterngt;

  4. lt;/servlet-mappinggt;

What is the result of a client request of the Source servlet with no query string?

  1. The output “filterAdded = null” is written to the response stream.

  2. The output “filterAdded = addedByFilter” is written to the response stream.

  3. An exception is thrown at runtime within the service method of the Source servlet.

  4. An exception is thrown at runtime within the service method of the Destination servlet.

Answer: A

Question No: 65

Assume a JavaBean com.example.GradedTestBean exists and has two attributes. The attribute name of type java.lang.string and the attribute score is of type jave.lang.Integer.

An array of com.example.GradedTestBean objects is exposed to the page in a request- scoped attribute called results. Additionally, an empty java.util.HashMap called resultMap is placed in the page scope.

A JSP page needs to add the first entry in results to resultMap, storing the name attribute of the bean as the key and the score attribute of the bean as the value.

Which code snippet of JSTL code satisfies this requirement?

  1. ${resultMap[results[0].name] = results[0].score}

  2. lt;c:set var=”${resultMap}” key=”{results[0].name}” value=”${results[0].score}” /gt;

  3. lt;c:set var=”resultMap” property=”${results[0].name}”gt;

    ${results[0].value}

    lt;/c:setgt;

  4. lt;c:set var=”resultMap” property=”${results[0].name}”gt; value=”${results[0].score}” /gt;

  5. lt;c:set target=”${resultMap}” property=”${results[0].name}”gt; value=”${results[0].score}” /gt;

Answer: E

Question No: 66

A servlet class is injected with a JDBC data source. After injection has occurred, the servlet needs to create a cache out of some of the data in the database, so as to improve responsiveness.

Which two methods can host the cache creation code? (Choose two)

  1. Servlet.init()

  2. Servlet.destroy()

  3. A method annotated with @Init

  4. A method annotated with @PostConstruct

  5. A method annotated with @PreDestroy

  6. A method annotated with @Resource

Answer: A,D

Explanation: A: Because the Servlet init() method is invoked when the servlet instance is loaded, it is the perfect location to carry out expensive operations that need only be performed during initialization. By definition, the init() method is thread-safe. The results of operations in the HttpServlet.init() method can be cached safely in servlet instance variables, which become read-only in the servlet service method.

D: Example:

@PostConstruct private void init() {

cached = (Cached) ctx.lookup(EJB_PATH Cached.class.getSimpleName());

Question No: 67

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 web- container initializes the servlet. How should this be handled?

  1. Retry the connection until it is successful, then allow the init() method to complete.

  2. Throw a ServletException

  3. Throw the IOException

  4. Throw an UnavailableException

Answer: D

Reference: http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets6.html

Question No: 68

Given this fragment in a servlet:

  1. if(reg.isUserInRole(“Admin”)) {

  2. // do stuff

25. }

And the following fragment from the related Java EE deployment descriptor: 812. lt;security-role-refgt;

813. lt;role-namegt;Adminlt;/role-namegt;

814. lt;role-linkgt;Administratorlt;/role-linkgt;

815. lt;/security-role-refgt;

900. lt;security-rolegt;

901. lt;role-namegt;Adminlt;/role-namegt;

902. lt;role-namegt;Administratorlt;/role-namegt;

903. lt;/security-rolegt; What is the result?

  1. Line 24 can never be reached.

  2. The deployment descriptor is NOT valid.

  3. If line 24 executes, the user’s role will be Admin.

  4. If line 24 executes, the user’s role will be Administrator.

  5. If line 24 executes, the user’s role will NOT be predictable.

Answer: D

Question No: 69

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:

Ensurepass 2018 PDF and VCE

The following are some code snippets:

Ensurepass 2018 PDF and VCE

When one access “/” of the above web application, which filters will be executed?

  1. No filters will be executed.

  2. MyFilter1

  3. MyFilter2

  4. MyFilter1 and MyFilter2

Answer: C Explanation: Note:

  • lt;filter-mappinggt;

  • This tag specifies a filter name, and either a URL mapping or servlet name, for a filter that has been defined with the lt;filtergt; tag.

    Multiple lt;filter-mappinggt; tags can be specified for a single lt;filtergt;, providing different URL patterns. See the lt;url-patterngt; tag for examples.

    The lt;filter-mappinggt; has two required elements:

    lt;filter-namegt; – the filter name, as specified in the lt;filter-namegt; element of the lt;filtergt; tag Either a lt;url-patterngt; or a lt;servlet-namegt;.

    If a servlet name is specified, the filter will be called whenever the specific servlet is called.

    Question No: 70

    Which is a benefit of precompiling a JSP page?

    1. It avoids initialization on the first request.

    2. It provides the ability to debug runtime errors in the application.

    3. It provides better performance on the first request for the JSP page.

    4. It avoids execution of the _jspService method on the first request.

    Answer: C

    100% Free Download!
    Download Free Demo:1z0-899 Demo PDF
    100% Pass Guaranteed!
    Download 2018 EnsurePass 1z0-899 Full Exam PDF and VCE

    EnsurePass ExamCollection Testking
    Lowest Price Guarantee Yes No No
    Up-to-Dated Yes No No
    Real Questions Yes No No
    Explanation Yes No No
    PDF VCE Yes No No
    Free VCE Simulator Yes No No
    Instant Download Yes No No

    2018 EnsurePass IT Certification PDF and VCE