Q.1 Write a code to demonstrate the use of text shadow property.
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-shadow: 2px 2px 5px gray;
}
</style>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
This shows the text-shadow property adding a shadow effect to text.
Q.2 Difference between JSON and XML.
• JSON: Lightweight, uses key–value pairs, easy to read, mainly for data exchange.
• XML: Uses tags with opening/closing structure, more verbose, mainly for data storage and
representation.
JSON is faster and simpler, while XML is heavier but supports complex data with attributes.
Q.3 What is Servlet?
A Servlet is a Java program that runs on a server and generates dynamic web content.
It acts as a middle layer between client requests (HTTP) and server responses (HTML, data).
Q.4 List and explain the session tracking techniquecs.
Session Tracking Techniques:
1. Cookies – Store small data on client’s browser.
2. URL Rewriting – Session ID is appended to the URL.
3. Hidden Form Fields – Data stored in invisible form fields.
4. HTTPSession – Server-side object to store session info. ✅
Q.5 List the properties/methods of document object in Java script.
Document Object Properties/Methods in JavaScript:
• Properties: title, URL, forms, links, cookie.
• Methods: getElementById(), getElementsByTagName(), write(), querySelector(). ✅
Q.6 Explain with example paragraph element in HTMLS.
The <p> tag in HTML is used to define a paragraph of text. Browsers automatically add some space before
and after each paragraph.
Example:
<p>This is a paragraph in HTML.</p>
<p>Each paragraph starts on a new line.</p>
Q.7 Write a program to explain < div > tag.
The <div> tag is a block-level element used to group HTML elements and apply styles or layouts.
Example:
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: lightblue;
padding: 10px;
}
</style>
</head>
<body>
<div>
<h2>Welcome</h2>
<p>This content is inside a div.</p>
</div>
</body>
</html>
Q.8 Explain different types of actions in JSP.
Types of JSP Actions:
1. <jsp:include> – Includes another file at request time.
2. <jsp:forward> – Forwards request to another resource.
3. <jsp:useBean> – Creates or accesses a JavaBean.
4. <jsp:setProperty> – Sets bean property value.
5. <jsp:getProperty> – Retrieves bean property value.
5 Marks questions
Q.1 Explain syntax of HTMLS5 document.
HTML5 Document Syntax
An HTML5 document always starts with a doctype declaration and contains the basic structure divided
into two main parts: head and body.
Syntax:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My HTML5 Page</title>
</head>
<body>
<h1>Hello, HTML5!</h1>
<p>This is a sample paragraph.</p>
</body>
</html>
Explanation:
1. <!DOCTYPE html> → Declares the document as HTML5.
2. <html> → Root element of the page.
3. <head> → Contains metadata like <title>, <meta>, CSS/JS links.
4. <body> → Contains visible content such as text, images, links, etc.
5. HTML5 is case-insensitive and supports new semantic tags (<header>, <footer>, <section>, etc.).
Q.2 List and explain JSON data types with example.
JSON Data Types
JSON (JavaScript Object Notation) supports the following data types:
1. String – Sequence of characters inside double quotes.
2. { "name": "Pratap" }
3. Number – Numeric values (integer or floating point).
4. { "age": 21, "marks": 85.5 }
5. Boolean – Logical values true or false.
6. { "isStudent": true }
7. Null – Represents empty or no value.
8. { "middleName": null }
9. Object – Collection of key–value pairs enclosed in { }.
10. { "student": { "id": 101, "dept": "CSE" } }
11. Array – Ordered list of values enclosed in [ ].
12. { "subjects": ["Java", "Python", "DBMS"] }
Summary: JSON supports String, Number, Boolean, Null, Object, and Array data types, which help in
lightweight data exchange.
Q.3 Explain the event handling in Java script with simple example.
Event Handling in JavaScript
• Event handling means responding to user actions like clicks, key presses, mouse movements, etc.
• An event is something that happens in the browser (e.g., a button click).
• JavaScript allows attaching event handlers (functions) to HTML elements to handle these events.
Ways to Handle Events:
1. Inline Event Handling (inside HTML tag).
2. Using DOM Properties (element.onclick).
3. Using addEventListener() method (recommended).
Example:
<!DOCTYPE html>
<html>
<body>
<button onclick="showMsg()">Click Me</button>
<script>
function showMsg() {
alert("Button was clicked!");
}
</script>
</body>
</html>
In this example, when the button is clicked, the function showMsg() is executed, showing an alert box.
Summary: Event handling connects user actions with JavaScript functions to make web pages
interactive.
Q.4 List and explain various types of JDBC drivers.
Types of JDBC Drivers
JDBC drivers are used to connect Java applications with databases. There are four types:
1. Type 1: JDBC-ODBC Bridge Driver
o Uses ODBC driver to connect to the database.
o Easy to use but platform-dependent and slow.
o (Deprecated in Java 8+).
2. Type 2: Native API Driver
o Uses native (C/C++) database client libraries.
o Faster than Type 1, but requires client-side installation of native libraries.
3. Type 3: Network Protocol Driver
o Uses a middleware server that communicates between Java app and database.
o Portable and flexible but needs an additional server layer.
4. Type 4: Thin Driver (Pure Java Driver)
o Written entirely in Java, communicates directly with the database using database protocol.
o Fastest and most widely used driver.
Summary:
• Type 1 → Bridge Driver (slow, obsolete).
• Type 2 → Native API (requires client library).
• Type 3 → Network Protocol (middleware server).
• Type 4 → Thin Driver (pure Java, best choice).
Q.5 Explain Java servlet architecture with a neat and labeled diagram.
Java Servlet Architecture
A Servlet follows a client–server architecture. The client (browser) sends a request to the Web Server,
which passes it to the Servlet Container. The Servlet processes the request, interacts with the database if
needed, and sends the response back to the client.
Servlet Architecture Flow:
1. Client (Browser) → Sends HTTP request.
2. Web Server + Servlet Container → Receives and manages request.
3. Servlet → Processes request using service(), doGet(), or doPost().
4. Database/Business Logic → Accessed if required.
5. Servlet Response → Sent back to client via server.
Labeled Diagram (simplified)
Client (Browser)
│
▼
HTTP Request
│
▼
┌───────────────────┐
│ Web Server │
│ + Servlet Engine │
└───────────────────┘
│
▼
Java Servlet
(service/doGet/doPost)
│
┌───────────────┐
│ Database/Logic│
└───────────────┘
│
▼
HTTP Response → Back to Client
Summary:
Servlet architecture works on a request–response model, where the Servlet Container manages servlet
lifecycle and communication between client and server.