SCWCD 5 Free Mock Exam

Question 1 of 14 [Building a Custom Tag Library]
You are assigned to configure collection of custom tags for EPractize Labs Online Skill Evaluation Lab. Your colleague Joe developed custom tags for handling UTF-8 characters display in test and question management screens. Joe already saved this TLD file in /WEB-INF named eplIntTags.xml. Your developers must refer to these tags in JSPs using the symbolic name: eplIntTags.
Which of the following deployment descriptor element must you use to make this link between the symbolic name and the TLD file name?
Choice 1 <taglib>
<taglib-uri>eplIntTags</taglib-uri>
<taglib-location>/WEB-INF/eplIntTags.xml</taglib-location>
</taglib>
Choice 2 <taglib>
<taglib-name>eplIntTags</taglib-name>
<taglib-location>/WEB-INF/eplIntTags.xml</taglib-location>
</taglib>
Choice 3 <taglib>
<symbolic-name>eplIntTags</symbolic-name>
<taglib-location>/WEB-INF/eplIntTags.xml</taglib-location>
</taglib>
Choice 4 <taglib>
<name>eplIntTags</name>
<taglib-location>/WEB-INF/eplIntTags.xml</taglib-location>
</taglib>
Question 2 of 14 [Building a Custom Tag Library]
You are building a web application that requires significant internationalization requirements. You have been tasked to create a custom tag that generates a message using the java.text.MessageFormat class.
The tag will take the messageKey attribute and a variable number of argument attributes with the format, arg.

Here is an example use of this tag and its output:
<tag:message messageKey='welcome' arg0='Brian' arg1='Christopher' />

Output : Welcome Brian Christopher !
Which Simple tag class definition accomplishes this goal of handling a variable number of tag attributes?
Choice 1 public class I18Tag extends SimpleTagSupport
implements VariableAttributes {
private Map attributes = new HashMap();
public void setVariableAttribute(String uri,
String name, Object value) {
this.attributes.put(name, value);
}
// more tag handler methods
}
Choice 2 public classI18Tag extends SimpleTagSupport
implements DynamicAttributes {
private Map attributes = new HashMap();
public void setDynamicAttribute(String uri, String name,
Object value) {
this.attributes.put(name, value);
}
// more tag handler methods
}
Choice 3 public class I18Tagextends SimpleTagSupport
implements DynamicAttributes {
private Map attributes = new HashMap();
public void putAttribute(String name, Object value) {
this.attributes.put(name, value);
}
// more tag handler methods
}
Choice 4 public class I18Tagextends SimpleTagSupport
implements VariableAttributes {
private Map attributes = new HashMap();
public void putAttribute(String name, Object value) {
this.attributes.put(name, value);
}
// more tag handler methods
}
Question 3 of 14 [Building JSP Pages Using Tag Libraries]
Code :
Consider the following mapping in the web.xml file.
<taglib>
<taglib-uri>/testTag</taglib-uri>
<taglib-location>/TLD/testTag.tld</taglib-location>
</taglib>
How would you correctly specify the above tag library in your JSP page?
Choice 1 <%@ taglib uri="/testTag" id="t" %>
Choice 2 <%@ taglib uri="/testTag" prefix="t" %>
Choice 3 <%@ taglib name="/testTag" prefix="t" %>
Question 4 of 14 [Building JSP Pages Using Standard Actions]
Code :
package epl;
abstract class OrderBean implements java.io.Serializable {
String orderNumber;
public void setOrderNumber(){ }
public void getOrderNumber(){ }
}
Which of the following jsp:useBean correctly locates or instantiates OrderBean component?
Choice 1 <jsp:useBean id="order" scope="session" class="epl.OrderBean" />
<jsp:getProperty name="order" property="*" />
Choice 2 <jsp:useBean id="order" scope="session" class="epl.OrderBean" >
<jsp:setProperty name="order" property="orderNumber" value="EPL232323" />
</jsp:useBean>
Choice 3 <jsp:useBean id="order" scope="request" class="epl.OrderBean" >
<jsp:setProperty name="order" property="orderNumber" value="EPL232323" />
</jsp:useBean>
Choice 4The class cannot be used as JSP bean
Question 5 of 14 [Building JSP Pages Using the Expression Language (EL)]
You are assigned to re-factor a banking application. The JSP code uses EL like pattern in many places to process XML files. By the time the application was developed the container does not support EL functions.
Which page directive can prevent the EL pattern from being evaluated?
Choice 1<%@ page isELIgnored ='true' %>
Choice 2<%@ page isELIgnored =true %>
Choice 3<%@ page isELIgnored ="false" %>
Choice 4<%@ page isELIgnored ="true" %>
Question 6 of 14 [Building JSP Pages Using the Expression Language (EL)]
You have stored an attribute "order-number" in the request.
Which of the following code access this variable from the requestScope implicit object?
Choice 1${requestScope.order-number}
Choice 2${requestScope["order-number"]}
Choice 3${requestScope("order-number")}
Question 7 of 14 [Java EE Patterns]
A business application uses a number of remote calls to retrieve the data.
Which design pattern can be applied here to reduce the number of remote calls?
Choice 1Front Controller
Choice 2Transfer Object
Choice 3Command
Choice 4DAO
Question 8 of 14 [ Session Management]
Which of the following statements are true about HttpSession isNew method?
Choice 1Returns true if the client does not yet know about the session
Choice 2Returns true if the client chooses not to join the session
Choice 3Returns true if the client knows about the session
Choice 4Returns true if the client chooses to join the session
Question 9 of 14 [The JavaServer Pages (JSP) Technology Model]
You are developing a web application that requires a menu builder java object in all of your JSP pages irrespective of user session. You decided to use JSP implicit scope objects to handle this requirement.
Which of the following statements are true regarding JSP scope objects?
Choice 1The object is most visible inside the session scope.
Choice 2The object is most visible inside the request scope.
Choice 3The object is most visible inside the application scope.
Choice 4The object is least visible inside the page scope.
Choice 5The object is least visible inside the request scope.
Question 10 of 14 [The Servlet Technology Model]
Given the servlets and their path patterns.
Servlet NamePath Pattern
MyBrowserController*.xml
MyMobileController*.mpl
Which of the following request URLs can invoke these servlets?
Choice 1myWebApp/test.xml
Choice 2myWebApp/XML/hello.mpl
Choice 3myWebApp/mpl/hello.mpl
Choice 4myWebApp/test.html
Choice 5myWebApp/XML/hello.do
Question 11 of 14 [The Structure and Deployment of Web Applications]
A web application helper classes can be packaged under WEB-INF/classes or WEB-INF/lib.
When you have a class in both the places, how container load this class?
Choice 1Container will load ClassA from WEB-INF/lib jar file.
Choice 2Container will load ClassA from WEB-INF/classes directory.
Choice 3Container will throw ClassNotFoundException.
Choice 4Container will throw DublicateClassException.
Question 12 of 14 [The Structure and Deployment of Web Applications]
Which of the following statements about the META-INF directory of a WAR file are true?
Choice 1This directory contains the web.xml file.
Choice 2The resource files saved in the directory can be directly served to any Web Clients
Choice 3The HTML files saved in the directory can be directly accessed by any Mobile Clients
Choice 4None of the above
Question 13 of 14 [The Web Container Model]
Given the definition of MyServlet:
11. public class MyServlet extends HttpServlet {
12. public void service(HttpServletRequest request,
13. HttpServletResponse response)
14. throws ServletException, IOException {
15. HttpSession session = request.getSession();
16 session.setAttribute("arg","value");
17. session.invalidate();
18. response.getWriter().println("value=" +
19. session.getAttribute("arg"));
20. }
21. }
What is the result when a request is sent to MyServlet?
Choice 1An IllegalStateException is thrown at runtime.
Choice 2An InvalidSessionException is thrown at runtime.
Choice 3The string "value=null" appears in the response stream.
Choice 4The string "arg=value" appears in the response stream.
Question 14 of 14 [Web Application Security]
Given this fragment in a servlet:
23. if(req.isUserInRole("Manager")) {
24. // do stuff
25. }

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

100. <security-role-ref>
101. <role-name>Manager</role-name>
102. <role-link>Examiner</role-link>
103. </security-role-ref>
104. <security-role>
105. <role-name>Manager</role-name>
106. <role-name>Examiner</role-name>
107. </security-role>
Which of the following statements are true?
Choice 1Line 24 can never be reached.
Choice 2The deployment descriptor is NOT valid.
Choice 3If line 24 executes, the user's role will be Manager.
Choice 4If line 24 executes, the user's role will be Examiner.