0% found this document useful (0 votes)
6 views

finaljavaQBank (1)

The document explains various Java concepts including methods of the Thread class, Servlets, Collection classes, JAR files, JDBC connections, and JSP tags. It details specific methods and their functionalities, such as start(), run(), sleep(), join(), and setPriority() for threads, as well as the lifecycle of Servlets and types of JDBC drivers. Additionally, it covers the use of Statement and PreparedStatement in JDBC, and provides examples of common JSP tags and the Vector class.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

finaljavaQBank (1)

The document explains various Java concepts including methods of the Thread class, Servlets, Collection classes, JAR files, JDBC connections, and JSP tags. It details specific methods and their functionalities, such as start(), run(), sleep(), join(), and setPriority() for threads, as well as the lifecycle of Servlets and types of JDBC drivers. Additionally, it covers the use of Statement and PreparedStatement in JDBC, and provides examples of common JSP tags and the Vector class.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 40

Q1) Explain any 5 methods defined in the Thread Class

1. start() – Starts a new thread and calls the run() method.

class MyThread extends Thread {

public void run() {

System.out.println("Thread is running...");

public class Main { public static void main(String[] args) { MyThread t1 = new
MyThread();

t1.start();

2. run() – Defines the code that runs inside a thread.

class MyThread extends Thread {

public void run() {

System.out.println("Thread is executing...");

3. sleep(ms) – Pauses the thread for the given time (milliseconds). public class
SleepExample { public static void main(String[] args) throws InterruptedException {

System.out.println("Sleeping...");

Thread.sleep(2000); // 2 seconds

System.out.println("Woke up!");

}}

4. join() – Makes one thread wait until another finishes.

class MyThread extends Thread {

public void run() {

System.out.println("Thread running...");

}
}

public class JoinExample { public static void main(String[] args) throws


InterruptedException { MyThread t1 = new MyThread();

t1.start(); t1.join(); // Wait for t1 to finish

System.out.println("Thread completed");

}}

5. setPriority(int p) – Sets a thread’s priority (1 to 10).

public class PriorityExample { public static void main(String[] args) {

Thread t1 = new Thread(() -> System.out.println("Low priority")); Thread t2 = new


Thread(() -> System.out.println("High priority")); t1.setPriority(Thread.MIN_PRIORITY);
t2.setPriority(Thread.MAX_PRIORITY);

t1.start(); t2.start(); }}

These methods help manage thread execution in Java efficiently.

Q2) What is a Servlet

i) A Servlet is a Java program that runs on a web server and handles client requests,
usually from a web browser.

ii) It is used to create dynamic web applications by processing user requests, generating
responses, and interacting with databases. iii) Key Features of Servlets:

Handles HTTP requests and responses.

Runs on a web server inside a Servlet container (e.g., Apache Tomcat).

Generates dynamic content (e.g., HTML, JSON).

Can manage sessions and cookies. iv) Simple Example of a Servlet:

import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException;


import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import
javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;

@WebServlet("/hello") public class HelloServlet extends HttpServlet { protected void


doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException { response.setContentType("text/html"); PrintWriter
out = response.getWriter(); out.println("<h2>Hello, Servlet!</h2>");

}
v) How It Works:

1. The client (browser) sends a request to http://localhost:8080/hello.

2. The servlet processes the request in doGet().

3. It generates an HTML response and sends it back to the client.

Servlets are commonly used in Java web applications and are part of Java EE (Jakarta EE).

Q3) Explain the following Collection Classes ArrayList, LinkedList, HashSet, TreeSet (With
methods to add & delete elements).

1. ArrayList (Dynamic Array)

i) Stores elements in a dynamic array.

ii) Fast random access (O(1) for get()) but slow insertions/deletions in the middle (O(n)).

iii) Duplicates allowed, insertion order preserved.iv) Methods to Add & Remove
Elements:

import java.util.ArrayList; public class ArrayListExample { public static void main(String[]


args) {

ArrayList<String> list = new ArrayList<>();

// Add elements list.add("Apple"); list.add("Banana"); list.add("Cherry");

// Remove an element list.remove("Banana");

System.out.println(list); // Output: [Apple, Cherry]

2. LinkedList (Doubly Linked List)

i) Stores elements as a doubly linked list (each node points to next & previous). ii) Fast
insertions & deletions (O(1) at head/tail), but slow random access (O(n)). iii) Duplicates
allowed, insertion order preserved. iv) Methods to Add & Remove Elements:

import java.util.LinkedList; public class LinkedListExample { public static void main(String[]


args) {

LinkedList<Integer> list = new LinkedList<>();

// Add elements list.add(10); list.add(20); list.addFirst(5); // Add at the


beginning

// Remove an element
list.removeLast(); // Removes last element (20)

System.out.println(list); // Output: [5, 10]

3. HashSet (Unordered Set)

i) Stores unique elements only (no duplicates).

ii) No specific order maintained.iii)Fast operations (O(1) for add, remove, contains). iv)
Methods to Add & Remove Elements:

import java.util.HashSet; public class HashSetExample { public static void main(String[]


args) {

HashSet<String> set = new HashSet<>();

// Add elements set.add("Java"); set.add("Python"); set.add("Java"); //


Duplicate, won't be added

// Remove an element set.remove("Python");

System.out.println(set); // Output: [Java]

4. TreeSet (Sorted Set)

i) Stores unique elements only.

ii) Maintains elements in sorted order (ascending by default).iii)Operations are O(log n)


(uses Red-Black tree). iv) Methods to Add & Remove Elements:

import java.util.TreeSet; public class TreeSetExample { public static void main(String[] args)
{

TreeSet<Integer> set = new TreeSet<>();

// Add elements set.add(30); set.add(10); set.add(20); // Remove an


element set.remove(10);

System.out.println(set); // Output: [20, 30] (Sorted)

Comparison Table
Each collection is useful depending on the situation.

Q4) What is the use of JAR & Manifest file

1. JAR (Java Archive) File:

i) A JAR file is a compressed package that contains multiple Java class files, images, and
resources.

ii) It is used for distributing Java applications and libraries efficiently.

Example: Creating a JAR file:

jar cvf MyApp.jar *.class

2. Manifest File (MANIFEST.MF):

