Sr.Java Web Developer Interview Questions & Answers
Download PDF

Strengthen your Sr.Java Web Developer interview skills with our collection of 64 important questions. Each question is crafted to challenge your understanding and proficiency in Sr.Java Web Developer. Suitable for all skill levels, these questions are essential for effective preparation. Secure the free PDF to access all 64 questions and guarantee your preparation for your Sr.Java Web Developer interview. This guide is crucial for enhancing your readiness and self-assurance.

64 Sr.Java Web Developer Questions and Answers:

Sr.Java Web Developer Job Interview Questions Table of Contents:

Sr.Java Web Developer Job Interview Questions and Answers
Sr.Java Web Developer Job Interview Questions and Answers

1 :: What is executeQuery(String query)?

Statement executeQuery(String query) is used to execute Select queries and returns the ResultSet. ResultSet returned is never null even if there are no records matching the query. When executing select queries we should use executeQuery method so that if someone tries to execute insert/update statement it will throw java.sql.SQLException with message “executeQuery method can not be used for update”.

2 :: Do you know what is JSON? Can you represent JSON as Java Object?

JSON stands for Javascript object notation and is used to initialize Javascript objects. Yes it can be used as Java object also. Provide more info here

3 :: Tell me how do you differentiate between Core Java and Enterprise Java?

Core Java is something that provides the API's like regular expression, String handling, collections. But enterprise java involves writing scalable, secure and per-formant applications which can have large user base.

4 :: Explain me what do you mean by batch processing in JDBC?

Batch processing helps you to group related SQL statements into a batch and execute them instead of executing a single query. By using batch processing technique in JDBC, you can execute multiple queries which makes the performance faster.

5 :: Tell us how to disable caching on back button of the browser?

<%
response.setHeader(“Cache-Control”,”no-store”);
response.setHeader(“Pragma”,”no-cache”);
response.setHeader (“Expires”, “0”); //prevents caching at the proxy server
%>

6 :: Explain me what is the purpose of JDBC ResultSet interface?

The ResultSet object represents a row of a table. It can be used to change the cursor pointer and get the information from the database.

7 :: What is public StackTraceElement[] getStackTrace()?

This method returns an array containing each element on the stack trace. The element at index 0 represents the top of the call stack whereas the last element in the array represents the method at the bottom of the call stack.

8 :: Explain me what is JDBC Connection interface?

The Connection interface maintains a session with the database. It can be used for transaction management. It provides factory methods that returns the instance of Statement, PreparedStatement, CallableStatement and DatabaseMetaData.

9 :: Tell us what is a finally block? Is there a case when finally will not execute?

Finally block is a block which always executes a set of statements. It is always associated with a try block regardless of any exception that occurs or not.
Yes, finally will not be executed if the program exits either by calling System.exit() or by causing a fatal error that causes the process to abort.

10 :: Do you know what is the difference between frameworks like Jquery/DOJO and AJAX?

Jquery and DOJO are java script frameworks for writing rich web applications but AJAX is a server communication mechanism which can issue requests without page reload.

11 :: Tell us how is JSP better than Servlet technology?

JSP is a technology on the server’s side to make content generation simple. They are document centric, whereas servlets are programs. A Java server page can contain fragments of Java program, which execute and instantiate Java classes. However, they occur inside HTML template file. It provides the framework for development of a Web Application.

12 :: Explain me what is the role of JDBC DriverManager class?

The DriverManager class manages the registered drivers. It can be used to register and unregister drivers. It provides factory method that returns the instance of Connection.

13 :: Tell us what is JDBC DatabaseMetaData interface?

The DatabaseMetaData interface returns the information of the database such as username, driver name, driver version, number of tables, number of views etc.

14 :: Explain me what do you generally do after you have resolved a problem?

Perform the Root Cause Analysis and make sure the changes done have not effected any other module.

15 :: Do you know what is synchronization?

Synchronization refers to multi-threading. A synchronized block of code can be executed by only one thread at a time. As Java supports execution of multiple threads, two or more threads may access the same fields or objects. Synchronization is a process which keeps all concurrent threads in execution to be in sync. Synchronization avoids memory consistency errors caused due to inconsistent view of shared memory. When a method is declared as synchronized the thread holds the monitor for that method’s object. If another thread is executing the synchronized method the thread is blocked until that thread releases the monitor.

16 :: Please explain why should we not configure JSP standard tags in web.xml?

We don’t need to configure JSP standard tags in web.xml because when container loads the web application and find TLD files, it automatically configures them to be used directly in the application JSP pages. We just need to include it in the JSP page using taglib directive.

In case you are facing any challenges with these java interview questions, please comment your problems in the section below. Apart from this Java Interview Questions Blog.

17 :: Do you know the role of DispatcherServlet and ContextLoaderListener?

☛ DispatcherServlet is basically the front controller in the Spring MVC application as it loads the spring bean configuration file and initializes all the beans that have been configured. If annotations are enabled, it also scans the packages to configure any bean annotated with @Component, @Controller, @Repository or @Service annotations.

☛ ContextLoaderListener, on the other hand, is the listener to start up and shut down the WebApplicationContext in Spring root. Some of its important functions includes tying up the lifecycle of Application Context to the lifecycle of the ServletContext and automating the creation of ApplicationContext.

18 :: Tell me what are the steps to connect to a database in java?

☛ Registering the driver class
☛ Creating connection
☛ Creating statement
☛ Executing queries
☛ Closing connection

19 :: Do you know what is a Spring?

Wikipedia defines the Spring framework as “an application framework and inversion of control container for the Java platform. The framework’s core features can be used by any Java application, but there are extensions for building web applications on top of the Java EE platform.” Spring is essentially a lightweight, integrated framework that can be used for developing enterprise applications in java.
The following code explain how to delete a Cookie in a JSP :

Cookie mycook = new Cookie("name1","value1");
response.addCookie(mycook1);
Cookie killmycook = new Cookie("mycook1","value1");
killmycook . set MaxAge ( 0 );
killmycook . set Path ("/");
killmycook . addCookie ( killmycook 1 );

21 :: Tell me what are the reasons for a page not found error and how will you sort it out?

☛ 1) The URL being sent is wrong
☛ 2) The web.xml mapping is wrong
☛ 3) The web server is down
☛ 4) The application has not been deployed

22 :: Tell me how does cookies work in Servlets?

☛ Cookies are text data sent by server to the client and it gets saved at the client local machine.
☛ Servlet API provides cookies support through javax.servlet.http.Cookie class that implements Serializable and Cloneable interfaces.
☛ HttpServletRequest getCookies() method is provided to get the array of Cookies from request, since there is no point of adding Cookie to request, there are no methods to set or add cookie to request.
☛ Similarly HttpServletResponse addCookie(Cookie c) method is provided to attach cookie in response header, there are no getter methods for cookie.

24 :: What is void printStackTrace()?

This method prints the stack trace information to the standard error stream.

25 :: Tell me what steps will you take for ensuring the proper security of an web application?

Stuff like Encryption, Authentication and Authorization
Sr.Java Web Developer Interview Questions and Answers
64 Sr.Java Web Developer Interview Questions and Answers