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