SCWCD-15 05/13/2008
 

Which of the following lines would initialize the out variable for sending a Microsoft Word file to the browser? (Select one)

a PrintWriter out = response.getServletOutput();

b PrintWriter out = response.getPrintWriter();

c OutputStream out = response.getWriter();

d PrintWriter out = response.getOuputStream();

e OutputStream out = response.getOuputStream();

f ServletOutputStream out = response.getServletOutputStream();

Answer: e

   

What file is the deployment descriptor of a web application named BankApp stored in? (Select one)

a BankApp.xml

b bankapp.xml

c server.xml

d deployment.xml

e WebApp.xml

f web.xml

Answer: f

 

Which method is used to retrieve an attribute from a ServletContext? (Select one)

a String getAttribute(int index)

b String getObject(int index)

c Object getAttribute(int index)

d Object getObject(int index)

e Object getAttribute(String name)

f String getAttribute(String name)

g String getObject(String name)

Answer: e

 
Which of the following methods will be invoked on a session attribute that implements appropriate interfaces when the session is invalidated? (Select one)

a sessionDestroyed of HttpSessionListener

b attributeRemoved of HttpSessionAttributeListener

c valueUnbound of HttpSessionBindingListener

d sessionWillPassivate of HttpSessionActivationListener

Answer: c


  
Which of the following actions would you take to prevent your web site from being attacked? (Select three)

a Block network traffic at all the ports except the HTTP port.

b Audit the usage pattern of your server.

c Audit the Servlet/JSP code.

d Use HTTPS instead of HTTP.

e Design and develop your web application using a software engineering methodology.

f Use design patterns.

Answers: a, c, and d

 

Which of the following exceptions may be thrown by the _jspService() method? (Select one)

a javax.servlet.ServletException

b javax.servlet.jsp.JSPException

c javax.servlet.ServletException and javax.servlet.jsp.JSPException

d javax.servlet.ServletException and java.io.IOException

e javax.servlet.jsp.JSPException and java.io.IOException

Answer: d

 

Which of the following implicit objects can you use to store attributes that need to be accessed from all the sessions of a web application? (Select two)

a application

b session

c request

d page

e pageContext

Answers: a and e

 

Identify the JSP equivalent of the following code written in a servlet. (Select one)

RequestDispatcher rd = request.getRequestDispatcher("world.jsp");

rd.forward(request, response);

a <jsp:forward page="world.jsp"/>

b <jsp:action.forward page="world.jsp"/>

c <jsp:directive.forward page="world.jsp"/>

d <%@ forward file="world.jsp"%>

e <%@ forward page="world.jsp"%>

Answer: a

 


Comments




Leave a Reply

    SCWCD Sets


    Archives

    May 2008
    April 2008