Servlets Interview Questions and Answers pdf free download

The below Java Servlets Interview Questions and Answers for freshers, experienced candidates interview preparation
1.  What is Servlet?
2.  Why is Servlet so popular? 
3.  What is servlet container? 
4.  When a client request is sent to the servlet container, how does the container choose which servlet to invoke? 
5.  If a servlet is not properly initialized, what exception may be thrown? 
6.  Given the request path below, which are context path, servlet path and path info? 
7.  What is filter? Can filter be used as request or response? 
8.  When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?
9.  What is new in ServletRequest interface ? (Servlet 2.4) 
10. Request parameter How to find whether a parameter exists in the request object? 
11. How can I send user authentication information while making URL Connection? 
12. Can we use the constructor, instead of init(), to initialize servlet? 
13. How can a servlet refresh automatically if some new data has entered the database? 
14. The code in a finally clause will never fail to execute, right? 
15. What mechanisms are used by a Servlet Container to maintain session information?
16. Difference between GET and POST 
17. What is session? 
18. What is servlet mapping? 
19. What is servlet context ? 
20. Which interface must be implemented by all servlets? 
21. Explain the life cycle of Servlet.
22. When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet? 
23. Why don't we write a constructor in a servlet? 
24. When we don't write any constructor for the servlet, how does container create an instance of servlet? 
25. 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?
26. What is the difference between callling a RequestDispatcher using ServletRequest and ServletContext? 
27. Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling 
28. Whats the advantages using servlets over using CGI?
29. What is Servlets and explain the advantages of Servlet life cycle?
30. What are different Authentication options available in Servlets.
31. What is the GenericServlet class?
32. What is the difference between an Applet and a Servlet?
33. List out the difference between ServletConfig and ServletContext?
35. What is the difference between using getSession(true) and getSession(false) methods?
36. List out difference between a JavaBean from a Servlet?
37. Define servlet mapping?
38. What is Servlets and explain the advantages of Servlet life cycle?
39. What is the difference between Difference between doGet() and doPost()?
40. What is the difference between ServletContext and ServletConfig?

0 comments: