Upwork JSP 2.0 TEST 2016

Hello Freelancer, Welcome to allupworktestanswers.com Here to get the JSP 2.0 TEST of Latest version 2016. We are ready here to provide your desire upwork test answer. We already tested all exam test information Available include on here. So Dear, Why Late? Read the below full exam test and get more information from our website.



1. If cookies are turned off on the client, which two methods still work with the session ID?
Answers:
  1. response.getSessionId()
  2. encodeRedirectURL()
  3. sessionRedirectURL()
  4. encodeURL()
2. Which two of the following statements are best associated with the HTTPPOST method?
Answers:
  1. This HTTP method is the one most frequently used by browsers
  2. There is no limit on how much data this HTTP method can send
  3. There is a limit on how much data this HTTP method can send
  4. This method is most often used to submit form data
3. Which two statements among the following apply to redirecting a HTTP request to another URL?
Answers:
  1. The path must be absolute
  2. The path must be relative
  3. The redirect method must be called before the response body is committed, otherwise an IllegalStateException is thrown
  4. The path may be relative or absolute
4. Which of the following statements are true regarding the HTTP GET method?
Answers:
  1. There is a limit on how much data this HTTP method can send
  2. There is no limit on how much data this HTTP method can send
  3. This HTTP method is the fastest
  4. This HTTP method is used when you click on an HTML link
5. Which of the following statements are true regarding declaring a servlet instance in a deployment descriptor?
Answers:
  1. The tags are nested within <web-app> tags
  2. The tags do not define parameters
  3. The tags are <servlet-instance></servlet-instance>
  4. It specifies the fully qualified class name of the servlet
6. Which of the following statements are true regarding the structure of a WebArchive file?
Answers:
  1. It has a jar extension
  2. It is a JAR archive of the WebApplication structure
  3. It has a war extension
  4. It is extracted by the container upon the first call to any�servlet it contains
7. With regard to the service() lifecycle method, identify two correct statements about its purpose or about how and when it is invoked.
Answers:
  1. Upon completion it calls the destroy method
  2. It is called whenever the servlet is requested
  3. It is called after the init method is called
  4. It is only called when the servlet is first requested
8. Read the following code snippet and answer the question based upon it:
<taglib>
<taglib-uri>
http://www.yourcompany.com/you TagLibrary
</taglib-uri>
<taglib-location>
/WEB-INF/yourTagLibrary.tld
</taglib-location>
</taglib>
From the statements given below, which one applies to the code snippet?
Answers:
  1. The taglib directive can reference a TLD by name
  2. This tag goes into the WEB-INF/myApplication/web.xml file
  3. This definition is incorrect because the taglib-uri should have been uri
  4. This definition is incorrect because the taglib should have been tag
