Select chapter



basics (7.papers)
constructors (1.papers)
packages (1.papers)
inheritance (7.papers)
misc (3.papers)
exceptions (5.papers)
threads (4.papers)
overloading (1.papers)
jsp (3.papers)
servlets (9.papers)
jdbc (2.papers)
util (1.papers)
xml (2.papers)
IO stream (3.papers)
Hide

Sponsored Links


  

java servlets interview questions and answers

Show Answer
Share Facebook gmail Twitter
2
What does the method getResourceAsStream(String str) of ServletContext used for?
  1. To get all the resources associated with the Servlet.
  2. To get database connections associated with Servlet
  3. To get the passive content from ServletContext object
  4. To get unused resources from the ServletContext object
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
9
Which of the following is not the way to specify session timeout?
  1. Using <Session-Config> parameter of web.xml
  2. Using setMaxInactiveInterval(int interval) of session object
  3. Using invalidate() method of session object
  4. ServletContainer provides timeout by default
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
16
Which of the following is not a method of Servlet interface?
  1. void init(ServletConfig config)
  2. service(ServletRequest req, servletResponse res)
  3. ServletContext getServletContext()
  4. ServletConfig getServletConfig()
Show Answer
Share Facebook gmail Twitter
17
Why is it required to call super.init(ServletConfig) in the init method of a Servlet?
  1. It is necessary to initialize ServletContainer
  2. Allows servlets with access to the ServletContext object and initialization parameters
  3. Allows servlets with access to the ServletConfig object 
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
19
Where does the servlet maintain session?
  1. ServletContainer
  2. ServletContext
  3. Servlet request heap
  4. Servlet response heap
Show Answer
Share Facebook gmail Twitter
20
Which of the following retrieve multiple intialization parameters of the Servlet?
  1.  Enumeration enum = getServletConfig().getInitParameterNames();
    
  2. Enumeration enum = getServletContext().getInitParameterNames();
  3. Enumeration enum = request.getInitParameters();
  4. Enumeration enum = getServletConfig().getInitParameter();
    
Show Answer
Share Facebook gmail Twitter
Read more papers :