Servlets Interview Questions and Answers
Difficulty Level: AllBeginnerIntermediateExperienced/Expert
Ques 2. Why is Servlet so popular?
Ques 3. What is servlet container?
Ques 5. If a servlet is not properly initialized, what exception may be thrown?
Ques 6. Given the request path below, which are context path, servlet path and path info?
Ques 7. What is filter? Can filter be used as request or response?
Ques 8. When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?
Ques 9. What is new in ServletRequest interface ? (Servlet 2.4)
Ques 10. Request parameter How to find whether a parameter exists in the request object?
Ques 11. How can I send user authentication information while making URL Connection?
Ques 12. The code in a finally clause will never fail to execute, right?
Ques 13. What mechanisms are used by a Servlet Container to maintain session information?
Ques 14. Difference between GET and POST
Ques 16. What is servlet mapping?
Ques 17. What is servlet context ?
Ques 18. Which interface must be implemented by all servlets?
Ques 19. Explain the life cycle of Servlet.
Ques 21. Why don't we write a constructor in a servlet?
Ques 26. What is the difference between an application server and a Web server?
Ques 27. What are advantages of servlets over CGI?
Ques 28. What are the two important APIs in Servlets?
Ques 29. Can you explain in detail "javax.servlet" package?
Ques 30. What's the use of ServletContext?
Ques 31. What's the difference between GenericServlet and HttpServlet?
Ques 32. What’s the architecture of a Servlet package?
Ques 33. Why is HTTP protocol called as a stateless protocol?
Ques 34. What are the different ways we can maintain state between requests?