Monday, January 5, 2015

SCWCD Questions And Answers Part 2

Q: 31 Which three are true about TLD files? (Choose three.)

A. The web container recognizes TLD files placed in any subdirectory of WEB-INF.
B. When deployed inside a JAR file, TLD files must be in the META-INF directory, or a subdirectory of it.
C. A tag handler's attribute must be included in the TLD file only if the attribute can accept request-time expressions.
D. The web container can generate an implicit TLD file for a tag library comprised of both simple tag handlers and tag files.
E. The web container can automatically extend the tag library map described in a web.xml file by including entries extracted from the web application's TLD files.

Answer: A, B, E


Q: 32 Your management has required that all JSPs be created to generate XHTML-compliant content and to facilitate that decision, you are required to create all JSPs using the JSP Document format. In the reviewOrder.jspx page, you need to use several core JSTL tags to process the collection of order items in the customer's shopping cart. Which JSP code snippets must you use in the reviewOrder.jspx page?

A. <html xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" /> <!-- page content -->
</html>
B. <html xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" xmlns:c="http://java.sun.com/jsp/jstl/core">
<!-- page content --> </html>
C. <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" /> <!-- page content -->
</jsp:root>
D. <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" xmlns:c="http://java.sun.com/jsp/jstl/core">
<!-- page content --> </jsp:root>

Answer: D


Q: 33 Which two JSTL URL-related tags perform URL rewriting? (Choose two.)

A. url
B. link
C. param
D. import
E. redirect

Answer: A, E


Q: 34 A custom JSP tag must be able to support an arbitrary number of attributes whose names are unknown when the tag class is designed. Which two are true? (Choose two.)

A. The <body-content> element in the echo tag TLD must have the value JSP.
B. The echo tag handler must define the setAttribute(String key, String value) method.
C. The <dynamic-attributes>true</dynamic-attributes> element must appear in the echo tag TLD.
D. The class implementing the echo tag handler must implement the javax.servlet.jsp.tagext.IterationTag interface.
E. The class implementing the echo tag handler must implement the javax.servlet.jsp.tagext.DynamicAttributes interface.

Answer: C, E


Q: 35 A developer has used this code within a servlet:

62. if(request.isUserInRole("vip")) {
63. // VIP-related logic here
64. }

What else must the developer do to ensure that the intended security goal is achieved?

A. create a user called vip in the security realm
B. define a group within the security realm and call it vip
C. define a security-role named vip in the deployment descriptor
D. declare a security-role-ref for vip in the deployment descriptor

Answer: D


Q: 36 Given:

3. class MyServlet extends HttpServlet {
4. public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
5. // servlet code here ...
26. }
27. }


If the DD contains a single security constraint associated with MyServlet and its only <http-method> tags and <auth-constraint> tags are:

<http-method>GET</http-method> <http-method>PUT</http-method> <auth-constraint>Admin</auth-constraint>


Which four requests would be allowed by the container? (Choose four.)

A. A user whose role is Admin can perform a PUT.
B. A user whose role is Admin can perform a GET.
C. A user whose role is Admin can perform a POST.
D. A user whose role is Member can perform a PUT.
E. A user whose role is Member can perform a POST.
F. A user whose role is Member can perform a GET.

Answer: A, B, C, E


Q: 37 What is true about Java EE authentication mechanisms?

A. If your deployment descriptor correctly declares an authentication type of CLIENT_CERT, your users must have a certificate from an official source before they can use your application.
B. If your deployment descriptor correctly declares an authentication type of BASIC, the container automatically requests a user name and password whenever a user starts a new session.
C. If you want your web application to support the widest possible array of browsers, and you want to perform authentication, the best choice of Java EE authentication mechanisms is DIGEST.
D. To use Java EE FORM authentication, you must declare two HTML files in your deployment descriptor, and you must use a predefined action in the HTML file that handles your user's login.

Answer: D


Q: 38 If you want to use the Java EE platform's built-in type of authentication that uses a custom HTML page for authentication, which two statements are true? (Choose two.)

A. Your deployment descriptor will need to contain this tag: <auth-method>CUSTOM</auth-method>
B. The related custom HTML login page must be named loginPage.html.
C. When you use this type of authentication, SSL is turned on automatically.
D. You must have a tag in your deployment descriptor that allows you to point to both a login HTML page and an HTML page for handling any login errors.
E. In the HTML related to authentication for this application, you must use predefined variable names for the variables that store the user and password values.

Answer: D, E


Q: 39 Given this fragment in a servlet:

23. if(req.isUserInRole("Admin")) {
24. // do stuff
25. }

And the following fragment from the related Java EE deployment descriptor:

812. <security-role-ref>
813. <role-name>Admin</role-name>
814. <role-link>Administrator</role-link>
815. </security-role-ref>
900. <security-role>
901. < role-name>Admin</role-name>
902. <role-name>Administrator</role-name>
903. </security-role>

What is the result?

A. Line 24 can never be reached.
B. The deployment descriptor is NOT valid.
C. If line 24 executes, the user's role will be Admin.
D. If line 24 executes, the user's role will be Administrator.
E. If line 24 executes the user's role will NOT be predictable.

Answer: D


Q: 40 Given the security constraint in a DD:

101. <security-constraint>
102. <web-resource-collection>
103. <web-resource-name>Foo</web-resource-name>
104. <url-pattern>/Bar/Baz/*</url-pattern>
105. <http-method>POST</http-method>
106. </web-resource-collection>
107. <auth-constraint>
108. <role-name>DEVELOPER</role-name>
109. </auth-constraint>
110. </security-constraint>


And given that "MANAGER" is a valid role-name, which four are true for this security constraint? (Choose four.)

A. MANAGER can do a GET on resources in the /Bar/Baz directory.
B. MANAGER can do a POST on any resource in the /Bar/Baz directory.
C. MANAGER can do a TRACE on any resource in the /Bar/Baz directory.
D. DEVELOPER can do a GET on resources in the /Bar/Baz directory.
E. DEVELOPER can do only a POST on resources in the /Bar/Baz directory.
F. DEVELOPER can do a TRACE on any resource in the /Bar/Baz directory.
Answer: A, C, D, F


Q: 41 Which three are valid URL mappings to a servlet in a web deployment descriptor? (Choose three.)

A. */*
B. *.do
C. MyServlet
D. /MyServlet
E. /MyServlet/*
F. MyServlet/*.jsp

Answer: B, D, E


Q: 42 Click the Task button.

Place the appropriate element names on the left on the web application deployment descriptor on the right so that files ending in ".mpg" are associated with the MIME type "video/mpeg."


Answer: Check ExamWorx eEngine, Download from Member Center


 Q: 43 Which three web application deployment descriptor elements allow web components to gain references to resources or EJB components? (Choose three.)

A. ejb-ref
B. jdbc-ref
C. servlet-ref
D. resource-ref
E. javamail-ref
F. ejb-remote-ref
G. resource-env-ref

Answer: A, D, G


Q: 44 After a merger with another small business, your company has inherited a legacy WAR file but the original source files were lost. After reading the documentation of that web application, you discover that the WAR file contains a useful tag library that you want to reuse in your own webapp packaged as a WAR file.

What do you need to do to reuse this tag library?

A. Simply rename the legacy WAR file as a JAR file and place it in your webapp's library directory.
B. Unpack the legacy WAR file, move the TLD file to the META-INF directory, repackage the whole thing as a JAR file, and place that JAR file in your webapp's library directory.
C. Unpack the legacy WAR file, move the TLD file to the META-INF directory, move the class files to the top-level directory, repackage the whole thing as a JAR file, and place that JAR file in your webapp's library directory.
D. Unpack the legacy WAR file, move the TLD file to the META-INF directory, move the class files to the top-level directory, repackage the WAR, and place that WAR file in your webapp's WEB-INF directory.

Answer: C


Q: 45 Which two actions protect a resource file from direct HTTP access within a web application? (Choose two.)

A. placing it in the /secure directory
B. placing it in the /WEB-INF directory
C. placing it in the /META-INF/secure directory
D. creating a <web-resource> element within the deployment descriptor
E. creating a <secure-resource> element within the deployment descriptor

Answer: B, C


Q: 46 Given that www.example.com/SCWCDtestApp is a validly deployed Java EE web application and that all of the JSP files specified in the requests below exist in the locations specified. Which two requests, issued from a browser, will return an HTTP 404 error? (Choose two.)

A. http://www.example.com/SCWCDtestApp/test.jsp
B. http://www.example.com/SCWCDtestApp/WEB-INF/test.jsp
C. http://www.example.com/SCWCDtestApp/WEB-WAR/test.jsp
D. http://www.example.com/SCWCDtestApp/Customer/test.jsp
E. http://www.example.com/SCWCDtestApp/META-INF/test.jsp
F. http://www.example.com/SCWCDtestApp/Customer/Update/test.jsp

Answer: B, E


Q: 47 Which two about WAR files are true? (Choose two.)

A. WAR files must be located in the web application library directory.
B. WAR files must contain the web application deployment descriptor.
C. WAR files must be created by using archive tools designed specifically for that purpose.
D. The web container must serve the content of any META-INF directory located in a WAR file.
E. The web container must allow access to resources in JARs in the web application library directory.

Answer: B, E


Q: 48 Given this fragment from a Java EE deployment descriptor:

124. <welcome-file>beta.html</welcome-file>
125. <welcome-file>alpha.html</welcome-file>
And this request from a browser:

http://www.sun.com/SCWCDtestApp/register


Which statement is correct, when the container receives this request?

A. This deployment descriptor is NOT valid.
B. The container first looks in the register directory for beta.html.
C. The container first looks in the register directory for alpha.html.
D. The container first looks for a servlet mapping in the deployment descriptor.

Answer: D


Q: 49 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.requestURI}

Answer: F


Q: 50 Given:

1. <% int[] nums = {42,420,4200};
2. request.setAttribute("foo", nums); %>
3. ${5 + 3 lt 6}
4. ${requestScope['foo'][0] ne 10 div 0}
5. ${10 div 0}


What is the result?

A. true true
B. false true
C. false true 0
D. true true Infinity
E. false true Infinity
F. An exception is thrown.
G. Compilation or translation fails.

Answer: E



Q: 51 You have created a web application that you license to real estate brokers. The webapp is highly customizable including the email address of the broker, which is placed on the footer of each page. This is configured as a context parameter in the deployment descriptor:

10. <context-param>
11. <param-name>footerEmail</param-name>
12. <param-value>joe@estates-r-us.biz</param-value>
13. </context-param>


Which EL code snippet will insert this context parameter into the footer?

A. <a href='mailto:${footerEmail}'>Contact me</a>
B. <a href='mailto:${initParam@footerEmail}'>Contact me</a>
C. <a href='mailto:${initParam.footerEmail}'>Contact me</a>
D. <a href='mailto:${contextParam@footerEmail}'>Contact me</a>
E. <a href='mailto:${contextParam.footerEmail}'>Contact me</a>

Answer: C


Q: 52 Given an EL function foo, in namespace func, that requires a long as a parameter and returns a Map, which two are valid invocations of function foo? (Choose two.)

A. ${func(1)}
B. ${foo:func(4)}
C. ${func:foo(2)}
D. ${foo(5):func}
E. ${func:foo("easy")}
F. ${func:foo("3").name}

Answer: C, F



Q: 53 Click the Exhibit button.

The Appliance class is a Singleton that loads a set of properties into a Map from an external data source. Assume:
An instance of the Appliance class exists in the application-scoped attribute, appl The appliance object includes the name property that maps to the value Cobia The request-scoped attribute, prop, has the value name.

Which two EL code snippets will display the string Cobia? (Choose two.)


A. ${appl.properties.name}
B. ${appl.properties.prop}
C. ${appl.properties[prop]}
D. ${appl.properties[name]}
E. ${appl.getProperties().get(prop)}
F. ${appl.getProperties().get('name')}

Answer: A, C


Q: 54 Squeaky Beans Inc. hired an outside consultant to develop their web application. To finish the job quickly, the consultant created several dozen JSP pages that directly communicate with the database. The Squeaky business team has since purchased a set of business objects to model their system, and the Squeaky developer charged with maintaining the web application must now refactor all the JSPs to work with the new system. Which pattern can the developer use to solve this problem?

A. Transfer Object
B. Service Locator
C. Intercepting Filter
D. Business Delegate

Answer: D


Q: 55 A developer is designing a web application that must verify for each request:
The originating request is from a trusted network.
The client has a valid session.
The client has been authenticated.


Which design pattern provides a solution in this situation?

A. Transfer Object
B. Session Facade
C. Intercepting Filter
D. Template Method
E. Model-View-Controller

Answer: C


Q: 56 The Squeaky Bean company has decided to port their web application to a new J2EE 1.4 container. While reviewing the application, a developer realizes that in multiple places within the current application, nearly duplicate code exists that finds enterprise beans. Which pattern should be used to eliminate this duplicate code?

A. Transfer Object
B. Front Controller
C. Service Locator
D. Intercepting Filter
E. Business Delegate
F. Model-View-Controller

Answer: C


Q: 57 Which two are characteristics of the Transfer Object design pattern? (Choose two.)

A. It reduces network traffic by collapsing multiple remote requests into one.
B. It increases the complexity of the remote interface by removing coarse-grained methods.
C. It increases the complexity of the design due to remote synchronization and version control issues.
D. It increases network performance introducing multiple fine-grained remote requests which return very small amounts of data.

Answer: A, C


Q: 58 A developer has created a special servlet that is responsible for generating XML content that is sent to a data warehousing subsystem. This subsystem uses HTTP to request these large data files, which are compressed by the servlet to save internal network bandwidth. The developer has received a request from management to create several more of these data warehousing servlets. The developer is about to copy and paste the compression code into each new servlet. Which design pattern can consolidate this compression code to be used by all of the data warehousing servlets?

A. Facade
B. View Helper
C. Transfer Object
D. Intercepting Filter
E. Composite Facade

Answer: D


Q: 59 Which two are characteristics of the Service Locator pattern? (Choose two.)

A. It encapsulates component lookup procedures.
B. It increases source code duplication and decreases reuse.
C. It improves client performance by caching context and factory objects.
D. It degrades network performance due to increased access to distributed lookup services.

Answer: A, C


Q: 60 Click the Task button.

Given a servlet mapped to /control, place the correct URI segment returned as a String on the corresponding HttpServletRequest method call for the URI: /myapp/control/processorder.




Answer: Check ExamWorx eEngine, Download from Member Center

2 comments :