SCWCD-13 04/20/2008

Consider the following code for the doGet() method:

public void doGet(HttpServletRequest req,

HttpServletResponse res)


PrintWriter out = res.getWriter);



if(req.getParameter("name") == null)





Which of the following lines can be inserted at //1 so that the above code does

not throw any exception? (Select one)

a if ( ! res.isSent() )

b if ( ! res.isCommitted() )

c if ( ! res.isDone() )

d if ( ! res.isFlushed() )

e if ( ! res.flush() )

Answer: b


A web application is located in a directory named sales. Where should its

deployment descriptor be located? (Select one)

a sales

b sales/deployment

c sales/WEB

d sales/WEB-INF

e WEB-INF/sales


g WEB/sales

Answer: d



Consider the following class:

import javax.servlet.*;

public class MyListener implements ServletContextAttributeListener


public void attributeAdded(ServletContextAttributeEvent scab)


System.out.println("attribute added");


public void attributeRemoved(ServletContextAttributeEvent scab)


System.out.println("attribute removed");



Which of the following statements about the above class is correct? (Select one)

a This class will compile as is.

b This class will compile only if the attributeReplaced() method is added to it.

c This class will compile only if the attributeUpdated() method is added to it.

d This class will compile only if the attributeChanged() method is added to it.

Answer: b


Given these filter mapping declarations:


















in what order are the filters invoked for the following browser request?


a FilterOne, FilterThree

b FilterOne, FilterTwo, FilterThree

c FilterThree, FilterTwo

d FilterThree, FilterTwo

e FilterThree

f None of these filters are invoked.

Answer: d


Which of the following methods will be invoked on a session attribute that

implements HttpSessionBindingListener when the session is invalidated?

(Select one)

a sessionDestroyed

b valueUnbound

c attributeRemoved

d sessionInvalidated

Answer: b


Which one of the following must be done before authorization takes place?

(Select one)

a Data validation

b User authentication

c Data encryption

d Data compression

Answer: b


Which of the following methods is defined by the JSP engine? (Select one)

a jspInit()

b _jspService()

c _jspService(ServletRequest, ServletResponse)

d _jspService(HttpServletRequest, HttpServletResponse)

e jspDestroy()

Answer: d



Leave a Reply

    SCWCD Sets


    May 2008
    April 2008