Most Asked Servlet Interview Questions and Answers

Servlet Interview Questions and Answers most commonly asked for Experienced PDF, Freshers candidates for Employment.

What is called Session Tracking?

Session tracking is used to maintain a state on the series of requests from the same user for a given period of time.

Why session tracking is needed?

Every HTTP request needs to be captured by HTTP protocol and for that, state is captured. Tracking of state is called session tracking.

What are the types of Session Tracking ?

There are following types of session tracking:

  • URL rewriting

  • Hidden Form Fields

  • Cookies

  • Secure Socket Layer (SSL)

What are the advantages of cookies?

Cookies are used to store long term information that can be maintained without server interaction. Small and Medium size data are kept in a queue.

What is URL rewriting?

URL rewriting is one of the methods of session tracking in which additional data is appended at the end of each URL. This additional data identifies the session.

What is servlet lazy loading?

A servlet container which does not initialize at the start up, this is known as servlet lazy loading.

What is Servlet Chaining?

Chaining is one of the methods where out of one servlet is given to the second servlet. This chaining can happen for any number of servlets.

What are the important functions of filters?

Following are the important functions of Filters:

  • Security check

  • Modifying the request or response

  • Data compression

  • Logging and auditing

  • Response compression

What are the functions of Servlet container?

Following are the functions of the Servlet container:

  • Lifecycle management

  • Communication support

  • Multithreading support

  • Declarative security

  • JSP support

What is the difference between JSP and Servlets ?

JSP supports HTTP protocol which mainly used for presentation. But a servlet can support any protocol like HTTP, FTP, SMTP etc.

What are all the ways for session tracking?

Following are the ways for session tracking:

  • Cookies

  • URL rewriting

  • HttpSession

  • Hidden form fields

What is called Scriptlet?

A scriptlet contains any language statements, variables, expressions that can be valid in the page scripting language. Scriptlet is a part of generated servlet service method.

What is the difference between Server and Container?

A server can provide service to the client and it contains one or more containers such as EJBs, Servlet, JSP containers. Containers hold set of objects.

Can we refresh servlet in client and server side automatically?

On the client side, Meta http is used for refresh and server push is used for server side refresh.

What is the difference between ServletConfig and ServletContext?

ServletConfig provides information about configuration of a servlet which is defined inside the web.xml file and it is a specific object for each servlet.

ServletContext is an application specific object and it is shared by all servlet. It belongs to one application in one JVM.

What is Pure Servlet?

Pure servlet is servlet which is used to create java objects that can be implemented from javax.servlet.Servlet interface.

What is Generic Servlet class?

Generic servlet is the super class of all servlets. This class is extended by all other classes and it is protocol independent.

What is the difference between Servlets and applets?

Servlets are used for server side config and it keeps on server. But, Applets are used for client side coding and it runs on client browsers.


Popular posts from this blog

TOP Agile Testing Interview Questions and Answers

Latest Agile Testing Interview Questions and Answers

Most Asked ADO.NET Interview Questions and Answers