Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Servlets Interview Questions and Answers

  Difficulty Level: AllBeginnerIntermediateExperienced/Expert

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 APIs in 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 10. What is Servlet?

Ques 11. Why is Servlet so popular?

Ques 12. What is servlet container?

Ques 13. When a client request is sent to the servlet container, how does the container choose which servlet to invoke?

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 24. What is session?

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.

Ques 29. When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet?

Ques 30. Why don't we write a constructor in a servlet?

Ques 31. When we don't write any constructor for the servlet, how does container create an instance of servlet?

Ques 32. Once the destroy() method is called by the container, will the servlet be immediately destroyed? What happens to the tasks(threads) that the servlet might be executing at that time?

Ques 33. What is the difference between callling a RequestDispatcher using ServletRequest and ServletContext?

Ques 34. Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?

©2022 WithoutBook