Servlet JSP Interview Questions

Servlet JSP Interview Questions are core of any J2EE Interview. Servlet and JSP forms web layer of J2EE framework where Java Server pages is main view technology and Servlets are main Controller component of standard MVC architecture. In this post we will see the most common or frequently asked JSP and Servlet Interview questions and answers, which can help you on your J2EE interview preparation and understanding some key concept of Java web applications.

Servlet JSP Interview Questions

1.How do you find which client machine is sending request to your servlet in Java?
2.What is the difference between a Cookie and a Session object in Java?
3.Which protocol does Browser and Servlet use to communicate with each other?
4. What is HTTP Tunneling?
5.Why do we use JSP instead of Servlet in Java?486.Is empty ‘.java’ file name a valid source file name in Java?
7.How do you implement Servlet Chaining in Java?
8.Can you instantiate this class?
9.Why Java does not support operator overloading?
10.Why String class is Immutable or Final in Java?
11.What is the difference between sendRedirect and forward methods?
12.How do you fix your Serializable class, if it contains a member that is not serializable?
13.What is the use of run time polymorphism in Java?
14.What are the rules of method overloading and method overriding in Java?
15.What is the difference between a class and an object in Java?
16.Can we create an abstract class that extends another abstract class?
17.Why do you use Upcasting or Downcasting in Java ?
18.What is the reason to organize classes and interfaces in a package in Java?
19.What is information hiding in Java?
20.Why does Java provide default constructor?
21.What is the difference between super and this keywords in Java?
22.What is the advantage of using Unicode characters in Java?
23.Can you override an overloaded method in Java?
24.How can we change the heap size of a JVM?
25.Why should you define a default constructor in Java?26.How will you make an Object Immutable in Java?
27.How can you prevent SQL Injection in Java Code?
28.Which two methods should be always implemented by HashMap key Object?
29.Why an Object used as Key in HashMap should be Immutable?
30.How can we share an object between multiple threads?
31. How can you determine if your program has a deadlock?
32.What are the implicit objects in JSP?
33.How will you extend JSP code?
34.How will you handle runtime exceptions in JSP?
35.How will you prevent multiple submits of a page that come by clicking
refresh button multiple times?
36.How will you implement a thread safe JSP page?
37.How will you include a static file in a JSP page?
38.What are the lifecycle methods of a JSP?
39.What are the advantages of using JSP in web architecture?
40.What is the advantage of JSP over Javascript?
41.What is the Lifecycle of JSP?
42.What is a JSP expression?
43.What are the different types of directive tags in JSP?
44.What is session attribute in JSP?
45.What are the different scopes of a JSP object?46.What is pageContext in JSP?
47.What is the use of jsp:useBean in JSP?
48.What is difference between include Directive and include Action of JSP?
49.How will you use other Java files of your application in JSP code?
50.How will you use an existing class and extend it to use in the JSP?
51.Why _jspService method starts with _ symbol in JSP?
52.Why do we use tag library in JSP?
53.What is the different type of tag library groups in JSTL?
54.How will you pass information from one JSP to another JSP?
55.How will you call a stored procedure from JSP?
56.Can we override _jspService() method in JSP?
57.What is a directive in JSP?
58.How will you implement Session tracking in JSP?
59.How do you debug code in JSP?
60.How will you implement error page in JSP?
61.How will you send XML data from a JSP?
62.What happens when we request for a JSP page from web browser?
63.How will you implement Auto Refresh of page in JSP?
64.What are the important status codes in HTTP?
65.What is the meaning of Accept attribute in HTTP header?
66.What is the difference between Expression and Scriptlet in JSP?67.How will you delete a Cookie in JSP?
68.How will you use a Cookie in JSP?
69.What is the main difference between a Session and Cookie in JSP?
70.How will you prevent creation of session in JSP?
71.What is an output comment in JSP?
72.How will you prevent caching of HTML output by web browser in JSP?
73.How will you redirect request to another page in browser in JSP code?
74.What is the difference between sendRedirect and forward in a JSP?
75.What is the use of config implicit object in JSP?
76.What is the difference between init-param and context-param?
77.What is the purpose of RequestDispatcher?
78.How can be read data from a Form in a JSP?
79.What is a filter in JSP?
80.How can you upload a large file in JSP?
81.In which scenario, Container initializes multiple JSP/Servlet objects?

That’s all about Servlet JSP Interview Questions.

Leave a Comment


Please share it if you found this useful
Hide Buttons