i) A Manifest file is a special text file inside a JAR that contains metadata. ii) It specifies the
main class for executable JARs and other configurations.

Example Manifest File:

Manifest-Version: 1.0

Main-Class: MyApp

Creating an executable JAR:

jar cfm MyApp.jar MANIFEST.MF *.class

Running the JAR: java -jar MyApp.jar iii) Summary:


JAR files bundle Java applications.

Manifest files store execution details like the main class.

Q5) Describe the 3 methods which decide the lifecycle of a Servlet

Servlet Lifecycle Methods

A Servlet goes through three main lifecycle methods, managed by the Servlet container (e.g.,
Tomcat).

1. init() – Initialization

i) Called once when the servlet is first loaded.

ii) Used to initialize resources like database connections.

Example:

public void init() throws ServletException { System.out.println("Servlet Initialized"); }

2. service() – Request Handling

i) Called every time the servlet receives a request. ii) Handles both doGet() and doPost()
methods.

Example:

public void service(HttpServletRequest req, HttpServletResponse res) throws


ServletException, IOException { res.getWriter().println("Processing request..."); }

3. destroy() – Cleanup

i) Called once before the servlet is removed from memory.

ii) Used to close resources like database connections.

Example:

public void destroy() {

System.out.println("Servlet Destroyed");

Servlet Lifecycle Flow:

1. init() → Initializes the servlet (called once).

2. service() → Handles client requests (called multiple times).

3. destroy() → Cleans up resources before termination.

These methods ensure efficient servlet execution.


Q6) What is a Cookie, explain its descriptive attributes

i) A cookie is a small piece of data stored in the client’s browser by a web server.

ii) It helps websites remember user preferences, session details, and authentication
information.iii) Descriptive Attributes of a Cookie:

1. name and value – Stores key-value pairs.

Example: username=JohnDoe

2. domain – Specifies the domain where the cookie is valid.

Example: example.com (cookie works on this domain).

3. path – Defines the specific URL path where the cookie is accessible.

Example: /user (cookie is valid for example.com/user).

4. maxAge / expires – Sets the cookie's lifespan in seconds.

Example: maxAge=3600 (expires in 1 hour).

5. secure – Ensures the cookie is sent only over HTTPS.

6. HttpOnly – Prevents client-side JavaScript from accessing the cookie (for security).

Example in Java Servlet: import javax.servlet.*; import javax.servlet.http.*; import


java.io.IOException; public class CookieExample extends HttpServlet { protected void
doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {

Cookie cookie = new Cookie("username", "JohnDoe"); cookie.setMaxAge(3600); //


1-hour expiry response.addCookie(cookie); response.getWriter().println("Cookie
Set!");

Cookies help in session management, personalization, and tracking user activity while
ensuring security using attributes like secure and HttpOnly.

Q7) Write the steps to be followed to establish the JDBC Connection

To connect a Java application to a PostgreSQL database using JDBC, follow these steps:

1. Load the JDBC Driver

Registers the PostgreSQL driver.

Class.forName("org.postgresql.Driver");
2. Establish the Connection

Use DriverManager.getConnection() with the database URL, username, and password.

Connection con = DriverManager.getConnection("jdbc:postgresql://192.168.0.254:5432/


mydb", "user", "password");

3. Create a Statement Object

Used to execute SQL queries.

Statement stmt = con.createStatement();

4. Execute SQL Queries

Running SQL commands like SELECT, INSERT, UPDATE, etc.

ResultSet rs = stmt.executeQuery("SELECT * FROM customers");

5. Process the Results

Fetch data from the ResultSet object.

while (rs.next()) {

System.out.println(rs.getString("name"));

6. Close the Connection

Free up resources after database operations.

rs.close(); stmt.close(); con.close();

How to Create a Table Using the PostgreSQL Terminal

1. Open the PostgreSQL Terminal:

psql -h username -d mydb

(Replace username with your PostgreSQL username and mydb with your database name.)

2. Create a Table Command: CREATE TABLE customers ( id SERIAL PRIMARY KEY,


name VARCHAR(100), email VARCHAR(100) UNIQUE

);

3. Verify Table Creation:

\dt

(Lists all tables in the database.)

This ensures JDBC connectivity and helps create tables via the PostgreSQL terminal.
Q8) Which are the different types of drivers available to establish Database connection,
Explain any one in detail

Types of JDBC Drivers

JDBC drivers are used to connect Java applications to databases. There are four types:

1. Type 1: JDBC-ODBC Bridge Driver

Uses ODBC (Open Database Connectivity) driver.

Requires ODBC installation on the system.

Slow and outdated, not used in modern applications.

2. Type 2: Native-API Driver

Converts JDBC calls into database-specific native API calls.

Faster than Type 1, but requires native database libraries.

Example: Oracle’s OCI (Oracle Call Interface) driver.

3. Type 3: Network Protocol Driver

Uses a middle-tier server to convert JDBC calls to database protocol.

Can connect to multiple databases using the same driver.

Example: IBM WebSphere JDBC driver.

4. Type 4: Thin Driver (Pure Java Driver)

Directly connects to the database using the database protocol.

Fastest and most widely used.

No extra installations needed.

Example: PostgreSQL JDBC Driver (org.postgresql.Driver).

Detailed Explanation: Type 4 (Thin Driver)

The Type 4 driver is a pure Java driver that communicates directly with the database.

It does not require any native libraries or middleware.

It converts JDBC calls into database-specific protocol calls. Example: Connecting to


PostgreSQL using Type 4 Driver import java.sql.Connection; import java.sql.DriverManager;

import java.sql.SQLException; public class PostgreSQLConnection { public static void


main(String[] args) {

try {
// Load the PostgreSQL JDBC driver

Class.forName("org.postgresql.Driver");

// Establish Connection

Connection con = DriverManager.getConnection(

"jdbc:postgresql://192.168.0.254:5432/mydb", "user", "password"

);

System.out.println("Connected successfully!"); con.close();

} catch (ClassNotFoundException | SQLException e) {

e.printStackTrace();

Advantages of Type 4 Driver

✅ Fast & Efficient – No conversion overhead.

✅ Platform Independent – Written in Java.

✅ No Extra Software Needed – No ODBC/native library installation required.

Type 4 drivers are the most commonly used because they provide a direct, fast, and
platformindependent connection between Java applications and databases.

Q9) Explain the use of ‘Statement’ & ‘Prepared’ statements

In JDBC, both Statement and PreparedStatement are used to execute SQL queries, but they
differ in performance and security.

1. Statement (For Simple Queries)

Used for static SQL queries (queries without parameters).

Slower, as each query is compiled separately.

Prone to SQL Injection because user input is directly added to queries.

Example:

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery("SELECT * FROM customers");

2. PreparedStatement (For Dynamic Queries with Parameters)


Used for queries with placeholders (?).

Faster, as queries are precompiled and reused.

Prevents SQL Injection by securely binding values.

Example:

PreparedStatement pstmt = con.prepareStatement("SELECT * FROM customers WHERE id


= ?");

pstmt.setInt(1, 5);

ResultSet rs = pstmt.executeQuery();

Key Differences:

✅ Use Statement for simple queries.

✅ Use PreparedStatement for secure, repeated queries

Q10) Explain any 5 JSP tags

Ans.

Here's an explanation of five common JSP tags: page, include, forward, useBean, and
getProperty, which are used for page directives, actions, and scripting elements.

1. page Directive:

*Syntax: <%@ page ... %>

*Purpose: The page directive provides global settings for the JSP page, such as specifying the
language (Java), content type, session management, and error page.
*Example: <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

2. include Action:

*Syntax: <jsp:include page="path_to_page.jsp" />

*Purpose: Includes the content of another JSP page into the current page at runtime.
*Example: <jsp:include page="header.jsp" />

3. forward Action:

*Syntax: <jsp:forward page="path_to_page.jsp" />

*Purpose: Forwards the request and response to another JSP page, allowing for control flow
between pages.

*Example: <jsp:forward page="success.jsp" />

4. useBean Action:

*Syntax: <jsp:useBean id="beanName" class="className" scope="page|request|session|


application"

/>

*Purpose: Finds or creates a Java bean (a class with getter and setter methods) and makes it
available within the specified scope (page, request, session, or application). *Example:
<jsp:useBean id="user" class="com.example.User" scope="session" />

5. getProperty Action:

*Syntax: <jsp:getProperty name="beanName" property="propertyName" />

*Purpose: Retrieves the value of a specified property from a Java bean that was previously
created or found using <jsp:useBean>.

*Example: <jsp:getProperty name="user" property="name" />

Q11) Explain the Vector Class

Ans. The Vector class implements a growable array of objects, similar to an ArrayList, but
with the key difference that Vector is synchronized, making it thread-safe, while ArrayList is
not.

Commonly Used Methods:

1.add(Object element): Adds an element to the end of the vector.

2.get(int index): Retrieves the element at the specified index.

3.size(): Returns the number of elements in the vector.


4.remove(int index): Removes the element at the specified index.

When to Use Vector:

1.Multi-threaded environments:

If you need a thread-safe collection, Vector is a suitable choice, but consider using

Collections.synchronizedList(new ArrayList()) for better performance in single-threaded


environments.

2.Legacy code compatibility:

If you are working with older code that relies on Vector, you might need to use it for
compatibility.

Q12) Write a note on Serialization and Externalization

Ans.

1.Serialization

The process of writing the state of an object to a file is called serialization, but strictly
speaking, it is the process of converting an object from java supported form into a file-
supported form or networksupported form by using fileOutputStream and
objectOutputStream classes we can implement serialization.

But we can serialize only serializable objects. An object is said to be serializable if and only if
the corresponding class implements a Serializable interface. Serializable interface is present
in java.io package, and it doesn’t contain any method and hence it is a marker interface. If
we are trying to serializable a non-serializable object then we will get Runtime Exception
saying notSerializableException.

2.Externalization

In serialization, everything is taken care of by JVM and the programmer doesn’t have any
control. In serialization, it is always possible to solve the total object to file, and it is not
possible to save part of the object which may create performance problems. To overcome
this problem we should go for externalization.

The main advantage of Externalizable over serialization is, everything is taken care of by the
programmer and JVM doesn’t have any control. Based on our requirements we can save
either the total object or part of the object which improves the performance of the system.
To provide the generalizable ability for any java object, it’s a mandate for the corresponding
class to implement a generalizable interface.

This interface defines two methods as follows:

Method 1
public void writeExternal( ObjectOutput obj ) throws IOException

This method will be executed automatically at the time of serialization within this method
we have to write code to save the required variable to the file. Method 2

public void readExternal(ObjectInput in )throws IOException , ClassNotFoundException

This method will be executed automatically at the time of deserialization. Within this
method, we have to write code to read the required variable from the file and assign it to
the current object.

Q13) What are the advantages of using Servlets over traditional CGI

Ans.advantages:

1.Efficiency:

Servlets are more efficient because they are designed to be lightweight and run within the
web server's process, while CGI scripts spawn a new process for each request, consuming
more resources.

2.Platform Independence:

Servlets are written in Java, a platform-independent language, making them portable across
different operating systems and web servers, unlike CGI scripts which are often platform-
dependent.

3.Integration with Java Technologies:

Servlets are designed to work seamlessly with other Java technologies like JavaServer Pages
(JSP) and Enterprise JavaBeans (EJB), enabling developers to build complex web applications
using a unified framework.

4.Rapid Development:

Servlets provide access to a rich set of Java libraries and APIs, facilitating faster development
and easier maintenance of web applications.

5.Scalability and Performance:

Servlets are designed to handle multiple requests concurrently, making them suitable for
building scalable and high-performance web applications.

6.Security:

Servlets provide a more secure environment for web applications compared to CGI, as they
are managed by the web server and can be configured with security features.

7.State Management:
Servlets can maintain state information across multiple requests, unlike CGI scripts, which
are stateless.

8.Easy Coordination:

Servlets can easily coordinate with other servlets and components within a web application,
making it easier to build complex applications.

Q14) What is the use of Iterator & Comparator in a Collection

Ans.

1.Iterator:

Purpose:

Iterators are used to traverse elements in a collection one by one, providing methods like
hasNext() to check for the next element and next() to retrieve it.

Modification:

Iterators also offer a remove() method to safely delete elements from the collection during
iteration, preventing ConcurrentModificationException.

Use Cases:

Processing each element in a collection.

Removing elements that meet a specific condition during iteration.

Traversing different data structures or when the type of the structure is unknown.

2.Comparator:

Purpose:

Comparators define custom sorting logic for objects, allowing you to sort collections based
on criteria other than the natural ordering.

Implementation:

A Comparator is an object with a compare() method that takes two objects as input and
returns an integer indicating their relative order.

Use Cases:

Sorting collections of user-defined objects by specific attributes.

Creating custom sorting algorithms.

Sorting based on multiple criteria.

Q15) What is Introspection


Ans.

1.What it is:

Introspection is a mechanism that allows a program to examine the structure of a Java class
(or bean) at runtime, including its properties, methods, and events.

2.How it works:

Introspection uses Java's reflection API to dynamically inspect the class and its members,
enabling tools to discover and interact with the bean's capabilities.

3.Why it's used:

*Visual Development Tools: Introspection is crucial for tools that allow developers to build
user interfaces or manipulate components visually, as it enables the tool to understand the
properties and methods of the bean being used.

*Frameworks: Frameworks like Spring or Micronaut use introspection to automatically


discover and configure beans based on their properties and methods, simplifying
development.

*Dynamic Code Generation: Introspection can be used to dynamically create or modify code
based on the structure of the bean, allowing for flexible and adaptable applications.

4.Key Concepts:

*BeanInfo: A special class that provides descriptive information about a bean, including its
properties, events, and methods. Introspection uses BeanInfo to learn about a bean's
capabilities.

*Introspector Class: The java.beans.Introspector class provides a standard way for tools to
learn about the properties, events, and methods supported by a target Java Bean.

*Reflection: Introspection relies on Java's reflection API to dynamically examine and


manipulate classes and objects at runtime.

Q16) Explain HTTP session tracking

Ans.In Java web development, HTTP session tracking allows you to maintain state across
multiple HTTP requests from the same client, overcoming the stateless nature of HTTP, by
using the HttpSession interface to store and retrieve data associated with a user's session.

1.Session Tracking Necessity:

To create interactive web applications (where the server needs to remember user data
between requests), session tracking is crucial.

2.HttpSession:
The HttpSession interface, part of the Java Servlet API, provides a mechanism for managing
user sessions.

3.How it Works:

A.When a user makes a request, the server can create a new session or retrieve an existing
one.

B.A unique session ID is assigned to the session, which can be stored in a cookie or other
mechanisms.

C.You can store data (Java objects) in the HttpSession using setAttribute() and retrieve it
using getAttribute().

D.Multiple servlets within the same application can access the same session.

4.Session Management:

A.You can control the lifetime of a session (e.g., timeout).

B.You can invalidate a session (e.g., when a user logs out).

Q17) Explain the doGet() and doPost() methods of a servlet

Ans.

1. doGet() Method: A.Purpose:

The doGet() method is used to process HTTP GET requests. This method is typically used for
retrieving data or displaying information to the user. B.Example:

When a user types a URL in the browser and presses Enter, or when a form is submitted with
the method="GET" attribute, the doGet() method in the corresponding servlet is invoked.
C.Data Transfer:

GET requests send data as part of the URL, which is visible to the user in the address bar.
D.Security:

Because data is visible in the URL, GET requests are generally less secure than POST
requests.

2. doPost() Method: A.Purpose:

The doPost() method is used to process HTTP POST requests. This method is typically used
for submitting data, creating new resources, or modifying existing ones. B.Example:

When a form is submitted with the method="POST" attribute, the doPost() method in the
corresponding servlet is invoked. C.Data Transfer:

POST requests send data in the body of the HTTP request, which is not visible in the URL.
D.Security:
Because data is not visible in the URL, POST requests are generally more secure than GET
requests.

Q18) Explain the thread Class

Ans.

The Thread class represents a thread of execution, allowing programs to perform multiple
tasks concurrently. You can create threads by either extending the Thread class or
implementing the Runnable interface.

1.Key Concepts:

A.Threads vs. Processes:

A process is a program in execution, while a thread is a lightweight unit of execution within a


process. B.Concurrency:

Threads enable concurrent execution, allowing multiple parts of a program to run seemingly
simultaneously.

C.Thread Creation:

Extending the Thread class: Create a class that extends Thread and override the run()
method, which contains the code to be executed by the thread.

D.Implementing the Runnable interface: Create a class that implements the Runnable
interface and override the run() method. Then, create a Thread object, passing an instance
of the Runnable class to its constructor.

2.Thread Methods:

A.start(): Initiates the execution of a thread, causing it to transition to the Runnable state.

B.run(): Contains the code that the thread will execute.

C.join(): Waits for a thread to complete execution.

D.sleep(): Pauses the current thread for a specified duration.

Q19) Explain all the methods of a thread

-->

There are two ways to create thread in java;

1. Implement the Runnable interface (java.lang.Runnable)

2. By Extending the Thread class (java.lang.Thread)

1. Implementing the Runnable Interface


One way to create a thread in java is to implement the Runnable Interface and then
instantiate an object of the class. We need to override the run() method into our class.
which is the only method that needs to be implemented. The run() method contains the
logic of the thread.

The procedure for creating threads based on the Runnable interface is as follows:

1. A class implements the Runnable interface, providing the run() method that will be
executed by the thread. An object of this class is a Runnable object.

2. An object of Thread class is created by passing a Runnable object as argument to the


Thread constructor. The Thread object now has a Runnable object that implements the run()
method.

3. The start() method is invoked on the Thread object created in the previous step. The
start() method returns immediately after a thread has been spawned.

4. The thread ends when the run() method ends, either by normal completion or by
throwing an uncaught exception.

