×

Top 15 Servlet Interview Questions for 2024

1) What is Servlet?

It is a technology used to create web applications. It is a web component which is used to create dynamic web pages. It consists of many interfaces and classess such as Servlet, HttpServlet, GenericServlet, ServletRequest, ServletResponse etc.

2) What are the advantages of Servlet?

Advantages of Servlet are:
  • Secure
  • Robust
  • Portable
  • Better performance

3) What are the types of Http request methods?

Http request methods are:
  • Get
  • Post
  • Head
  • Trace
  • Put
  • Delete
  • Option

4) What are the types of Servers?

Two types of servers are:
  • Web server
  • Application server

5) What are the features provided by MIME(Multipurpose Internet Mail Extension) to the Email Service?

Features of MIME to the Email Service are:
  • Supports non -ASCII characters
  • Attach multiple files in a single message
  • Supports unlimited message length
  • Supports attachment like executable audio, video, and image files etc

6) What are the types of Content types used in Servlet?

Types of Content types are :
text/html
text/plain
application/msword
application/vnd.ms-excel
application/jar
application/pdf
images/jpeg
images/png
images/gif
audio/mp3
video/mp4 etc.

7) What are the methods of Servlet interface?

Methods of Servlet interface are:
public void destroy()
public String getServletInfo()
public void init(ServletConfig config)
public ServletConfig getServletConfig()
public void service(ServletRequest request,ServletResponse response)

8) What are the types of ways for session tracking?

Four ways of session tracking are:
Cookies
URL Rewriting
HttpSession
Hidden form field

9) What are the methods of Cookie class?

Methods of Cookie class are:
public String getName()
public String getValue()
public void setName(String name)
public void setValue(String value)
public void setMaxAge(int expiry)

10) What are common tasks performed by Servlet Container?

Tasks performed by Servlet Container are:
Communication Support
Lifecycle and Resource Management
Multithreading Support
JSP Support etc.

11) How to create a cookie in Servlet?

Example of create a cookie in Servlet:
Cookie ck=new Cookie("user","TutorialandExample");    
response.addCookie(ck);

12) What is the life cycle of a Servlet?

Life cycle of a Servlet:
  • Step 1: Servlet is loaded
  • Step 2: Servlet is instantiated
  • Step 3: Servlet is initialized
  • Step 4: Service the request
  • Step 5: Servlet is destroyed

13) Which event is fired at the time of session creation and destroy?

At the time of session creation and destroy, The HttpSessionEvent is fired.

14) How can we perform any action at the time of deploying the project?

With the help of ServletContextListener interface, We can perform any action at the time of deploying the project.

15) When Servlet object is created?

Servlet object is created at the time of First Request.

Related Topics

Top 14 MathML Interview Questions for 2024

1) What is MathML? MathL stands for Mathematical Markup Language. It is extended form of XML. It is used to describe mathematical and scientific notations. 2) Who is the developer of MathML? World...

3 minutes read.

Top 48 C# Interview Questions for 2024

1) Write a program in C# to print "HELLO WORLD"? class Program         {          static void Main(string  args[])           {             System.Console.WriteLine(" HELLO WORLD ");             }          } 2) Write a program in C# to print "TutorialandExample" using namespace? Here, namespace is used to group related classes. Using System;    namespace  TutorialandExample      {         public class           {             public static void Main(string[]  args)             {              Console.WriteLine(" TutorialandExample ");             }          }       } 3) What are the...

8 minutes read.

Top 30 Flex Interview Questions for 2024

1) What is Flex? Flex is an open source framework which is used to build applications for mobile, browser and desktop. It provides FLEX SDK consisting of the Flex class library, Flex...

4 minutes read.

Top 30 Sencha Touch Interview Questions for 2024

1) What is Sencha Touch? Sencha Touch is an UI (User Interface) JavaScript library. It is written in JavaScript. It is used to build mobile interface quickly and easily. It works...

6 minutes read.

