Sunday, January 27, 2013

Servlets Interview Questions - 2

6. What is the life cycle of a servlet?
init()–used for initialization
service()–for processing client requests
destroy()– used for closing

7. What is meant by cookies? Why is Cookie used?

8. What is HTTP Session?

9. What is the difference between GET and POST methods?

Using GET method, we can able to pass 2K data from HTML.
In POST method, we do not have any size limitation.

10. How can you run a Servlet Program?

11. What is the middleware? What is the functionality of Webserver?

12. What webserver is used for running the Servlets?

13. How do you invoke a Servelt? What is the difference in between doPost and doGet

14. What is the difference in between the HTTPServlet and Generic Servlet? Explain their
methods? Tell me their parameter names also?

15. What are session variable in Servlets?

16. What is meant by Session? Tell me something about HTTPSession Class?

17. What is Session Tracking?

18. Difference between doGet and doPost?

When we make a request to any servlet, request doesn’t goes directly to the servlet
instead it will go to the service method of the super class and then it is passed as a
parameters to the service method of your class. In doGet() method the data will append to
the url as a query string and we can’t send huge amount of data using doGET() method.
Where as in doPost() method the data can be directly sent to browser without displaying
it in the url. With this we can send as much of data as we can. But doGet() method is little
faster when compared to doPost().but it is not recommended as for some sensitive
messages like password will be displayed as a query string in it.

19. What are the methods in HttpServlet?


No comments:

Post a Comment

Thank you share the knowledge U have with in U.