1Z0-899 | Down to date Oracle 1Z0-899 dumps


Q1. Which EL expression evaluates to the request URI? 

A. ${requestURI} 

B. ${request.URI} 

C. ${request.getURI} 

D. ${request.requestURI} 

E. ${requestScope.requestURI} 

F. ${pageContext.request.requestURI} 

G. ${requestScope.request.requestDRI} 

Answer:

Q2. You want to create a filter for your web application and your filter will implement 

.servlet.Filter. 

Which two statements are true? (Choose two) 

A. Your filter class must implement an init method and a destroy method. 

B. Your filter class must also implement javax.sarvlat.FilterChain. 

C. When your filter chains to the next filter, it should pass the same arguments it received in its doFilter method. 

D. The method that your filter invokes on the object it received that implements javax – servlet.Filterchain can invoke either another filter or a servlet. 

E. Your filter class must implement a doFilter method that takes, among other things, an HttpServletRequest object and an HttpServletresponse object. 

Answer: AD

Q3. Given the portion of a valid Java EE web application’s directory structure: 

You want to know whether File1.html, File2.html, and/or File3.html is protected from direct access by your web client’s browsers. What statement is true? 

A. All three files are directly accessible. 

B. Only File1.html is directly accessible. 

C. Only File2.html is directly accessible. 

D. Only File3.html is directly accessible. 

E. Only File1.html and File2.html are directly accessible. 

F. Only File1.html and File3.html are directly accessible. 

G. Only File2.html and File3.html are directly accessible. 

Answer:

Q4. 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. 

Answer:

Q5. Your web application uses a simple architecture in which servlets handle requests and then forward to a JSP using a request dispatcher. You need to pass information calculated in the servlet to the JSP for view generation. This information must NOT be accessible to any other servlet, JSP or session in the webapp. Which two techniques can you use to accomplish this goal? (Choose two) 

A. Add attributes to the session object. 

B. Add attributes on the request object. 

C. Add parameters on the request object. 

D. Use the pageContext object to add request attributes. 

E. Add parameters to the JSP’s URL when generating the request dispatcher. 

Answer: BE 

Q6. 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) 

Answer:

Q7. 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) 

public class testServlet {} 

Answer: D

Q8.  

String sessionID = request.getParameter("sessionID"); 

Q9. 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 

Answer:

Q10. A method call inside your servlet has thrown an IOException resulting from a lost network connection to a necessary resource. The servlet has determined that it will be unable to operate successfully fen few minutes, but expects to be able to resume operation after that period. How should this situation handled? 

A. The servlet should re-throw the exception to the web container. 

B. The servlet should throw a servletException to the web container. 

C. The servlet should throw an unavailableException to the web container. 

D. The servlet should redirect to an error page that reports the exception message. 

E. The servlet should retry the request until the method returns successfully. 

Answer: