Which of the following implicit objects is not available to a JSP page by default?
(Select one)
a application
b session
c exception
d config
Answer: c
Which of the following is a correct way to pass a parameter equivalent to the
query string user=mary at request time to an included component? (Select one)
a <jsp:include page="other.jsp" >
<jsp:param paramName="user" paramValue="mary" />
</jsp:include>
b <jsp:include page="other.jsp" >
<jsp:param name="mary" value="user" />
</jsp:include>
c <jsp:include page="other.jsp" >
<jsp:param value="mary" name="user" />
</jsp:include>
d <jsp:include page="other.jsp" >
<jsp:param param="user" value="mary"/>
</jsp:include>
e <jsp:include page="other.jsp" >
<jsp:param user="mary" />
</jsp:include>
Answer: c
Which of the following variables is not available for use in EL expressions?
a param
b cookie
c header
d pageContext
e contextScope
Answer: e
Which of the following are valid uses of the <jsp:useBean> action? (Select two)
a <jsp:useBean id="address" class="AddressBean" name="address" />
b <jsp:useBean id="address" class="AddressBean"
type="AddressBean" />
c <jsp:useBean id="address" beanName="AddressBean"
class="AddressBean" />
d <jsp:useBean id="address" beanName="AddressBean"
type="AddressBean" />
Answers: b and d
Which of the following is a valid taglib directive? (Select one)
a <% taglib uri="/stats" prefix="stats" %>
b <%@ taglib uri="/stats" prefix="stats" %>
c <%! taglib uri="/stats" prefix="stats" %>
d <%@ taglib name="/stats" prefix="stats" %>
e <%@ taglib name="/stats" value="stats" %>
Answer: b
Consider the following code in a JSP page:
<% String message = "Hello "; %>
<test:world>
How are you?
<% message = message + "World! " %>
</test:world>
<%= message %>
If doStartTag() returns EVAL_BODY_BUFFERED and doAfterBody() clears
the buffer by calling bodyContent.clearBody(), what will be the output of
the above code? (Select one)
a Hello
b Hello How are you?
c Hello How are you? World!
d Hello World!
e How are you World!
Answer: d
Consider the following TLD excerpt:
<body-content>
empty
</body-content>
<attribute>
<name>color</name>
<rtexprvalue>true</rtexprvalue>
</attribute>
<dynamic-attributes>
true
</dynamic-attributes>
If the name of the tag is tagname and its prefix is pre, which of the following JSP
statements is valid?
a <pre:tagname color="yellow" size=${sizenum} />
b <pre:tagname size="18" color="red"> </pre:tagname>
c <pre:tagname color="${colorname}" size="22" font="verdana"></
pre:tagname>
d <pre:tagname color="green" size="30">font="Times New Roman"</
pre:tagname>
e <pre:tagname color="${colorname}" size="18"></pre>
Answer: c
Which of the following are the benefits of using the Transfer Object design pattern?
(Select two)
a It improves the response time for data access.
b It improves the efficiency of object operations.
c It reduces the network traffic.
d It reduces the coupling between the data access module and the database.
Answers: a and c