IWP FAT Solution E1 SLOT
IWP FAT Solution E1 SLOT
and descriptions:
---
1. Web Protocols:
2. Web Architecture:
Purpose: Organize components (front-end, back-end, database) for scalability and efficiency.
1. Steps:
Response Sent: Server sends an HTTP response with the requested resource.
Request:
Response:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1234
---
1. SQL Injection:
---
<table border="1">
<tr>
<th>Topic</th>
<th>Learning Outcome</th>
<th>Estimated Time</th>
</tr>
<tr>
<td>Blockchain</td>
<td>Understand decentralized systems</td>
<td>3 hours</td>
</tr>
<tr>
<td>AI Integration</td>
<td>Learn AI-based web solutions</td>
<td>4 hours</td>
</tr>
<tr>
<td>Semantic Web</td>
<td>Explore Web 3.0 features</td>
<td>2 hours</td>
</tr>
</table>
<figure>
<img src="module.jpg" alt="Web 3.0 Concept Image">
<figcaption>Web 3.0 Learning Module</figcaption>
</figure>
<video controls>
<source src="web3-intro.mp4" type="video/mp4">
<track src="web3-caption.vtt" kind="captions" srclang="en" label="English">
</video>
<figcaption>Introduction to Web 3.0</figcaption>
<ul>
<li><a href="https://example.com/web3-basics" target="_blank">Web 3.0 Basics</a></li>
<li><a href="https://example.com/blockchain-intro" target="_blank">Introduction to
Blockchain</a></li>
<li><a href="https://example.com/ai-web" target="_blank">AI Integration in Web 3.0</a></li>
</ul>
---
1. $_POST:
2. $_SESSION:
3. $_GET:
4. $_SERVER:
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = htmlspecialchars($_POST['name']);
$amount = (float)$_POST['amount'];
echo "Thank you, $name, for donating $amount.";
}
---
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$sql = "INSERT INTO students_data VALUES (?, ?, ?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("isssssi", $id, $name, $addr, $dob, $phone, $email, $marks);
$stmt->execute();
}
---
<script>
function search() {
const keyword = document.getElementById('keyword').value;
fetch(`https://api.example.com/search?keyword=${keyword}`)
.then(res => res.json())
.then(data => {
let output = "<ul>";
data.forEach(item => output += `<li>${item.title}</li>`);
output += "</ul>";
document.getElementById('results').innerHTML = output;
});
}
</script>
---
---
Question 6
<bookstore>
<book>
<title>The Great Gatsby</title>
<author>F. Scott Fitzgerald</author>
<price>200.50</price>
<publish_year>1925</publish_year>
</book>
<book>
<title>To Kill a Mockingbird</title>
<author>Harper Lee</author>
<price>150.75</price>
<publish_year>1960</publish_year>
</book>
<book>
<title>1984</title>
<author>George Orwell</author>
<price>180.00</price>
<publish_year>1949</publish_year>
</book>
</bookstore>
<!DOCTYPE bookstore [
<!ELEMENT bookstore (book+)>
<!ELEMENT book (title, author, price, publish_year)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT publish_year (#PCDATA)>
]>
---
Question 7
Node.js Script
(async function () {
const client = new MongoClient(url);
try {
await client.connect();
console.log("Connected to the database");
const db = client.db(dbName);
const collection = db.collection("Employee");
} catch (err) {
console.error(err);
} finally {
client.close();
}
})();
---
Question 8
To-Do List Application (HTML and CSS)
HTML
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>To-Do List</h1>
<div id="task-container">
<ul id="task-list">
<!-- Tasks will appear here -->
</ul>
<input type="text" id="task-input" placeholder="Add a new task...">
<button id="add-task-btn">Add Task</button>
</div>
</body>
</html>
CSS
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 20px;
}
#task-container {
width: 50%;
margin: auto;
}
#task-list li {
margin: 5px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.completed {
text-decoration: line-through;
color: gray;
}
#add-task-btn {
padding: 10px 20px;
background-color: blue;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
#add-task-btn:hover {
background-color: darkblue;
}
---
Question 9
const paragraph = "This is a sample paragraph.\nIt has multiple lines.\nAnd it ends here.";
function analyzeText(text) {
const wordCount = text.split(/\s+/).filter(word => word).length;
const charCount = text.length;
const lineCount = text.split("\n").length;
console.log(analyzeText(paragraph));
HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<form id="quiz-form">
<p>1. What is 2 + 2?</p>
<input type="radio" name="q1" value="3"> 3<br>
<input type="radio" name="q1" value="4"> 4<br>
<input type="radio" name="q1" value="5"> 5<br>
<p id="score"></p>
</body>
<script>
$("#submit-btn").click(function () {
let score = 0;