Example: plaas MyRunnable implements Runnable{ public void run(){ //define run method

//thread action

MyRunnable r=new MyRunnable(); //create object Thread t =new Thread(r): //create Thread
object

t.start(); //execute thread

2. Extending java.lang.Thread class

A class can also extend the Thread class to create a thread. When we extend the Thread
class, we should override the run method to specify the thread action.

class MyThread extends Thread{ public void run() {//override run method.

//thread action

MyThread t =new MyThread(); //create Thread object

t.start(); //execute thread

Q20) Explain the architecture of Java Server Pages


-->JSP architecture gives a high-level view of the working of JSP.

JSP architecture is a 3 tier architecture. It has a Client, Web Server, and Database.

The client is the web browser or application on the user side. Web Server uses a JSP Engine
i.e; a container that processes JSP. For example, Apache Tomcat has a built-in JSP Engine.

JSP Engine intercepts the request for JSP and provides the runtime environment for the
understanding and processing of JSP files.

It reads, parses, build Java Servlet, Compiles and Executes Java code, and returns the HTML
page to the client. The webserver has access to the Database. The following diagram shows
the architecture of JSP.

Explain the Set Interface & Map Interface

-->Set Interface:

Purpose:

The Set interface models the mathematical concept of a set, ensuring that each element is
unique.

Key Characteristics:

Uniqueness: Duplicate elements are not allowed.

No Order: Sets do not guarantee any specific order of elements, unless the underlying
implementation provides it (e.g., LinkedHashSet maintains insertion order).

Common Implementations: HashSet, LinkedHashSet, and TreeSet are common


implementations of the Set interface.

Use Cases:

Removing duplicate elements from a collection.

Performing membership checks (checking if an element is present in the set).

Map Interface:

Purpose:

The Map interface stores data as key-value pairs, where each key is associated with a unique
value.

Key Characteristics:

Key-Value Pairs: Maps store data as pairs of keys and values.

Unique Keys: Keys must be unique within a map.


No Order (Generally): Maps do not guarantee any specific order of elements, unless the
underlying implementation provides it (e.g., TreeMap sorts by keys).

Common Implementations: HashMap, LinkedHashMap, and TreeMap are common


implementations of the Map interface.

Use Cases:

Storing and retrieving data using keys.

Implementing dictionaries or lookup tables.

Representing relationships between objects.

Q22) Explain the steps to implement Servlet Chaining

-->1. Define Multiple Servlets:

Create multiple Java classes that extend HttpServlet (or a suitable servlet class).

Each servlet will handle a specific part of the request processing or have a particular role.

2. Implement Request Handling in Each Servlet:

Override the doGet() or doPost() methods (or both) in each servlet to handle HTTP requests.

Within these methods, implement the logic to process the request, potentially access data,
and perform actions.

3. Forward the Request to the Next Servlet:

Use the RequestDispatcher interface's forward() method to transfer the request and
response objects to another servlet.

This method is used to pass control and data to the next servlet in the chain.

Example:

RequestDispatcher dispatcher = request.getRequestDispatcher("/nextServlet");


dispatcher.forward(request, response);

/nextServlet represents the URL pattern of the next servlet in the chain.

4. (Optional) Include Content from the Previous Servlet:

Use the include() method of RequestDispatcher to include the content of the previous
servlet into the current servlet's response.

Example:

RequestDispatcher dispatcher = request.getRequestDispatcher("/previousServlet");


dispatcher.include(request, response);
/previousServlet represents the URL pattern of the servlet whose content needs to be
included.

5. (Optional) Pass Data Between Servlets:

Use request attributes (request.setAttribute()) to pass data between servlets in the chain.

The receiving servlet can retrieve the data using request.getAttribute().

6. Configure the Web Application:

In your web.xml (or equivalent configuration file), map the URL patterns for each servlet to
the corresponding servlet classes.

Ensure that the order of servlets in the chain is correctly reflected in the mapping.

7. Test and Debug:

Thoroughly test the servlet chain to ensure that requests are processed correctly and data is
passed between servlets as expected.

Use debugging tools to identify and resolve any issues in the chain.

Q23) Write the steps for establishing Java Database Connectivity with PostgreSQL

-->To connect a Java application with a PostgreSQL database using JDBC, follow these steps:

1. Install PostgreSQL

Ensure PostgreSQL is installed and running on your system. You can download it from the
official site: https://www.postgresql.org/download/

2. Add PostgreSQL JDBC Driver

Download the PostgreSQL JDBC driver (postgresql-<version>.jar) from:

https://jdbc.postgresql.org/

For Maven Users (Add Dependency in pom.xml):

<dependencies>

<dependency>

<groupId>org.postgresql</groupId>

<artifactId>postgresql</artifactId>

<version>42.6.0</version> <!-- Use the latest version -->

</dependency>

</dependencies>
For Non-Maven Users (Manually Add JAR to Classpath):

Place the JAR file in your project’s lib folder.

Add it to the classpath while compiling/running Java programs.

3. Load PostgreSQL JDBC Driver

In Java, you need to load the JDBC driver before connecting to the database.

Class.forName("org.postgresql.Driver");

(This step is optional in JDBC 4.0+, as the driver is loaded automatically.

4. Establish Connection to PostgreSQL

Database Credentials & URL Format: jdbc:postgresql://<host>:<port>/<database_name>


host → Server address (e.g., localhost) port → PostgreSQL port (default: 5432)
database_name → Your PostgreSQL database name

Example Java Code to Connect: import java.sql.Connection; import java.sql.DriverManager;


import java.sql.SQLException;

public class PostgreSQLConnection { public static void main(String[] args) {

// Database credentials

String url = "jdbc:postgresql://localhost:5432/mydatabase";

String user = "myuser";

String password = "mypassword";

// Establishing a connection try (Connection conn =


DriverManager.getConnection(url, user, password)) {

if (conn != null) {

System.out.println("Connected to PostgreSQL successfully!");

} catch (SQLException e) {

e.printStackTrace();

🔹 DriverManager.getConnection(url, user, password) → Establishes a connection to


PostgreSQL.
🔹 Try-with-resources (try (...)) → Automatically closes the connection.

5. Create & Execute SQL Statements

After connecting, you can execute SQL queries using Statement or PreparedStatement.

Example: Creating a Table import java.sql.Connection; import java.sql.DriverManager;


import java.sql.SQLException; import java.sql.Statement; public class CreateTable { public
static void main(String[] args) {

String url = "jdbc:postgresql://localhost:5432/mydatabase";

String user = "myuser";

String password = "mypassword";

String createTableSQL = "CREATE TABLE students (" +

"id SERIAL PRIMARY KEY, " +

"name VARCHAR(100), " +

"age INT)";

try (Connection conn = DriverManager.getConnection(url, user, password);


Statement stmt = conn.createStatement()) { stmt.executeUpdate(createTableSQL);

System.out.println("Table 'students' created successfully!");

} catch (SQLException e) {

e.printStackTrace();

6. Insert Data into PostgreSQL import java.sql.Connection; import java.sql.DriverManager;


import java.sql.PreparedStatement; import java.sql.SQLException;

public class InsertData { public static void main(String[] args) {

String url = "jdbc:postgresql://localhost:5432/mydatabase";

String user = "myuser";

String password = "mypassword";

String insertSQL = "INSERT INTO students (name, age) VALUES (?, ?)";

try (Connection conn = DriverManager.getConnection(url, user, password);


PreparedStatement pstmt = conn.prepareStatement(insertSQL)) {
pstmt.setString(1, "John Doe"); pstmt.setInt(2, 22);
pstmt.executeUpdate();

System.out.println("Data inserted successfully!");

} catch (SQLException e) {

e.printStackTrace();

}}

🔹 PreparedStatement → Used for parameterized queries (prevents SQL injection).

🔹 executeUpdate() → Executes SQL commands like INSERT, UPDATE, DELETE.

7. Retrieve Data from PostgreSQL import java.sql.Connection; import


java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet;
import java.sql.SQLException;

public class RetrieveData { public static void main(String[] args) {

String url = "jdbc:postgresql://localhost:5432/mydatabase";

String user = "myuser";

String password = "mypassword"; String query = "SELECT * FROM students";

try (Connection conn = DriverManager.getConnection(url, user, password);

PreparedStatement pstmt = conn.prepareStatement(query); ResultSet rs =


pstmt.executeQuery()) {

while (rs.next()) {

System.out.println("ID: " + rs.getInt("id") +

", Name: " + rs.getString("name") +

", Age: " + rs.getInt("age")); }

} catch (SQLException e) {

e.printStackTrace();

}}

🔹 ResultSet → Stores the retrieved rows from the database.

🔹 rs.getInt("column_name") → Retrieves column values by name.


8. Close Database Connection

Although Java’s try-with-resources automatically closes connections, manually closing them


is also an option: conn.close();

Q24) Compare Multithreading with Multitasking

-->Multitasking Multithreading

In multitasking, users are allowed to perform many tasks by CPU.

While in multithreading, many threads are created from a process through which computer
power is increased.

Multitasking involves often CPU switching between the tasks.

While in multithreading also, CPU switching is often involved between the threads.

In multitasking, the processes share separate memory.

While in multithreading, processes are allocated the same memory.

The multitasking component involves multiprocessing.

While the multithreading component does not involve multiprocessing.

In multitasking, the CPU is provided in order to execute many tasks at a time.

While in multithreading also, a CPU is provided in order to execute many threads from a
process at a time.

In multitasking, processes don’t share the same resources, each process is allocated
separate resources.

While in multithreading, each process shares the same resources.

Multitasking is slow compared to multithreading.

While multithreading is faster.

In multitasking, termination of a process takes more time.

While in multithreading, termination of thread takes less time.

Isolation and memory protection exist in multitasking.

Isolation and memory protection does not exist in multithreading

Q25) Compare JSP with other similar technologies like ASP (Active Server Pages)

-->JSP ASP

1.JSP stands for Java Server Pages, which helps developers to create dynamically web
pages based on HTML, XML, or other types.
ASP stands for Active Server Pages, which is used in web development to implement
dynamic web pages.

2.JSP is a server side scripting language, which was created by Sun Micro systems. ASP
is also a server side scripting language, which was created by Microsoft.

3.JSP is free of cost.

ASP is not free.

4.JSP is platform independent.

ASP is not platform independent.

5.JSP have memory leak protection.

ASP have not memory leak protection.

6.JSP code is compiled at run-time.

ASP code is not compiled, because it uses VB-script, therefore it is an interpreted language.

7.JSP provides better security.

ASP provides poor security.

8.Extension of JSP is .jsp

Extension of ASP is .asp

9.It runs on JAVA programming language.

It runs on Visual Basic language.

10. The code in JSP executes faster than ASP.

The ASP code executes slower than JSP.

Q26) Explain the Implicit Objects supported by JSP

-->Implicit objects are a set of Java objects that the JSP Container makes available to
developers on each page.

These objects may be accessed as built-in variables via scripting elements and can also be
accessed programmatically by JavaBeans and Servlets.

JSP provide you Total 9 implicit objects which are as follows :

request: This is the object of HttpServletRequest class associated with the request. response:
This is the object of HttpServletResponse class associated with the response to the client.
config: This is the object of ServletConfig class associated with the page.
application: This is the object of ServletContext class associated with the application context.
session: This is the object of HttpSession class associated with the request.

page context: This is the object of PageContext class that encapsulates the use of server-
specific features. This object can be used to find, get or remove an attribute.

page object: The manner we use the keyword this for current object, page object is used to
refer to the current translated servlet class.

exception: The exception object represents all errors and exceptions which is accessed by
the respective jsp. The exception implicit object is of type java.lang.Throwable.

out: This is the PrintWriter object where methods like print and println help for displaying
the content to the client.

Q27) What do you understand by Server Side Includes

-->In Java web applications, Server Side Includes (SSI) refer to techniques used to include
reusable content (such as headers, footers, and navigation bars) dynamically in JSP
(JavaServer Pages) or Servlets before sending the response to the client.

Java does not directly support traditional SSI (<!--#include file="..." --> as in Apache), but JSP
and Servlets provide alternative approaches to achieve the same effect.

Ways to Implement Server-Side Includes in Java

1. Using <jsp:include> in JSP (Recommended)

Includes another JSP or HTML file dynamically at runtime.

The included content is executed separately and then merged into the response.

Example: Including Header & Footer in JSP

<html>

<head>

<title>Home Page</title>

</head>

<body>

<%-- Including a common header file --%>

<jsp:include page="header.jsp" />

<h1>Welcome to My Website</h1>

<p>This is the main content.</p>

<%-- Including a common footer file --%>


<jsp:include page="footer.jsp" />

</body> </html>

✅ Advantage: The included page executes independently and can contain dynamic JSP/Java
code.

2. Using JSP Directives (<%@ include file="..." %>)

Inserts content at translation time (before compilation).

Works like copy-pasting the file content into the JSP.

Example: Using JSP Include Directive

<html>

<head>

<title>Home Page</title>

</head>

<body>

<%@ include file="header.jsp" %>

<h1>Welcome to My Website</h1>

<p>This is the main content.</p>

<%@ include file="footer.jsp" %>

</body> </html>

✅ Advantage: Faster than <jsp:include> because it merges content at compile time.

❌ Limitation: The included file cannot contain JSP declarations (<%! %>).

28.Explain three main directives used in jsp.

:::Three Main Directives Used in JSP in Java

The three main directives in JSP are:

Page Directive (<%@ page ... %>)

Defines page-level settings such as importing Java classes, setting content type, and enabling
session management.

It affects the entire JSP file.

Syntax:
<%@ page attribute="value" %>

**Include Directive (<%@ include ... %>)

Used to include content from another JSP or HTML file at compile time.The included file's
content is statically added to the current JSP before compilation.

Syntax:

<%@ include file="header.jsp" %>

**Taglib Directive (<%@ taglib ... %>)

Used to define and import custom tags or standard JSP tag libraries (JSTL).

Helps in reducing Java code inside JSP files by using tag-based expressions.

Syntax:

<%@ taglib uri="URI" prefix="prefix" %

29.explain features of main thread.

::::;Key Features of the Main Thread in Java:

1. Created Automatically by JVM

The JVM starts the main thread automatically when a Java program begins execution.

It executes the main() method of the program.

2. Runs in the main() Method

The main thread is responsible for executing the statements inside the main() method.

If no other threads are created, the program will end when the main thread finishes
execution.

3.Has a Default Priority of 5 (NORM_PRIORITY)

The priority of the main thread is set to 5 by default.

It can be changed using the setPriority(int priority) method.

4.Can Be Controlled Using Thread Methods

The main thread can be paused, resumed, or terminated using methods like sleep(), yield(),
and join().It can also be renamed using setName() and retrieved using getName().

30.explain lock based multithreading.


:::::Key Concepts of Lock-Based Multithreading

1. Locks vs. Synchronized Blocks.

2.Lock Interface (From java.util.concurrent.locks)

The Lock interface provides explicit locking mechanisms to ensure thread safety in
multithreaded programs.

lock() – Acquires the lock, blocking if necessary.

unlock() – Releases the lock.

tryLock() – Attempts to acquire the lock without blocking.

tryLock(timeout, unit) – Tries to acquire the lock within a given time.

lockInterruptibly() – Allows a thread to be interrupted while waiting for a lock

3.ReentrantLock Class

A commonly used implementation of the Lock interface.

Allows a thread to reacquire the lock it already holds.

Provides better control over fairness (FIFO ordering of lock acquisition).

31.explain four types of drivers in jdbc in java.

::::Type 1: JDBC-ODBC Bridge Driver

Uses the ODBC (Open Database Connectivity) driver to connect Java applications to
databases.

Architecture:

Java Application → JDBC API → JDBC-ODBC Bridge → ODBC Driver → Database

Advantages:Easy to use and set up.

Disadvantages:

✖ Platform-dependent

Type 2: Native-API Driver (Partially Java Driver).

Converts JDBC calls into database-specific native API calls.

Type 3: Network Protocol Driver (Middleware Driver)

Uses a middleware server that translates JDBC calls into database-specific calls.
The middleware acts as a bridge between the Java application and the database.

Type 4: Thin Driver (Pure Java Driver)

A fully Java-based driver that directly communicates with the database using database-
specific network protocols.

Converts JDBC calls into database-specific calls without additional layers.

32.what is used of executeUpdate() function in JDBC in java.

:::::executeUpdate() Function in JDBC

The executeUpdate() method in JDBC is used to execute SQL statements that modify the
database, such as:

INSERT (Adding new records)

UPDATE (Modifying existing records)

DELETE (Removing records)

DDL commands like CREATE, ALTER, and DROP

This method is a part of the Statement, PreparedStatement, and CallableStatement


interfaces in JDBC.

Syntax:

int executeUpdate(String sql) throws SQLException;

Returns an int value representing the number of rows affected.

Returns 0 for DDL statements (like CREATE or DROP).

Example 3: Using executeUpdate() for DELETE

String sql = "DELETE FROM employees WHERE id = 1";

int rowsDeleted = stmt.executeUpdate(sql);

System.out.println("Rows deleted: " + rowsDeleted);

33.What are two ways of implementing threading in java.

:::Two Ways to Implement Threading in Java

Extending the Thread class

Implementing the Runnable interface


Both methods allow a Java program to execute multiple tasks concurrently.

1.Extending the Thread Class

The Thread class in Java provides built-in methods to create and manage threads.

To create a thread, extend the Thread class and override the run() method.

Example: Extending Thread Class

class MyThread extends Thread {

public void run() {

for (int i = 1; i <= 5; i++) {

System.out.println(Thread.currentThread().getName() + " - Count: " + i);

try {

Thread.sleep(1000); // Pause for 1 second

} catch (InterruptedException e) {

e.printStackTrace();

public class ThreadExample {

public static void main(String[] args) {

MyThread t1 = new MyThread();

MyThread t2 = new MyThread();

t1.start(); // Start first thread

t2.start(); // Start second thread

2.Implementing the Runnable Interface


More flexible as it allows a class to extend another class while implementing multithreading.

The Runnable interface has a run() method that must be implemented.

Example: Implementing Runnable Interface

class MyRunnable implements Runnable {

public void run() {

for (int i = 1; i <= 5; i++) {

System.out.println(Thread.currentThread().getName() + " - Count: " + i);

try {

Thread.sleep(1000); // Pause for 1 second

} catch (InterruptedException e) {

e.printStackTrace();

public class RunnableExample {

public static void main(String[] args) {

MyRunnable myRunnable = new MyRunnable();

Thread t1 = new Thread(myRunnable); // Create thread and pass Runnable object

Thread t2 = new Thread(myRunnable);

t1.start();

t2.start();

34. Write note on java8 features.


:::.Java 8, released in March 2014, introduced several powerful features that improved code
efficiency, readability, and performance. It focused on functional programming, better
concurrency, and API enhancements. Below are the key features:

1.Lambda Expressions (Functional Programming)

Introduces anonymous functions (functions without a name).

Reduces boilerplate code in functional-style programming.

2.Functional Interfaces & Default Methods

Functional Interfaces: Interfaces with only one abstract method (e.g., Runnable,
Comparator).

Introduces default methods inside interfaces.

3.Streams API (Efficient Data Processing)

Provides a way to process collections and data in a functional style.

Supports filter, map, reduce, and forEach operations.

4.Optional Class (Avoiding NullPointerException)

Helps handle null values safely.

Reduces NullPointerException errors.

35.Write not on struts framework.

:::Apache Struts is an open-source MVC (Model-View-Controller) framework used for


building Java web applications. It simplifies JSP, Servlets, and JavaBeans development by
providing a structured way to handle user requests, process business logic, and generate
dynamic responses.

1.Key Features of Struts Framework

✔ Based on MVC Architecture – Separates UI, business logic, and data.

✔ Action-Based Framework – Uses Action classes instead of Servlets.

✔ Tag Libraries –

✔ Form Validation & Error Handling –

✔ Integration with Other Technologies –

✔ Configuration with XML & Annotations –

3.Struts Components
(a) struts-config.xml (Configuration File)

(b) Action Class (Controller)

(c) JSP View (UI)

4.Types of Struts Frameworks

5. Advantages of Struts

✅ Simplifies Web Application Development – Provides reusable components.

✅ Follows MVC Pattern –

✅ Built-in Form Handling & Validation –

✅ Extensible & Integrable –

36.Write note on maven framework in java.

:::::Apache Maven is a build automation and project management tool used in Java. It
simplifies project compilation, dependency management, testing, and deployment. Maven
follows a convention-over-configuration approach, reducing manual setup efforts.

1.Key Features of Maven

✔ Dependency Management –

✔ Project Build Automation –

✔ Convention-over-Configuration –

2. Maven Project Structure

Maven enforces a standard directory layout:

3. pom.xml (Project Object Model)

The heart of a Maven project, defining dependencies, plugins, and configurations.

4. Maven Lifecycle & Commands

Maven follows a predefined build lifecycle with phases:

Phase

*validate

Checks if the project is valid

*compile

Compiles source code


*test

Runs unit tests

*package

Creates a JAR/WAR file

*install

Installs the package locally

*deploy

Deploys to a remote repository

Q37: Write a note on: Optional class, Collectors class, Parallel Sort ->Optional Class:

Introduced in Java 8, the Optional class is a container for a value that may or may not be
present. It helps to avoid NullPointerException and provides methods like isPresent(), get(),
and ifPresent() to handle the presence or absence of a value effectively.

Collectors Class:

Part of the java.util.stream package, the Collectors class provides various static methods for
collecting the elements of a stream into different types of collections (e.g., List, Set, Map).
Commonly used methods include toList(), toSet(), and groupingBy().

Parallel Sort:

A method introduced in Java 7, Arrays.parallelSort() sorts the specified array into ascending
order using a parallel sorting algorithm. This method uses multiple threads to achieve faster
sorting, especially for large arrays.

Q38: What are Annotations.

->Annotations:

Annotations are a form of metadata that provide information about a program but are not
part of the program itself. They do not change the action of the compiled program but can
be used for various purposes such as code analysis, generating documentation, or
controlling the behavior of frameworks (e.g., @Override, @Entity, @Transactional).

Q39: Write a note on Spring Framework

->Spring Framework:

The Spring Framework is a powerful framework for building Java applications. It provides
comprehensive infrastructure support, allowing developers to create high-performing,
reusable, and easily testable code.

Key features include:


Dependency Injection: Facilitates loose coupling through inversion of control (IoC).

Aspect-Oriented Programming (AOP): Enables separation of cross-cutting concerns (like


logging).

Spring MVC: A module for building web applications using the MVC design pattern.

Integration: Supports various data access technologies, including JDBC, JPA, and Hibernate.

Q40: Write a note on Spring Applications

->Spring Applications:

Applications built using the Spring Framework benefit from its lightweight architecture and
modular components. They support a wide range of functionalities, including:

Web Applications: Utilizing Spring MVC for RESTful services.

Microservices: Using Spring Boot for rapid microservice development.

Enterprise Applications: Integrating with databases, transactions, and security.

Spring applications are configurable through XML or Java annotations, promoting clear and
concise code.

Q41: Write a note on Spring – MVC Framework

->Spring MVC Framework:

Part of the Spring Framework, the Spring MVC (Model-View-Controller) framework helps
create web applications by separating application logic into three interconnected
components:

Model: Represents the application's data and business logic.

View: Represents the UI components and how data is presented to the user.

Controller: Handles user input and updates the model and view accordingly.

Features include:

Flexible URL Mapping: Annotations for mapping URLs to controllers.

RESTful API Support: Simplified support for building REST APIs through @RestController.

Integration with other Spring features: Like security, data access, and more.

Q42: What are the Components of Hibernate

->Components of Hibernate:

Configuration: Set up of Hibernate properties and configuration files to connect to the


database.
Session: A single-threaded, short-lived object for interacting with the database, providing
methods for CRUD operations.

Transaction: Manages application data and ensures data integrity between the database and
application by supporting operations like commit and rollback.

Query: Facilitates data retrieval with HQL (Hibernate Query Language) or Criteria API.

Mapping: Interacts with the database tables through Java classes and annotations or XML
files.

Q43: Discuss Struts Framework

->Struts Framework:

An open-source framework for developing Java EE web applications following the MVC
design pattern. Key features include:

Action Servlet: Central component managing requests and directing them to proper actions.

Tag Libraries: Simplifies JSP development with custom tags for form handling and data
validation.

Convention over Configuration: Reduces the amount of configuration needed and promotes
standard coding practices.

Integration: Works well with other Java frameworks and tools for web applications.

Q44: Give full form of MOJO, POJO, JSP, JDBC

->MOJO: Maven Object

POJO: Plain Old Java Object

JSP: JavaServer Pages

JDBC: Java Database Connectivity

Q45: State the advantages of Collections Framework

->Advantages of Collections Framework:

Uniformity: Consistent programming interface for different types of collections.

Flexibility: Various data structures (like List, Set, Map) allow for efficient data handling.

Performance: Optimized algorithms for common operations such as searching, sorting, and
manipulating data.

Interoperability: Easily works with Java and other data structures, enhancing integration.

Resizable Data Structures: Many collections can dynamically adjust their size as needed,
making them more adaptable than traditional arrays.

You might also like