Feb 10, 2011

25 Servlet Interview Questions

Most of the interviews include questions from core Java,servlets, JSP and EJB et cetera. Here in this article I am listing the 25 most asked questions on servlets. Servlet is not a vast topic so you can expect 7 to 10 questions from servlets in an interview. I am not providing the answers for these questions as you can simply search for the answers on the Internet.

If you are looking for code Java interview questions than I have already written a blog post for the same here
  1. How will you create a servlet?
  2. Is a servlet thread safe?
  3. Can a servlet only be created for HTTP protocol or can I write a servlet for the FTP protocol also?
  4. What are the minimum methods to be added in order to create a servlet?
  5. What are the various scopes available to a servlet?
  6. How to maintain concurrency in a servlet-based web application for the attributes and parameters?
  7. How will you end a session programmatically. What are the ways to specify the session timeout?
  8. What are the ways or session tracking in a servlet-based web application?
  9. How to specify the mapping for the URL of the servlet?
  10. What are the various parts of the URL of a servlet?
  11. What is the difference between servlet config and servlet context objects?
  12. What is the difference between GET and POST request?
  13. What is a filter with respect to servlet API and how can one chain the filters ?
  14. What is the difference between SendRedirect and Forward ?
  15. How will you write a HTML form which submits to a servlet?
  16. How will you pass initialization parameter to a servlet?
  17. How is a servlet file is stored in the web application server?
  18. What is the effect of making the service method synchronised?
  19. Are HTTPServl andetRequest and HTTPServletResponse classes or interfaces?
  20. What is the rule to specify the URL to forward/sendredirect methods?
  21. Why is there a call to service method of superclass in the servlet's service method?
  22. What is the life cycle of a servlet?
  23. What is meant by load on start-up that in web.xml?
  24. What will happen if two or more servlets are mapped to the same URL pattern in the web.xml file?
  25. Why there is no constructor defined in a servlet?
Do suggest If I have missed any important servlet interview question...

5 comments: