Beruflich Dokumente
Kultur Dokumente
getSession();
s.setMaxInactiveInterval(0);
if(s.isNew()){
System.out.println("new session");
}
else{
System.out.println("something else");
}
a. pageContext
b. requestScope
c. request
d. exception
5. Which of these are valid ways of setting the Integer attribute value of 10
to the empId attribute of the employee bean. Assume that there is an
empId parameter bound to the request with the value 10(Choose more than one)
6. To which of these objects can you set attributes to(Choose more than one)
a. Session
b. ServletContext
c. ServletConfig
d. Request
9. If cookies are disabled, which of the following approaches you use to keep
track of sessions
10. Which one of the following do you use to redirect to an error page
a. response.sendRedirect(URL);
b. response.sendErrorRedirect(URL);
c. response.setStatus(ErrorStatusCode);
d. response.sendStatus(ErrorStatusCode);
a. Error in Line 2
b. Output 25
c. Output 30
d. Error in Line 4
12. There are two custom tags t1 and t2. T1 is associated with a tag handler
class that implements BodyTagSupport and T2 is associated with a tag handler
class that implements SimpleTagSupport. It is known that both the tags have a
body. Which of these is a valid way of using these tags in a JSP?
a. <prefix:t1><prefix:t2>aaaa</prefix:t2></prefix:t1>
b. <prefix:t1/><prefix:t2/>
c. <prefix:t1><prefix:t2/></prefix:t1>
d. <prefix:t1><prefix:t2></prefix:t1></prefix:t2>
a. Always overridden
b. Never overridden
c. Generally overridden
d. None of these
a. ${context.init[paramName]}
b. ${initParam.paramName}
c. ${initParam[paramName]}
d. ${paramName}
(Not sure of the options)
18. <init-param>
<param-name>Param</param-name>
</param-value>Value</param-value>
</init-param>
a. getServletContext().getServletConfig().getInitParameter(Param);
b. getServletConfig().getServletContext().getInitParameter(Param);
c. request.getServletContext().getInitParameter(Param);
d. session.getServletConfig().getInitParameter(Param);
a. <invalidate-session>
b. <session-stop>
c. <session-timeout>
d. None of these
21. Which among these is a C-tag alternative for the Switch-case block?
a. <c:when>
b. <c:if>
c. <c:out>
d. There is no C-tag alternative for switch-case
a. <invalidate-session>
b. <session-stop>
a. $[map.key]
b. $[map[key]}
c. $[map[names[0]]}
a. Application
b. Page
a. Session.setAttribute(var,abc);
b. Session.setAttribute(var, new Long(abc));
c. Session.setLongAttribute(var,abc);
d. Session.setLongAttribute(var, new Long(abc));
26. Which of these can be used to collect and store user information?
a. request
b. session
c. pageContext
27. Which listener would you use to listen to the creation of a new session?
a. HttpSessionListener
b. HttpSessionAttributeListener
c. ServletContextListener
d. None of these
a. check
b. test
c. expression
d. condition
29. What action must be performed for a Servlet to perform the role of an
HttpServlet
<% b = 3 %>
<% a = 3 %>
a. request.getParameter()
b. request.getCookies()
c. session.getParameter()
d. None of these
32. The compilation and the initialization of the jsp is done in which phase?
a. Deployment phase
b. Build phase
c. Translation phase
d. None of these
33. Which of the following are valid ways to invalidate a session?(Choose more
than one)
a. application
b. context
c. page
d. session
35. What are the features not supported by the web container
a. Compiling JSPs
b. Multithreading
c. Compiling servlets
d. None of these