Saturday, 17 December 2011

SCWCD Questions 241- 250


QUESTION NO: 241


Which interface must a session attribute implement if it needs to be notified when a web container
persists a session?
A. javax.servlet.http.HttpSessionListener
B. javax.servlet.http.HttpSessionBindingListener
C. javax.servlet.http.HttpSessionAttributeListener
D. javax.servlet.http.HttpSessionActivationListener

Answer: D


QUESTION NO: 242


What is the purpose of session management?
A. To manage the user's login and logout activities.
B. To store information on the client-side between HTTP requests.
C. To store information on the server-side between HTTP requests.
D. To tell the web container to keep the HTTP connection alive so it can make subsequent
requests without the delay of making the TCP connection.

Answer: C


QUESTION NO: 243


You need to store a Java long primitive attribute, called customerOID, into the session scope.
Which two code snippets allow you to insert this value into the session? (Choose two.)
A. long customerOID = 47L;
session.setAttribute("customerOID", new Long(customerOID));
B. long customerOID = 47L;
session.setLongAttribute("customerOID", new Long(customerOID));
C. long customerOID = 47L;
session.setAttribute("customerOID", customerOID);
D. long customerOID = 47L;
session.setNumericAttribute("customerOID", new Long(customerOID));
E. long customerOID = 47L;
session.setLongAttribute("customerOID", customerOID);
F. long customerOID = 47L;
session.setNumericAttribute("customerOID", customerOID);

Answer: A,C


QUESTION NO: 244


Click the Exhibit button.
Assuming the tag library in the exhibit is imported with the prefix forum, which custom tag
invocation produces a translation error in a JSP page?

A. <forum:message from="My Name" subject="My Subject" />
B. <forum:message subject="My Subject">
My message body.
</forum:message>
C. <forum:message from="My Name" subject="${param.subject}">
${param.body}
</forum:message>
D. <forum:message from="My Name" subject="My Subject">
<%= request.getParameter( "body" ) %>
</forum:message>
E. <forum:message from="My Name"
subject="<%= request.getParameter( "subject" ) %>">
My message body.
</forum:message>

Answer: D

QUESTION NO: 245

Given in a single JSP page:
<%@ taglib prefix='java' uri='myTags' %>
<%@ taglib prefix='JAVA' uri='moreTags' %>
Which two are true? (Choose two.)
A. The prefix 'java' is reserved.
B. The URI 'myTags' must be properly mapped to a TLD file by the web container.
C. A translation error occurs because the prefix is considered identical by the web container.
D. For the tag usage <java:tag1/>, the tag1 must be unique in the union of tag names in 'myTags'
and 'moreTags'.

Answer: A,B

QUESTION NO: 246

In a JSP-centric shopping cart application, you need to move a client's home address of the
Customer object into the shipping address of the Order object. The address data is stored in a
value object class called Address with properties for: street address, city, province, country, and
postal code. Which two JSP code snippets can be used to accomplish this goal? (Choose two.)
A. <c:set var='order' property='shipAddress'
value='${client.homeAddress}' />
B. <c:set target='${order}' property='shipAddress'
value='${client.homeAddress}' />
C. <jsp:setProperty name='${order}' property='shipAddress'
value='${client.homeAddress}' />
D. <c:set var='order' property='shipAddress'>
<jsp:getProperty name='client' property='homeAddress' />
</c:store>
E. <c:set target='${order}' property='shipAddress'>
<jsp:getProperty name='client' property='homeAddress' />
</c:set>
F. <c:setProperty name='${order}' property='shipAddress'>
<jsp:getProperty name='client' property='homeAddress' />
</c:setProperty>

Answer: B,E

QUESTION NO: 247

Given that a scoped attribute cart exists only in a user's session, which two, taken independently,
ensure the scoped attribute cart no longer exists? (Choose two.)
A. ${cart = null}
B. <c:remove var="cart" />
C. <c:remove var="${cart}" />
D. <c:remove var="cart" scope="session" />
E. <c:remove scope="session">cart</c:remove>
F. <c:remove var="${cart}" scope="session" />
G. <c:remove scope="session">${cart}</c:remove>

Answer: B,D

QUESTION NO: 248

In which three directories, relative to a web application's root, may a tag library descriptor file
reside when deployed directly into a web application? (Choose three.)
A. /WEB-INF
B. /META-INF
C. /WEB-INF/tlds
D. /META-INF/tlds
E. /WEB-INF/resources
F. /META-INF/resources

Answer: A,C,E

QUESTION NO: 249

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.)
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' />

Answer: B,C

QUESTION NO: 250

A custom tag is defined to take three attributes. Which two correctly invoke the tag within a JSP
page? (Choose two.)
A. <prefix:myTag a="foo" b="bar" c="baz" />
B. <prefix:myTag attributes={"foo","bar","baz"} />
C. <prefix:myTag jsp:attribute a="foo" b="bar" c="baz" />
D. <prefix:myTag>
<jsp:attribute a:foo b:bar c:baz />
</prefix:myTag>
E. <prefix:myTag>
<jsp:attribute ${"foo", "bar", "baz"} />
</prefix:myTag>
F. <prefix:myTag>
<jsp:attribute a="foo" b="bar" c="baz"/>
</prefix:myTag>
G. <prefix:myTag>
<jsp:attribute name="a">foo</jsp:attribute>
<jsp:attribute name="b">bar</jsp:attribute>
<jsp:attribute name="c">baz</jsp:attribute>
</prefix:myTag>

Answer: A,G


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...