Servlet Quiz

Servlet Quiz

 



Servlet Quiz contain set of 10 MCQ questions for Servlet MCQ which will help you to clear beginner level quiz.



1. Which life cycle method is called once in servlet life?
a. class loading
b. init()
c. service()
d. destroy()
 
2. Which method is called when client request come?
a. get()
b. post()
c. init()
d. service()
 
3. Which method doesn’t exists in HttpServlet Class?
a. service
b. init
c. doGet
d. doPost
 
4. Which interface contain servlet life-cycle methods?
a. HttpServlet
b. GenericServlet
c. Service
d. Servlet
 
5. Which of these life-cycle method you can over-ride in your class?
a. init()
b. service()
c. doGet()
d. All of these
 
6. Which statement is not true about ServletContext?
a. There is one ServletContext per one application
b. Generally it is used to get web app parameters
c. We can get Server Information though it
d. There is one ServletContext per one servlet
 
7. Which http method is idempotent?
a. get
b. post
c. trace
d. option
 
8. If you are not putting method name in your form tag, what is the default method?
a. get
b. post
c. service
d. none of the above
 
9. Which method decide which method will call i.e doGet() or doPost()
a. based on http method of http request?
b. doOption
c. doTrace
d. doMethod
e. Service
 
10. When init parameters are read by container?
a. When container starts
b. When doGet/doPost called
c. When Servlet intialised
d. When constuctor called