9. Which method is called by the servlet container just after the servlet is removed from service?
Answers:
  1. public void finalize() {// code…}
  2. public void destroy() {// code…}
  3. public void destroy()throws ServletException {// code…}
  4. public void finalize()throws ServletException {// code…}
10. Which statement is true regarding ServletContext Initialization Parameters in the deployment descriptor?
Answers:
  1. They are accessible by all servlets in a given web application
  2. They are accessible by all servlets in a given session
  3. They are accessible by all servlets in a given HTTP request
  4. They are accessible by all servlets in a given container
11. Which method in the HttpServlet class corresponds to the HTTPPOST method?
Answers:
  1. postHttp
  2. doPost
  3. post
  4. getPost
12. What is the file name of the WebApp deployment descriptor?
Answers:
  1. web.xml
  2. deploy.xml
  3. init.xml
  4. config.xml
13. What is the WebApp deployment descriptor element name for the Servlet Context Initialization Parameters?
Answers:
  1. <context-init-param>
  2. <context-param>
  3. <init-param>
  4. <context-init>
14. With regard to the destroy lifecycle method, identify the correct statements about its purpose or about how and when it is invoked.
Answers:
  1. It gives the servlet an opportunity to clean up resources
  2. Like try-catch, it is called upon an exception
  3. It is rarely used but can be called to remove a servlet from memory
  4. It isn’t called if the server crashes
15. How would you use a bean in a JSP page?
Answers:
  1. <jsp:useBean name=”houseLotBean” scope=”response” class=”session.Realestate”/>
  2. <jsp:useBean id=”houseLotBean” scope=”session”><jsp:useBean>
  3. <jsp:useBean id=”houseLotBean” scope=”session” class=”session.Realestate”/>
  4. <jsp:useBean scope=”session” class=”session.Realestate”/>
16. Which of the following is the name of the cookie used by Servlet Containers to maintain
session information?
Answers:
  1. SESSIONID
  2. SERVLETID
  3. JSESSIONID
  4. CONTAINERID
17. Which design pattern reduces network traffic by acting as a caching proxy of a remote object?
Answers:
  1. DataAccess Object
  2. Model-View-Controller
  3. Value Object
  4. Business Delegate
18. Assuming the tag library is in place and the tag handler is correct, which of the following is the correct way to use a custom tag in a JSP page?
Answers:
  1. <yourLibrary=”whatColorlslt” color=”red”/>
  2. <yourLibrary:whatColorlslt color=”red”/>
  3. <yourLibrary color=”red”/>
  4. <yourLibrary.whatColorlslt color=”red”/>
19. What output will be sent to the browser by the following code snippet?
<!–
Que <%=”Reader”%>
–>
Answers:
  1. ‘Que Reader’ within HTML comment markers
  2. This will cause an error
  3. Que <%=”Reader”%> within HTML comment markers
  4. This is a comment so it is ignored by the container
20. Which of the following are used by Servlet Containers to maintain session information?
Answers:
  1. Cookies
  2. Hidden form fields
  3. HTTPS protocol information
  4. URL rewriting
21. Read the following code snippet:
1 <libraryPrefix:handlerName parameterNAme=”value”>
2 <%=23*counter %>
3 <b>Congratulations!</b>
Which of the following is the correct way to complete the above code snippet?
Answers:
  1. </libraryPrefix:handlerName>
  2. </libraryPrefix:handlerName paremeterName=”value”>
  3. </handlerName>
  4. <libraryPrefix>
22. In which directory do you place any auxiliary JAR files?
Answers:
  1. WEB-INF/servlets
  2. WEB-INF/jar
  3. WEB-INF/classes
  4. WEB-INF/lib
23. Which statements are true regarding ServletContext Init Parameters in the deployment descriptor?
Answers:
  1. They are set at deployment-time, but accessed at run-time
  2. They are accessible from any session within that context
  3. They are not set at deployment-time, but accessed at run-time
  4. They are set at deployment-time and can be updated at run-time
24. With regard to the servlet context listener, which of the following methods is valid?
Answers:
  1. contextListenerEvent
  2. contextListenerInitialized
  3. contextInitialized
  4. contextListenerDestroyed
25. Assuming the servlet method for handling HTTPGET requests is doGet(HttpServletRequest req, HTTPServletResponse res), how do you get a request parameter in that servlet?
Answers:
  1. String value=req.getInitParameter(10);
  2. String value=req.getInitParameter(“product”);
  3. String value=res.getParameter(“product”);
  4. String value=req.getParameter(“product”);
26. Assume the custom tag is GLOOP and the prefix is TWONG. Which of the following is the syntax for an empty custom tag?
Answers:
  1. <TWONG:GLOOP/>
  2. <GLOOP:TWONG/>
  3. <GLOOP:TWONG></GLOOP:TWONG>
  4. <TWONG:GLOOP></TWONG:GLOOP>
27. Which of the following is not a JSP implicit object?
Answers:
  1. out
  2. in
  3. response
  4. page
28. Which of the following is the listener interface for servlet context attributes?
Answers:
  1. ContextAttributeListener
  2. ServletContextAttributeListener
  3. ServletAttributeListener
  4. ServletContextListener
29. What is Template Data?
Answers:
  1. The JSP blueprint or pattern
  2. The plain text (such as HTML) outside JSP tags(non java) in a JSP page
  3. The taglib XML namespace
30. Which of the following options is a valid declaration?
Answers:
  1. <%! String name=”Patricia” %>
  2. <%! String name=”Patricia”; %>
  3. <% String name=”Devyn” %>
  4. <% public String name=”Devyn”; %>
31. Which of following interfaces can make a servlet thread safe?
Answers:
  1. Runnable
  2. synchronization
  3. Servlets can’t be made thread safe
  4. None of the above
32. Which statement is true regarding a servlet context listener?
Answers:
  1. An object that implements a context listener is notified when its request objects are created or destroyed
  2. An object that implements a context listener is notified when its Web App context is created or destroyed
  3. An object that implements a context listener is notified when its Web App deployment descriptor defines it to be notified
  4. An object that implements a context listener is notified when its sessions are created or destroyed
33. Which of the following options is a valid expression?
Answers:
  1. <%! String name=”Patricia” %>
  2. <%! String name=”Patricia”; %>
  3. <%=(new java.util.Date()).toLocaleString() %>
  4. <% public String name=”Devyn”; %>
34. What does the container do with the following code snippet?
<!–#include file=”somefile.html”–>
Answers:
  1. The container passes this line of code through to the client
  2. The container includes this file statically
  3. The container includes this file dynamically
  4. The container will throw an exception
35. Which method in the HttpServlet class corresponds to the HTTPPUT method?
Answers:
  1. put
  2. doPut
  3. httpPut
  4. putHttp
36. Which of the following is a JSP implicit object?
Answers:
  1. objRequest
  2. Request.send
  3. request
  4. servlet
37. Which design pattern is used to decouple presentation from core data access functionality?
Answers:
  1. BusinessDelegate
  2. DataAccess Object
  3. ModelView Controller
  4. Value Object
38. In which directory do you place servlet class files?
Answers:
  1. WEB-INFservlets
  2. webappservlets
  3. WEB-INFclasses
  4. WEB-INF
39. Which design pattern did technical designers of JSP use to provide centralized dispatching of requests via a controller servlet?
Answers:
  1. Model-view-Controller
  2. Facade
  3. Server-Client
  4. Publish-Subscribe
40. Which interface and method name should be used to retrieve HTTP request header information?
Answers:
  1. HttpServletRequest.getHeaderNames
  2. ServletRequest.getNames
  3. ServletRequest.getHeadNames
  4. None of the above
41. Which interface provides access to request scoped attributes?
Answers:
  1. ServletContext
  2. ServletRequest
  3. ServletConfig
  4. None of these
42. Which JSP action retrieves the value of a property from a properly declared JavaBean in a JSP page?
Answers:
  1. jsp:getProperty
  2. jsp:getParameter
  3. jsp:getAtrribute
  4. jsp:getValue
43. Suppose you had a servlet that simply returned an error message because that resource was forbidden to that user. Read the following code snippet:
1.public void service(HttpServletRequestrequest,
2.HttpServletResponseresponse)
3.throws ServletException, IOException
4. {
5.
6. }
What code would you type on line 5 to return an error message to the requesting client?
Answers:
  1. response.sendError(HTTPServletResponse.SC_FORBIDDEN,”Error”);
  2. response.setStatus(HTTPServletResponse.SC_FORBIDDEN,”Error”);
  3. response.sendError(Response.SC_FORBIDDEN,”Error”);
  4. response.setStatus(SC_FORBIDDEN);
44. Which interface and method name should be used to acquire a text stream for the response?
Answers:
  1. ServletResponse.getOutputStream
  2. ServletResponse.getWriterStream
  3. ServletResponse.getTextStream
  4. ServletResponse.getWriter
45. Which among the following objects is the best choice to share information between pages for a single user?
Answers:
  1. application
  2. page
  3. request
  4. session
Finally no more words require about the JSP 2.0 TEST  information in this session of this content. If you are require knowing more, Please ask to us via our contact us form or comment box. Please make sure that, you don’t send Personal information via the Comment box.  Thank you very mutch for being with us

0 comments: