SCWCD-6

04/14/2008

10 Comments

 

Which method in the HttpServlet class services the HTTP POST request?
(Select one)
a doPost(ServletRequest, ServletResponse)
b doPOST(ServletRequest, ServletResponse)
c servicePost(HttpServletRequest, HttpServletResponse)
d doPost(HttpServletRequest, HttpServletResponse)
Answer:
d

Which element is used to specify useful information about an initialization
parameter of a servlet in the deployment descriptor?
(Select one)
a param-description
b description
c info
d param-info
e init-param-info

Answer:
b

Which of the following methods will be invoked when a ServletContext is
destroyed?
(Select one)
a contextDestroyed() of javax.servlet.ServletContextListener
b contextDestroyed() of javax.servlet.HttpServletContextListener
c contextDestroyed() of javax.servlet.http.ServletContextListener
d contextDestroyed() of javax.servlet.http.HttpServletContextListener

Answer:
a
Explanation
Remember that the concept of servlet context applies to all the servlets and not
just HttpServlets. Therefore, interfaces related to servlet context belong to the
javax.servlet package.


Which elements are allowed in the element of the deployment
descriptor?
(Select three)
a
b
c
d
e

Answers:
a, c, and d

Explanation
Answer a is correct because you can map filters to named servlets, as well as URL
patterns.

When servlet init parameter will be read ?
A When client makes a request.
B When starting server
C When container initializes the servlet
D When container shuts down.

Answer:
C
When the container initializes the servlet, it reads the DD and creates a parameter list for ServletConfig. These parameters are read only once at the time of initialization only


Which of the following interfaces or classes is used to retrieve the session associated
with a user?
(Select one)
a GenericServlet
b ServletConfig
c ServletContext
d HttpServlet
e HttpServletRequest
f HttpServletResponse

Answer:
e
Explanation
The session associated with a user can only be retrieved using the HttpServlet-
Request.getSession() method.

Which of the following correctly defines data integrity? (Select one)
a It guarantees that information is accessible only to certain users.
b It guarantees that the information is kept in encrypted form on the server.
c It guarantees that unintended parties cannot read the information during transmission
between the client and the server.
d It guarantees that the information is not altered during transmission between the client
and the server.

Answer:
d
Explanation
Answers a and c describe authorization and confidentiality. Encrypting data kept
on the server may be part of some security plans, but is not covered by the servlet
specification.

Which method is used to read the context initialization parameter ? Select two
A getServletConfig().getInitParameter();
B getServletContext().getInitParameter();
C getServletConfig().getContextParameter();
D getServletContext().getServletParameter();
E getServletConfig().getServletContext().getInitParameter();

Answer:
B and E
Option A is incorrect because it reads servlet initialization parameter only, not context initialization parameter. Option c and d are incorrect because , they are invalid methods. Option E is correct because always a ServletConfig contains a reference to the ServletContext.

What getInitParameterNames() of ServletContext does ?
A Returns the init parameters for a servlet
B Returns the init parameter names of a servlet
C Returns the init parameter names of the context
D All of the above.

Answer:
C
getInitParameterNames() returns the names of the context's initialization parameters as an Enumeration

Which is the correct way to set a context initialization parameter ?
A getServletContext().setInitParameter();
B getServletConfig().setInitParameter();
C using DD
D None of the above.

Answer:
C
The only way to set a context initialization parameter is by using tag in the DD only. We cannot set the context param programmatically

Consider the following code and select the correct statement about it from the
options below.
(Select one)
<html><body>
<%! int aNum=5 %>
The value of aNum is <%= aNum %>
</body></html>
a It will print "The value of aNum is 5" to the output.
b It will flag a compile-time error because of an incorrect declaration.
c It will throw a runtime exception while executing the expression.
d It will not flag any compile time or runtime errors and will not print anything to the
output.

Answer:
b

What will be the output of the following code? (Select one)
<html><body>
<% x=3; %>
<% int x=5; %>
<%! int x=7; %>
x = <%=x%>, <%=this.x%>
</body></html>
a x = 3, 5
b x = 3, 7
c x = 5, 3
d x = 5, 7
e Compilation error

Answer:
c

 


Comments

08/12/2010 17:36

A contented mind is a perpetual feast.

Reply
08/17/2010 17:41

Life is not all beer and skittles.

Reply
08/20/2010 17:49

stray birds of summer come to my window to sing and fly away.
and yellow leaves of autumn, which have no songs, flutter and fall
there with a sign.

Reply
08/25/2010 20:38

The value of culture is its effect on character. It avails nothing unless it ennobles and strengthens that. Its use is for life. Its aim is not beauty but goodness.

Reply
09/18/2010 01:54

No morality can be founded on authority, even if the authority were divine. (A. J. Ayer. USA writer)

Reply
10/27/2010 17:54

Each one particular flower, Is a lyrical ballads, each and every a gentle wind, Is often a comfy greetings, Each field is a single coronary heart,The moist, Every single communication is often a constant genuine feeling!

Reply
11/29/2010 00:38

Still be the white snow princess in be passionately in love, allow when to be awaited.

Reply
11/29/2010 22:54

Gracias por compartir esos artículo! Será útil.*

Reply
01/25/2011 19:25

Living in the lap of luxury isn't bad except that you never know when luxury is going to stand

Reply
03/21/2011 01:21

Your blog is so great . I'd like to read the information about it, so how does it work? Do you want to know the MBT shoes ? MBT shoes on hot sale ! Absence to love is what wind is to fire. It extinguishes the small; it inflames the great.

Reply



Leave a Reply

    SCWCD Sets


    Archives

    May 2008
    April 2008