Top 15 T-SQL(Transact-SQL) Interview Questions for 2024

1) What is T-SQL? T-SQL stands for Transact Structured Query Language. T-SQL is the extension of SQL functionality supported by Microsoft SQL Server and Sybase ASE. 2) What are the features of...

3 minutes read.

Top 15 Pure CSS Interview Questions for 2024

1) What is Pure CSS? Pure is a CSS (Cascading Style Sheet) framework. It is a collection of small set of responsive CSS modules. We can integrate it to any web...

5 minutes read.

Top 22 MariaDB Interview Question for 2024

1) What is MariaDB? It is a community based database devoloped by MySQL Devolopers. It provides same features as MySQL also, can be said that it is a replacement of MySQL. 2)...

3 minutes read.

Top 40 TensorFlow Interview Questions and Answers

Commonly Asked TensorFlow Interview Questions for Fresher Q1. What is TensorFlow? TensorFlow is the machine learning library developed by Google's brain team, it supports multiple abstraction levels, and we can choose the...

13 minutes read.

Top 15 JCL (Job Control Language) Interview Questions for 2024

1) What is JCL? JCL refers to Job Control Language. It is a command language which describes job (unit of work) for the Multiple Virtual Storage (MVS) operating system. It is...

3 minutes read.

Top 15 Java JDBC Interview Questions for 2024

1) What are the types of JDBC Drivers in Java? JDBC Drivers are of four types are: JDBC-ODBC bridge driver Native-API driver Network Protocol driver Thin driver 2) What are the five...

4 minutes read.

Top 30 Drupal Interview Questions for 2024

1) What is Drupal? Drupal is an open source CMS (Content Management System) framework. It is written in php and provides rich set of tools to create web sites. 2) What are...

4 minutes read.

Top 28 LISP Interview Questions for 2024

1) What is LISP? LISP is the high-level programming language after Fortran. LISP is stands for List Processing. This programming language was invented by John McCarthy in 1958 at the Massachusetts Institute of...

3 minutes read.

Top 15 Erlang Interview Questions for 2024

1) What is Erlang÷ Erlang is an open source programming language. It is used to build massively scalable soft real-time systems. It has runtime environment. It supports concurrency, fault tolerance and...

2 minutes read.

Top 15 Struts Interview Questions for 2024

1) What are the Features of Struts 2? Features of Struts 2 are: Configurable MVC components POJO based actions AJAX support Integration support Various Result Types Various Tag support Theme and...

3 minutes read.

Top 15 Java BeanUtils Interview Questions for 2024

1) What is Java BeanUtils? Java BeanUtils is a design pattern component of the Apache Commons. It facilitates architecture for Java language which is derived from JavaAPI. It helps to set...

3 minutes read.

Top 30 Cobol Interview Questions for 2024

1) What is COBOL? COBOL is a programming language which is used for finance, business and administrative systems for companies. COBOL is stands for Common Business Oriented Language. 2) What are the features...

4 minutes read.

Top 31 PHP Interview Questions for 2024

1) What is PHP? PHP is a object-oriented scripting language, open source, interpreted and executed at server side. It is also used to develop web applications. 2) What are the features of PHP? Features...

4 minutes read.

Top 15 iOS (iPhone, iPad) Interview Questions for 2024

Top 20 Most Frequently asked iOS Interview Questions and Answers 1) What is iOS? iOS is a mobile operating system developed by Apple Inc. iOS offers iPhone and iPad application development using...

3 minutes read.

Top 15 SQL Server Interview Question for 2024

1) Describe SQL Server? SQL server is a DataBase Management System developed by Microsoft. It was first introduced in year 2008 since, then many version has been introduced such as :...

2 minutes read.

Top 30 AngularJS Interview Questions and Answers for 2024

Most Frequently asked AngularJS Interview Questions and Answers for Fresher 1) Describe Angular JS ? It is a powerful framework of JavaScript. AngularJS is used to design Rich Internet Application. This framework...

5 minutes read.