Saturday, 17 December 2011

SCWCD Questions 171 - 180


Which two security mechanisms can be directed through a sub-element of the <user-dataconstraint>
element in a web application deployment descriptor? (Choose two.)
A. authorization
B. data integrity
C. confidentiality
D. authentication

Answer: B,C


You are developing several tag libraries that will be sold for development of third-party web
applications. You are about to publish the first three libraries as JAR files: container-tags.jar,
advanced-html-form-tags.jar, and basic-html-form-tags.jar. Which two techniques are appropriate
for packaging the TLD files for these tag libraries? (Choose two.)
A. The TLD must be located within the WEB-INF directory of the JAR file.
B. The TLD must be located within the META-INF directory of the JAR file.
C. The TLD must be located within the META-INF/tld/ directory of the JAR file.
D. The TLD must be located within a subdirectory of WEB-INF directory of the JAR file.
E. The TLD must be located within a subdirectory of META-INF directory of the JAR file.
F. The TLD must be located within a subdirectory of META-INF/tld/ directory of the JAR file.

Answer: B,E

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 />
E. <prefix:myTag>
<jsp:attribute ${"foo", "bar", "baz"} />
F. <prefix:myTag>
<jsp:attribute a="foo" b="bar" c="baz"/>
G. <prefix:myTag>
<jsp:attribute name="a">foo</jsp:attribute>
<jsp:attribute name="b">bar</jsp:attribute>
<jsp:attribute name="c">baz</jsp:attribute>

Answer: A,G


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' />
E. <c:set target='${order}' property='shipAddress'>
<jsp:getProperty name='client' property='homeAddress' />
F. <c:setProperty name='${order}' property='shipAddress'>
<jsp:getProperty name='client' property='homeAddress' />

Answer: B,E


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


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.
C. <forum:message from="My Name" subject="${param.subject}">
D. <forum:message from="My Name" subject="My Subject">
<%= request.getParameter( "body" ) %>
E. <forum:message from="My Name"
subject="<%= request.getParameter( "subject" ) %>">
My message body.

Answer: D


Which JSTL code snippet can be used to import content from another web resource?
A. <c:import url="foo.jsp"/>
B. <c:import page="foo.jsp"/>
C. <c:include url="foo.jsp"/>
D. <c:include page="foo.jsp"/>
E. Importing cannot be done in JSTL. A standard action must be used instead.

Answer: A


Click the Exhibit button.
Assume the tag library in the exhibit is placed in a web application in the path /WEBINF/
2. <ex:hello />
Which JSP code, inserted at line 1, completes the JSP code to invoke the hello tag?

A. <%@ taglib prefix="ex" uri="/WEB-INF/tld" %>
B. <%@ taglib uri="/WEB-INF/tld/example.tld" %>
C. <%@ taglib prefix="ex"
uri="http://localhost:8080/tld/example.tld" %>
D. <%@ taglib prefix="ex"
uri="" %>

Answer: D


Which JSTL code snippet produces the output "big number" when X is greater than 42, but
outputs "small number" in all other cases?
A. <c:if test='<%= (X > 42) %>'>
<c:then>big number</c:then>
<c:else>small number</c:else>
B. <c:if>
<c:then test='<%= (X > 42) %>'>big number</c:then>
<c:else>small number</c:else>
C. <c:choose test='<%= (X > 42) %>'>
<c:then>big number</c:when>
<c:else>small number</c:otherwise>
D. <c:choose test='<%= (X > 42) %>'>
<c:when>big number</c:when>
<c:otherwise>small number</c:otherwise>
E. <c:choose>
<c:when test='<%= (X > 42) %>'>big number</c:when>
<c:otherwise>small number</c:otherwise>

Answer: E


A developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated
in a thread-safe manner. Which two can support this design goal? (Choose two.)
A. Store the data in a local variable.
B. Store the data in an instance variable.
C. Store the data in the HttpSession object.
D. Store the data in the ServletContext object.
E. Store the data in the ServletRequest object.

Answer: A,E

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...