SCWCD-8 04/14/2008
 

What is the name of the tag library descriptor element that declares that an
attribute can have a request-time expression as its value?

a [__________________]

Answer:
rtexprvalue

Consider the following HTML page code:
<html><body>
<a href="/servlet/HelloServlet">POST</a>
</body></html>
Which method of HelloServlet will be invoked when the hyperlink displayed
by the above page is clicked?
(Select one)
a doGet
b doPost
c doForm
d doHref
e serviceGet

Answer:
a

Which of the following deployment descriptor snippets correctly associates a servlet
implemented by a class named com.abc.SalesServlet with the name
SalesServlet?
(Select one)
a <servlet>
<servlet-name>com.abc.SalesServlet</servlet-name>
<servlet-class>SalesServlet</servlet-class>
</servlet>
b <servlet>
<servlet-name>SalesServlet</servlet-name>
<servlet-package>com.abc.SalesServlet</servlet-package>
</servlet>
c <servlet>
<servlet-name>SalesServlet</servlet-name>
<servlet-class>com.abc.SalesServlet</servlet-class>
</servlet>
d <servlet name="SalesServlet" class="com.abc.SalesServlet">
<servlet>
<servlet-class name="SalesServlet">
com.abc.SalesServlet
</servlet-class>
</servlet>
e <servlet>
<servlet-name class="com.abc.SalesServlet">
SalesServlet
</servlet-name>
</servlet>

Answer:
c

Consider the contents of the following two JSP files:
File 1: test1.jsp
<html><body>
<% String message = "Hello"; %>
//1 Insert LOC here.
The message is <%= message %>
</body></html>
File 2: test2.jsp
<% message = message + " world!"; %>
Which of the following lines can be inserted at //1 in test1.jsp so that it
prints "The message is Hello world!" when requested?
(Select one)
a <%@ include page="test2.jsp" %>
b <%@ include file="test2.jsp" />
c <jsp:include page="test2.jsp" />
d <jsp:include file="test2.jsp" />

Answer:
b

Which of the following code snippets, when inserted in the doGet() method,
will correctly count the number of GET requests made by a user?
(Select one)
a HttpSession session = request.getSession();
int count = session.getAttribute("count");
session.setAttribute("count", count++);
b HttpSession session = request.getSession();
int count = (int) session.getAttribute("count");
session.setAttribute("count", count++);
c HttpSession session = request.getSession();
int count = ((Integer) session.getAttribute("count")).intValue();
session.setAttribute("count", count++);
d HttpSession session = request.getSession();
int count = ((Integer) session.getAttribute("count")).intValue();
session.setAttribute("count", new Integer(count++));

Answer:
d

What is the term for determining whether a user has access to a particular
resource?
(Select one)
a Authorization
b Authentication
c Confidentiality
d Secrecy

Answer:
a

Which of the following tags can you use to print the value of an expression to the
output stream?
(Select two)
a <%@ %>
b <%! %>
c <% %>
d <%= %>
e <%-- --%>

Answers:
c and d

Which of the following methods will be invoked when a ServletContext is
created?
(Select one)
a contextInstantiated() of javax.servlet.ServletContextListener
b contextInitialized() of javax.servlet.ServletContextListener
c contextInited() of javax.servlet.ServletContextListener
d contextCreated() of javax.servlet.ServletContextListener

Answer:
b

What will be the output of the following code? (Select one)
<html><body>
The value is <%=""%>
</body></html>
a Compilation error
b Runtime error
c The value is
d The value is null

Answer:
c

 


Comments




Leave a Reply

    SCWCD Sets


    Archives

    May 2008
    April 2008