Friday 16 December 2011

SCWCD Questions 61- 70


QUESTION NO: 61


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

Answer: A


QUESTION NO: 62


Given an HttpSession session, a ServletRequest request, and a ServletContext context, which
retrieves a URL to /WEB-INF/myconfig.xml within a web application?
A. session.getResource("/WEB-INF/myconfig.xml")
B. request.getResource("/WEB-INF/myconfig.xml")
C. context.getResource("/WEB-INF/myconfig.xml")
D. getClass().getResource("/WEB-INF/myconfig.xml")

Answer: C


QUESTION NO: 63


Your company has a corporate policy that prohibits storing a customer's credit card number in any
corporate database. However, users have complained that they do NOT want to re-enter their
credit card number for each transaction. Your management has decided to use client-side cookies
to record the user's credit card number for 120 days. Furthermore, they also want to protect this
information during transit from the web browser to the web container; so the cookie must only be
transmitted over HTTPS.
Which code snippet creates the "creditCard" cookie and adds it to the out going response to be
stored on the user's web browser?
A. 10. Cookie c = new Cookie("creditCard", usersCard);
11. c.setSecure(true);
12. c.setAge(10368000);
13. response.addCookie(c);
B. 10. Cookie c = new Cookie("creditCard", usersCard);
11. c.setHttps(true);
12. c.setMaxAge(10368000);
13. response.setCookie(c);
C. 10. Cookie c = new Cookie("creditCard", usersCard);
11. c.setSecure(true);
12. c.setMaxAge(10368000);
13. response.addCookie(c);
D. 10. Cookie c = new Cookie("creditCard", usersCard);
11. c.setHttps(true);
12. c.setAge(10368000);
13. response.addCookie(c);
E. 10. Cookie c = new Cookie("creditCard", usersCard);
11. c.setSecure(true);
12. c.setAge(10368000);
13. response.setCookie(c);

Answer: C


QUESTION NO: 64


Given a header in an HTTP request:
X-Retries: 4
Which two retrieve the value of the header from a given HttpServletRequest request? (Choose
two.)
A. request.getHeader("X-Retries")
B. request.getIntHeader("X-Retries")
C. request.getRequestHeader("X-Retries")
D. request.getHeaders("X-Retries").get(0)
E. request.getRequestHeaders("X-Retries").get(0)

Answer: A,B


QUESTION NO: 65


For a given ServletResponse response, which two retrieve an object for writing text data? (Choose
two.)
A. response.getWriter()
B. response.getOutputStream()
C. response.getOutputWriter()
D. response.getWriter().getOutputStream()
E. response.getWriter(Writer.OUTPUT_TEXT)

Answer: A,B


QUESTION NO: 66


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>

Answer: C


QUESTION NO: 67 DRAG DROP


Click the Task button.
A servlet context listener loads a list of com.example.Product objects from a database and stores
that list into the catalog attribute of the ServletContext object.
Place code snippets to construct a jsp:useBean standard action to access this catalog.

Answer:



QUESTION NO: 68


A session-scoped attribute is stored by a servlet, and then that servlet forwards to a JSP page.
Which three jsp:useBean attributes must be used to access this attribute in the JSP page?
(Choose three.)
A. id
B. name
C. bean
D. type
E. scope
F. beanName

Answer: A,D,E


QUESTION NO: 69


You need to create a JavaBean object that is used only within the current JSP page. It must NOT
be accessible to any other page including those that this page might import. Which JSP standard
action can accomplish this goal?
A. <jsp:useBean id='pageBean' type='com.example.MyBean' />
B. <jsp:useBean id='pageBean' class='com.example.MyBean' />
C. <jsp:makeBean id='pageBean' type='com.example.MyBean' />
D. <jsp:makeBean id='pageBean' class='com.example.MyBean' />
E. <jsp:useBean name='pageBean' class='com.example.MyBean' />
F. <jsp:makeBean name='pageBean' class='com.example.MyBean' />

Answer: B


QUESTION NO: 70


Given an HttpServletRequest request and HttpServletResponse response, 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"))

Answer: F

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...