Saturday, May 10, 2008

Java Interview Questions 55

271. What is the difference between an applet and a servlet?- a) Servlets are to
servers what applets are to browsers. b) Applets must have graphical user
interfaces whereas servlets have no graphical user interfaces.

272. What is the difference between doPost and doGet methods?-
a) doGet() method is used to get information, while doPost() method is used for posting information.
b) doGet() requests can’t send large amount of information and is limited to
240-255 characters. However, doPost()requests passes all of its data, of unlimited
length.
c) A doGet() request is appended to the request URL in a query string and
this allows the exchange is visible to the client, whereas a doPost() request
passes directly over the socket connection as part of its HTTP request body and the
exchange are invisible to the client.

273. What is the life cycle of a servlet?- Each Servlet has the same life cycle:
a) A server loads and initializes the servlet by init () method. b) The servlet
handles zero or more client’s requests through service() method. c) The server
removes the servlet through destroy() method.

274. Who is loading the init() method of servlet?- Web server

275. What are the different servers available for developing and deploying
Servlets?- a) Java Web Server b) JRun g) Apache Server h) Netscape Information
Server i) Web Logic

No comments:

Useful Information