DT Practical Slips Solutions
DT Practical Slips Solutions
1. Create a container add row inside it and add 3 columns inside row using BootStrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
1. Model the following system as a document database. Consider a database of newspaper, publisher,
and city. Different publisher publishes various newspapers in different cities
2. Assume appropriate attributes and collections as per the query requirements. [3]
d. Write a cursor to show newspapers with highest sale in Maharashtra State [4]
"_id": 1,
"language": "Marathi",
"publisher_id": 1,
"city_id": 1,
"sales": 5000
},
"_id": 2,
"name": "Pune Mirror",
"language": "English",
"publisher_id": 2,
"city_id": 2,
"sales": 8000
},
"_id": 3,
"language": "Gujarati",
"publisher_id": 3,
"city_id": 3,
"sales": 12000
},
"_id": 4,
"language": "Hindi",
"publisher_id": 1,
"city_id": 4,
"sales": 15000
},
"_id": 5,
"language": "Marathi",
"publisher_id": 4,
"city_id": 1,
"sales": 7000
}
"_id": 1,
"state": "Maharashtra"
},
"_id": 2,
"state": "Maharashtra"
},
"_id": 3,
"state": "Gujarat"
},
"_id": 4,
"state": "Maharashtra"
},
"_id": 5,
"state": "Gujarat"
{
"_id": 1,
"name": "Nashik",
"state": "Maharashtra"
},
"_id": 2,
"name": "Pune",
"state": "Maharashtra"
},
"_id": 3,
"name": "Ahmedabad",
"state": "Gujarat"
},
"_id": 4,
"name": "Mumbai",
"state": "Maharashtra"
},
"_id": 5,
"name": "Surat",
"state": "Gujarat"
db.newspapers.find({
})
"language": "Marathi"
})
db.publishers.count({
"state": "Gujarat"
})
Write a cursor to show newspapers with the highest sale in Maharashtra State
db.newspapers.find({
"city_id": {
}).sort({"sales": -1}).limit(1)
Slip 3
Write a bootstrap application to display thumbnails of the images.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<div class="row">
<div class="col-md-4">
<div class="card">
<div class="card-body">
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-body">
</div>
</div>
</div>
<div class="card">
<div class="card-body">
</div>
</div>
</div>
</div>
<!-- More rows can be added similarly to display more images -->
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Model the following system as a document database. Consider employee and department’s information.
2. Assume appropriate attributes and collections as per the query requirements. [3]
d. List all the employees who work in Sales dept and salary > 50000 [4
]);
db.departments.insertMany([
]);
Display the name of the employee who has the highest salary
});
});
cursor.forEach(dept => {
});
});
List all the employees who work in the Sales department and have a salary greater than 50,000
});
Slip 4
Write a bootstrap program for the following “The .table class adds basic styling (light padding and only
horizontal dividers) to a table” The table can have the first name, last name, and email id as columns
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<table class="table">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email ID</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>[email protected]</td>
</tr>
<tr>
<td>Jane</td>
<td>Smith</td>
<td>[email protected]</td>
</tr>
<tr>
<td>Michael</td>
<td>Brown</td>
<td>[email protected]</td>
</tr>
</tbody>
</table>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Model the following information system as a document database. Consider hospitals around Nashik.
Each hospital may have one or more specializations like Pediatric, Gynaec, Orthopedic, etc. A person can
recommend/provide review for a hospital. A doctor can give service to one or more hospitals.
2. Assume appropriate attributes and collections as per the query requirements. [3]
db.hospitals.insertMany([
{ _id: 1, name: "Nashik Medical Centre", city: "Nashik", specializations: ["Pediatric", "Orthopedic"],
rating: 4.5, reviews: [] },
{ _id: 2, name: "City Hospital", city: "Nashik", specializations: ["Gynaec", "Pediatric"], rating: 4.0,
reviews: [] },
{ _id: 3, name: "Care Hospital", city: "Nashik", specializations: ["Orthopedic"], rating: 3.8, reviews: [] },
{ _id: 4, name: "Sunshine Hospital", city: "Nashik", specializations: ["Gynaec"], rating: 4.2, reviews: [] },
{ _id: 5, name: "Nashik Heart Institute", city: "Nashik", specializations: ["Cardiology"], rating: 4.7,
reviews: [] },
{ _id: 6, name: "Eagle Eye Hospital", city: "Nashik", specializations: ["Ophthalmology"], rating: 4.1,
reviews: [] },
{ _id: 7, name: "Hope Clinic", city: "Nashik", specializations: ["General"], rating: 3.5, reviews: [] },
{ _id: 8, name: "Vishwa Hospital", city: "Pune", specializations: ["Pediatric", "Gynaec"], rating: 4.6,
reviews: [] },
{ _id: 9, name: "Rainbow Hospital", city: "Nashik", specializations: ["Orthopedic", "Cardiology"], rating:
4.0, reviews: [] },
{ _id: 10, name: "LifeCare Hospital", city: "Nashik", specializations: ["Gynaec", "General"], rating: 3.9,
reviews: [] }
]);
]);
db.reviews.insertMany([
{ _id: 2, hospital_id: 2, reviewer_name: "Bob", rating: 4, comment: "Good service, but long wait
times." },
{ _id: 4, hospital_id: 4, reviewer_name: "David", rating: 4, comment: "Great for women's health." },
{ _id: 5, hospital_id: 5, reviewer_name: "Eve", rating: 5, comment: "Highly recommended for cardiac
issues." }
]);
});
b. List the names of all hospitals located in a specific city (e.g., "Nashik")
});
});
});
Slip 6
Create a web page being rendered in the browser consists of many things - logo, informative text,
pictures, hyperlinks, navigational structure and table.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
<style>
.logo {
}
</style>
</head>
<body>
<div class="container-fluid">
</a>
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav">
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</div>
</nav>
<p class="lead text-center">This is a simple web page created using HTML and Bootstrap. It
demonstrates various elements including a logo, informative text, pictures, and more!</p>
<h2>About Us</h2>
<p>We are dedicated to providing high-quality services to our clients. Our team is experienced and
ready to assist you with your needs.</p>
<div class="row">
<div class="col-md-6">
</div>
<div class="col-md-6">
</div>
</div>
<h3>Useful Links</h3>
<ul>
</ul>
<table class="table">
<thead>
<tr>
<th>Service</th>
<th>Description</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Service 1</td>
<td>$100</td>
</tr>
<tr>
<td>Service 2</td>
<td>$200</td>
</tr>
<tr>
<td>Service 3</td>
<td>$300</td>
</tr>
</tbody>
</table>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Model the following information as a document database. A customer can take different policies and get
the benefit. There are different types of policies provided by various companies
2. Assume appropriate attributes and collections as per the query requirements. [3]
a. List the details of customers who have taken “Komal Jeevan” Policy [3]
d. Count no. of customers who have taken policy type “half yearly”. [4]’
db.customers.insertMany([
{ _id: 1, name: "Amit Sharma", age: 30, address: "Nashik, Maharashtra", policies: [1, 2] },
{ _id: 2, name: "Sneha Patil", age: 25, address: "Nashik, Maharashtra", policies: [3] },
{ _id: 3, name: "Rohit Desai", age: 35, address: "Nashik, Maharashtra", policies: [2, 4] },
{ _id: 4, name: "Priya Joshi", age: 28, address: "Mumbai, Maharashtra", policies: [1, 5] },
{ _id: 5, name: "Rahul Verma", age: 40, address: "Nashik, Maharashtra", policies: [3, 4] }
]);
db.policies.insertMany([
{ _id: 1, policy_name: "Komal Jeevan", company: "ABC Insurance", premium_amount: 1000,
policy_type: "Monthly", customers: [1, 4] },
]);
a. List the details of customers who have taken the “Komal Jeevan” Policy
print("Customer Name: " + customer.name + ", Age: " + customer.age + ", Address: " +
customer.address);
});
]).toArray()[0].averagePremium;
db.policies.updateMany(
{ policy_type: "Monthly" },
);
d. Count the number of customers who have taken policy type “Half-Yearly”
var halfYearlyPolicy = db.policies.find({ policy_type: "Half-Yearly" }).toArray();
halfYearlyPolicy.forEach(policy => {
policy.customers.forEach(customerId => {
customerCount.add(customerId);
});
});
Slip 7
Create a 3D text, apply appropriate font, style, color. Use : Hover in the style selector so that the 3D
effects appear only when you hover over the text
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.text {
.text:hover {
</style>
</head>
<body>
</body>
</html>
Model the following information as a document database. A customer operates his bank account, does
various transactions and get the banking services
2. Assume appropriate attributes and collections as per the query requirements. [3]
a. List names of all customers whose first name starts with a “S” [3]
b. List all customers who has open an account on 1/1/2020 in ___branch [3]
db.customers.insertMany([
]);
db.accounts.insertMany([
]);
a. List names of all customers whose first name starts with an “S”
});
b. List all customers who opened an account on 1/1/2020 in a specific branch (e.g., "Nashik")
if (customer) {
});
});
d. Count the total number of loan account holders in a specific branch (e.g., "Nashik")
if (customer) {
loanAccountHolders.add(customer._id);
});
print("Total number of loan account holders in " + branch + ": " + loanAccountHolders.size);
Slip 8
Create a button with different style (Secondary, Primary, Success, Error, Info, Warning, Danger) using
BootStrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
</div>
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Model the following inventory information as a document database. The inventory keeps track of
various items. The items are tagged in various categories. Items may be kept in various warehouses and
each warehouse keeps track of the quantity of the item.
c. List all items having status equal to “B” or having quantity less than 50 and height of the product
should be greater than 8
d. Find all warehouse that keeps item “Planner” and having in stock quantity less than 20
{ _id: 1, name: "Notebook", category: "Stationery", tags: 4, quantity: 500, status: "A", height: 10 },
{ _id: 2, name: "Planner", category: "Stationery", tags: 6, quantity: 15, status: "B", height: 9 },
{ _id: 3, name: "Eraser", category: "Stationery", tags: 3, quantity: 1000, status: "A", height: 2 },
{ _id: 4, name: "Textbook", category: "Books", tags: 2, quantity: 250, status: "C", height: 12 },
{ _id: 5, name: "Markers", category: "Stationery", tags: 5, quantity: 30, status: "B", height: 8 }
]);
db.warehouses.insertMany([
{ _id: 1, name: "Warehouse A", location: "Nashik", items: [{ item_id: 1, quantity: 200 }, { item_id: 2,
quantity: 10 }] },
{ _id: 2, name: "Warehouse B", location: "Pune", items: [{ item_id: 3, quantity: 500 }, { item_id: 4,
quantity: 100 }] },
{ _id: 3, name: "Warehouse C", location: "Mumbai", items: [{ item_id: 1, quantity: 300 }, { item_id: 5,
quantity: 20 }] },
{ _id: 4, name: "Warehouse D", location: "Nashik", items: [{ item_id: 2, quantity: 15 }, { item_id: 4,
quantity: 150 }] },
{ _id: 5, name: "Warehouse E", location: "Nashik", items: [{ item_id: 1, quantity: 50 }, { item_id: 3,
quantity: 300 }] }
]);
});
});
c. List all items having status equal to “B” or having quantity less than 50 and height of the product
should be greater than 8
db.items.find({
$or: [
{ status: "B" },
}).forEach(item => {
print("Item Name: " + item.name + ", Status: " + item.status + ", Quantity: " + item.quantity + ",
Height: " + item.height);
});
d. Find all warehouses that keep item “Planner” and having in-stock quantity less than 20
db.warehouses.find({
items: {
}).forEach(warehouse => {
});
Slip 9
Write an HTML 5 program for student registration form for college admission. Use input type like search,
email, date etc
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
<style>
body {
.container {
margin-top: 50px;
</style>
</head>
<body>
<div class="container">
<form>
<div class="mb-3">
</div>
</div>
<div class="mb-3">
</div>
<div class="mb-3">
</div>
<div class="mb-3">
</div>
<div class="mb-3">
<label class="form-label">Gender</label>
<div>
</div>
<div>
<label for="female">Female</label>
</div>
<div>
<label for="other">Other</label>
</div>
</div>
<div class="mb-3">
</div>
<div class="text-center">
</div>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
. Model the following Customer Loan information as a documentdatabase. Consider Customer Loan
information system where the customer can take many types of loans.
2. Assume appropriate attributes and collections as per the query requirements [3]
4. Answer the following Queries. a. List all customers whose name starts with 'D' character [3]
b.List the names of customer in descending order who has taken a loan from Pimpri city. [3]
d.Update the address of customer whose name is “Mr. Patil” and loan_amt is greater than 100000. [4]
db.customers.insertMany([
{ _id: 1, name: "Dinesh Patil", address: "Nashik", email: "[email protected]", phone:
"1234567890" },
{ _id: 2, name: "Sneha Kulkarni", address: "Pune", email: "[email protected]", phone:
"0987654321" },
{ _id: 3, name: "Ravi Joshi", address: "Mumbai", email: "[email protected]", phone: "1122334455" },
{ _id: 4, name: "Deepa Patil", address: "Pimpri", email: "[email protected]", phone: "2233445566"
},
{ _id: 5, name: "Amit Sharma", address: "Nashik", email: "[email protected]", phone: "3344556677"
},
{ _id: 6, name: "Disha Shetty", address: "Nashik", email: "[email protected]", phone: "4455667788"
},
{ _id: 7, name: "Mr. Patil", address: "Pimpri", email: "[email protected]", phone: "5566778899" },
{ _id: 8, name: "Suresh Verma", address: "Mumbai", email: "[email protected]", phone:
"6677889900" },
{ _id: 9, name: "Kiran Singh", address: "Pune", email: "[email protected]", phone: "7788990011" },
{ _id: 10, name: "Deepak Gupta", address: "Pimpri", email: "[email protected]", phone:
"8899001122" }
]);
db.loans.insertMany([
{ _id: 1, customer_id: 1, loan_type: "Personal", loan_amount: 150000, city: "Nashik", date_taken: new
Date("2023-01-15") },
{ _id: 2, customer_id: 2, loan_type: "Home", loan_amount: 300000, city: "Pune", date_taken: new
Date("2022-03-10") },
{ _id: 3, customer_id: 3, loan_type: "Auto", loan_amount: 200000, city: "Mumbai", date_taken: new
Date("2022-05-22") },
{ _id: 4, customer_id: 4, loan_type: "Personal", loan_amount: 50000, city: "Pimpri", date_taken: new
Date("2023-04-01") },
{ _id: 5, customer_id: 5, loan_type: "Home", loan_amount: 400000, city: "Nashik", date_taken: new
Date("2021-12-15") },
{ _id: 6, customer_id: 6, loan_type: "Personal", loan_amount: 75000, city: "Nashik", date_taken: new
Date("2023-02-11") },
{ _id: 7, customer_id: 7, loan_type: "Auto", loan_amount: 120000, city: "Pimpri", date_taken: new
Date("2023-05-20") },
{ _id: 8, customer_id: 8, loan_type: "Personal", loan_amount: 30000, city: "Mumbai", date_taken: new
Date("2023-06-30") },
{ _id: 9, customer_id: 9, loan_type: "Home", loan_amount: 250000, city: "Pune", date_taken: new
Date("2023-07-14") },
{ _id: 10, customer_id: 10, loan_type: "Personal", loan_amount: 90000, city: "Pimpri", date_taken:
new Date("2023-08-05") }
]);
Step 3: Queries
b. List the names of customers in descending order who have taken a loan from Pimpri city
db.customers.aggregate([
{
$lookup: {
from: "loans",
localField: "_id",
foreignField: "customer_id",
as: "loan_info"
}
},
{ $unwind: "$loan_info" },
{ $match: { "loan_info.city": "Pimpri" } },
{ $sort: { name: -1 } },
{ $project: { name: 1 } }
]).forEach(customer => {
print("Customer Name: " + customer.name);
});
d. Update the address of the customer whose name is “Mr. Patil” and loan amount is greater than
100000
db.customers.updateOne(
{ name: "Mr. Patil" },
{ $set: { address: "Updated Address, Pimpri" } },
{ $currentDate: { lastModified: true } } // Optional: To track when the update was made
);
db.loans.updateMany(
{ customer_id: db.customers.findOne({ name: "Mr. Patil" })._id, loan_amount: { $gt: 100000 } },
{ $set: { updated: true } } // Optional: If you want to mark the loans as updated
);
Slip 10
Create a web page that shows use of transition properties, transition delay and duration effect.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.card {
width: 300px;
height: 200px;
display: flex;
justify-content: center;
align-items: center;
transition: background-color 0.5s ease, transform 0.5s ease, box-shadow 0.5s ease; /* Transition
properties */
.card:hover {
.card:active {
.delayed-transition {
transition: background-color 1s ease 0.5s; /* 1 second duration with 0.5 second delay */
}
.delayed-transition:hover {
</style>
</head>
<body>
<div class="card">
<div class="content">
</div>
</div>
<div class="content">
</div>
</div>
</body>
</html>
1. Model the following Online shopping information as a document database. Consider online shopping
where the customer can get different products from different brands. Customers can rate the brands
and products
2. Assume appropriate attributes and collections as per the query requirements [3]
c. Display the names of products with brand which have highest rating. [4]
db.products.insertMany([
{ _id: 1, name: "Smartphone", brand_id: 1, warranty_period: 1, rating: 4.5 },
{ _id: 2, name: "Laptop", brand_id: 2, warranty_period: 2, rating: 4.7 },
{ _id: 3, name: "Headphones", brand_id: 3, warranty_period: 1, rating: 4.2 },
{ _id: 4, name: "Smartwatch", brand_id: 1, warranty_period: 1, rating: 4.8 },
{ _id: 5, name: "Tablet", brand_id: 2, warranty_period: 1, rating: 4.1 }
]);
db.brands.insertMany([
{ _id: 1, name: "TechBrand A", average_rating: 4.7 },
{ _id: 2, name: "TechBrand B", average_rating: 4.5 },
{ _id: 3, name: "AudioBrand C", average_rating: 4.2 },
{ _id: 4, name: "GadgetBrand D", average_rating: 4.6 },
{ _id: 5, name: "WearableBrand E", average_rating: 4.9 }
]);
db.customers.insertMany([
{ _id: 1, name: "John Doe", city: "Pune", purchases: [{ product_id: 1, purchase_date: new Date("2023-
08-15"), bill_amount: 45000 }] },
{ _id: 2, name: "Jane Smith", city: "Mumbai", purchases: [{ product_id: 2, purchase_date: new
Date("2023-07-20"), bill_amount: 75000 }] },
{ _id: 3, name: "David Brown", city: "Nashik", purchases: [{ product_id: 3, purchase_date: new
Date("2023-08-15"), bill_amount: 15000 }] },
{ _id: 4, name: "Emily Davis", city: "Pune", purchases: [{ product_id: 4, purchase_date: new
Date("2023-06-15"), bill_amount: 25000 }] },
{ _id: 5, name: "Michael Wilson", city: "Mumbai", purchases: [{ product_id: 5, purchase_date: new
Date("2023-05-10"), bill_amount: 60000 }] }
]);
Step 3: Queries
c. Display the names of products with the brand which has the highest rating
d. Display customers who stay in a specific city and have a bill amount greater than 50000
db.customers.find({
city: targetCity,
"purchases.bill_amount": { $gt: 50000 }
}).forEach(customer => {
print("Customer Name: " + customer.name + ", City: " + customer.city);
});
Slip 13
Create a useful web with the following information and structure using HTML5 tags like ,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Online Bookstore</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
<style>
body {
background-color: #f8f9fa; /* Light background color */
footer {
nav {
nav a {
nav a:hover {
.aside {
</style>
</head>
<body>
</header>
<div class="container">
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</div>
</nav>
<section>
<h2>Featured Books</h2>
<div class="row">
<div class="col-md-4">
<div class="card-body">
</div>
</div>
</div>
<div class="col-md-4">
<div class="card-body">
</div>
</div>
</div>
<div class="col-md-4">
<div class="card-body">
</div>
</div>
</div>
</div>
</section>
<aside class="mt-4">
<h2>About Us</h2>
<p>We are dedicated to providing a wide selection of books at great prices. Our mission is to
promote reading and literacy in our community.</p>
</aside>
</main>
<footer class="text-center">
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Model the following Student Competition information as a document database. Consider Student
competition information where the student can participate in many competitions.
2. Assume appropriate attributes and collections as per the query requirements [3]
d. Display students from class 'FY’ and participated in 'E-Rangoli ' Competition. [4]
db.students.insertMany([
{ _id: 1, name: "Alice Johnson", class: "FY", email: "[email protected]" },
{ _id: 2, name: "Bob Smith", class: "FY", email: "[email protected]" },
{ _id: 3, name: "Charlie Brown", class: "SY", email: "[email protected]" },
{ _id: 4, name: "Daisy Miller", class: "FY", email: "[email protected]" },
{ _id: 5, name: "Ethan Wilson", class: "TY", email: "[email protected]" },
{ _id: 6, name: "Fiona Lee", class: "FY", email: "[email protected]" },
{ _id: 7, name: "George Taylor", class: "SY", email: "[email protected]" },
{ _id: 8, name: "Hannah Clark", class: "TY", email: "[email protected]" },
{ _id: 9, name: "Isaac Green", class: "FY", email: "[email protected]" },
{ _id: 10, name: "Jack White", class: "SY", email: "[email protected]" }
]);
db.competitions.insertMany([
{ _id: 1, name: "Coding Challenge", date: new Date("2023-09-15"), winners: [] },
{ _id: 2, name: "E-Rangoli", date: new Date("2023-09-20"), winners: [] },
{ _id: 3, name: "Debate Competition", date: new Date("2023-09-25"), winners: [] },
{ _id: 4, name: "Art Fest", date: new Date("2023-09-30"), winners: [] },
{ _id: 5, name: "Sports Meet", date: new Date("2023-10-05"), winners: [] }
]);
db.participation.insertMany([
{ _id: 1, student_id: 1, competition_id: 1, rank: 1 },
{ _id: 2, student_id: 2, competition_id: 1, rank: 2 },
{ _id: 3, student_id: 3, competition_id: 2, rank: 1 },
{ _id: 4, student_id: 1, competition_id: 2, rank: 3 },
{ _id: 5, student_id: 4, competition_id: 3, rank: 1 },
{ _id: 6, student_id: 5, competition_id: 3, rank: 2 },
{ _id: 7, student_id: 6, competition_id: 4, rank: 1 },
{ _id: 8, student_id: 7, competition_id: 4, rank: 2 },
{ _id: 9, student_id: 8, competition_id: 5, rank: 1 },
{ _id: 10, student_id: 9, competition_id: 5, rank: 2 }
]);
Step 3: Queries
db.competitions.aggregate([
{
$lookup: {
from: "participation",
localField: "_id",
foreignField: "competition_id",
as: "participants"
}
},
{
$project: {
name: 1,
average_participants: { $avg: { $size: "$participants" } }
}
}
]).forEach(competition => {
print("Competition Name: " + competition.name + ", Average Participants: " +
competition.average_participants);
});
db.competitions.find().forEach(competition => {
print("Competition Name: " + competition.name);
var winners = db.participation.find({ competition_id: competition._id }).sort({ rank: 1 }).limit(3);
winners.forEach(winner => {
var student = db.students.findOne({ _id: winner.student_id });
print("Winner: " + student.name + ", Rank: " + winner.rank);
});
});
Slip 18
Create a web page, place an image in center and apply 2d transformation on it. (rotation, scaling,
translation)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
.image-container {
}
.image {
.image-container:hover .image {
.caption {
top: 10px;
left: 10px;
</style>
</head>
<body>
<div class="image-container">
</div>
</body>
</html>
Model the following Doctor’s information system as a graph model, and answer the following queries
using Cypher. Consider the doctors in and around Pune. Each Doctor is specialized in some stream like
Pediatric, Gynaec, Heart Specialist, Cancer Specialist, ENT, etc. A doctor may be a visiting doctor across
many hospitals or he may own a clinic. A person can provide a review/can recommend a doctor.
1. Identify the labels and relationships, along with their properties, and draw a high-level Graph model.
2. Create nodes and relationships, along with their properties, and visualize your actual Graph model. [3]
3. Answer the Queries
(:Doctor {name: "Dr. Smith", specialization: "Orthopedic", area: "Pune", experience_years: 10})
-[:VISITS {days_per_week: 3}]->
(:Hospital {name: "HealthCare Hospital", location: "Pune", type: "multi-specialty"})
(:Doctor {name: "Dr. Johnson", specialization: "Pediatrics", area: "Pune", experience_years: 5})
-[:OWNS]->
(:Clinic {name: "Kids Clinic", location: "Pune", type: "private"})
Assuming we are using Neo4j, below is how you can create nodes and relationships with properties.
// Create Doctors
CREATE (:Doctor {name: "Dr. Smith", specialization: "Orthopedic", area: "Pune", experience_years: 10}),
(:Doctor {name: "Dr. Johnson", specialization: "Pediatrics", area: "Pune", experience_years: 5}),
(:Doctor {name: "Dr. Patel", specialization: "Heart Specialist", area: "Pune", experience_years: 15}),
(:Doctor {name: "Dr. Verma", specialization: "Cancer Specialist", area: "Pune", experience_years: 8}),
(:Doctor {name: "Dr. Gupta", specialization: "ENT", area: "Pune", experience_years: 6});
// Create Hospitals
CREATE (:Hospital {name: "HealthCare Hospital", location: "Pune", type: "multi-specialty"}),
(:Hospital {name: "City Hospital", location: "Pune", type: "general"}),
(:Hospital {name: "Heart Institute", location: "Pune", type: "specialty"}),
(:Hospital {name: "Cancer Center", location: "Pune", type: "specialty"});
// Create Clinics
CREATE (:Clinic {name: "Kids Clinic", location: "Pune", type: "private"}),
(:Clinic {name: "Wellness Clinic", location: "Pune", type: "private"});
// Create Patients
CREATE (:Patient {name: "Alice", age: 30, gender: "female"}),
(:Patient {name: "Bob", age: 40, gender: "male"});
// Create Relationships
MATCH (d:Doctor {name: "Dr. Smith"}), (h:Hospital {name: "HealthCare Hospital"})
CREATE (d)-[:VISITS {days_per_week: 3}]->(h);
MATCH (d:Doctor {name: "Dr. Johnson"}), (r:Review {rating: 5, comment: "Excellent care", date: "2023-
10-01"})
CREATE (d)-[:HAS_REVIEW]->(r);
// Repeat similar CREATE statements for other doctors, clinics, and relationships.
Step 3: Answering Queries
MATCH (d:Doctor)-[:VISITS]->(h:Hospital)
WITH d, COUNT(h) AS hospitalCount
WHERE hospitalCount > 2
RETURN d.name AS Doctors_Visiting_More_Than_2_Hospitals;
Slip 21
Write a css3 script for the student registration form with appropriate message display also high light
compulsory fields in a different color
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Registration Form</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
rel="stylesheet">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f8f9fa; /* Light background color */
margin: 0;
padding: 20px;
}
.container {
max-width: 600px;
margin: 0 auto; /* Center the container */
background-color: #fff; /* White background for the form */
padding: 20px;
border-radius: 8px; /* Rounded corners */
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Shadow for depth */
}
h2 {
text-align: center; /* Center the heading */
color: #333; /* Dark text color */
}
label {
display: block;
margin-bottom: 8px; /* Space between label and input */
color: #333; /* Dark text color */
}
input[type="text"],
input[type="email"],
input[type="date"],
input[type="tel"],
select,
textarea {
width: 100%; /* Full width inputs */
padding: 10px;
margin-bottom: 20px; /* Space below inputs */
border: 1px solid #ccc; /* Light border */
border-radius: 4px; /* Rounded corners */
transition: border-color 0.3s; /* Transition effect for border color */
}
input:focus {
border-color: #007bff; /* Blue border on focus */
outline: none; /* Remove default outline */
}
.compulsory {
color: red; /* Red color for compulsory fields */
}
.message {
color: green; /* Green message text */
text-align: center; /* Center the message */
margin: 10px 0; /* Space around the message */
display: none; /* Hidden by default */
}
.button-container {
display: flex;
justify-content: space-between; /* Space between buttons */
}
button {
background-color: #007bff; /* Blue button */
color: white; /* White text */
padding: 10px 20px; /* Padding for buttons */
border: none; /* No border */
border-radius: 4px; /* Rounded corners */
cursor: pointer; /* Pointer cursor */
transition: background-color 0.3s; /* Transition effect for background */
}
button:hover {
background-color: #0056b3; /* Darker blue on hover */
}
button[type="reset"] {
background-color: #dc3545; /* Red button for reset */
}
button[type="reset"]:hover {
background-color: #c82333; /* Darker red on hover */
}
</style>
</head>
<body>
<div class="container">
<h2>Student Registration Form</h2>
<form id="registrationForm">
<label for="name">Name <span class="compulsory">*</span></label>
<input type="text" id="name" required>
<label for="comments">Comments</label>
<textarea id="comments" rows="4"></textarea>
<div class="button-container">
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</div>
</form>
<div class="message" id="successMessage">Registration Successful!</div>
</div>
<script>
// JavaScript to handle form submission
document.getElementById('registrationForm').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent form from submitting normally
document.getElementById('successMessage').style.display = 'block'; // Show success message
this.reset(); // Reset form fields
});
</script>
</body>
</html>
Model the following Medical information as a graph model, and answerthe following queries using
Cypher. There are various brands of medicine like Dr. Reddy, Cipla, SunPharma etc. Their uses vary
across different states in India. The uses of medicine is measuredas %, with a high use defined as >=90%,
Medium Use between 50 to 90%, and Low UseEach medicine manufactures various types of medicine
products like Tablet, Syrup, and Powder etc.
1. Identify the labels and relationships, along with their properties, and drawa high-level Graph model.
[3]
2. Create nodes and relationships, along with their properties, and visualize your actual Graph model. [3]
3. Answer the following queries using Cypher:
a. List the names of different medicines considered in your graph [3]
b. List the medicine that are highly Used in Rajasthan. [3]
c. List the highly used tablet in Gujarat. [4]
d. List the medicine names manufacturing “Powder” [4]
Using Neo4j, you can create the nodes and relationships with properties as follows:
// Create States
CREATE (:State {name: "Rajasthan"}),
(:State {name: "Gujarat"}),
(:State {name: "Maharashtra"}),
(:State {name: "Karnataka"}),
(:State {name: "Tamil Nadu"});
MATCH (m:MedicineBrand)
RETURN m.name AS Medicine_Brand;
b. List the medicines that are highly used in Rajasthan (usage >= 90%)
MATCH (p:MedicineProduct)-[:USED_IN]->(s:State {name: "Rajasthan"})
WHERE p.use_percentage >= 90
RETURN p.type AS Highly_Used_Medicine;
Slip 22
Create a web page to create 3D text. Apply all text effects like text shadow, text overflow, wordwrap etc
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
display: flex;
margin: 0;
}
.text-container {
.text {
text-shadow:
.text-overflow {
.word-wrap {
word-wrap: break-word; /* Allow word breaking */
</style>
</head>
<body>
<div class="text-container">
<div class="text-overflow">This text might overflow and will show an ellipsis if it does!</div>
<div class="word-wrap">This is an example of a really long text that should wrap into multiple lines if
it exceeds the width of the container. Let's see how it handles word wrapping!</div>
</div>
</body>
</html>
Model the following Car Showroom information as a graph model,and answer the queries using Cypher.
Consider a car showroom with different models of cars like sofas Honda city, Skoda, Creta, Swift, Ertiga
etc. Showroom is divided into different sections, onesection for each car model; each section is handled
by a sales staff. Asales staff can handle one or more sections. Customer may enquire about car. An
enquiry may result in a purchase by the customer.
1. Identify the labels and relationships, along with their properties, and draw a high-level Graph model.
[3]
2. Create nodes and relationships, along with their properties, and visualize your actual Graph model. [3]
3. Answer the following queries:
c. List the names of customers who have done only enquiry but not made any purchase. [4]
Using Neo4j, you can create the nodes and relationships with properties as follows:
// Create Sections
CREATE (:Section {name: "Sedans", location: "Main Floor"}),
(:Section {name: "Hatchbacks", location: "Ground Floor"}),
(:Section {name: "SUVs", location: "Upper Floor"}),
(:Section {name: "MPVs", location: "First Floor"});
// Create Customers
CREATE (:Customer {name: "Alice", customer_id: "C001"}),
(:Customer {name: "Bob", customer_id: "C002"}),
(:Customer {name: "Charlie", customer_id: "C003"});
// Create Enquiries
CREATE (:Enquiry {date: "2023-10-01", status: "resolved"}),
(:Enquiry {date: "2023-10-05", status: "pending"});
// Create Purchases
CREATE (:Purchase {date: "2023-10-02", amount: 100000});
// Create Relationships
MATCH (s:SalesStaff {name: "Mr. Narayan"}), (sec:Section {name: "Hatchbacks"})
CREATE (s)-[:HANDLES]->(sec);
MATCH (m:CarModel)
RETURN DISTINCT m.type AS Car_Types;
c. List the names of customers who have done only enquiry but not made any purchase
MATCH (c:Customer)-[:MAKES_ENQUIRY]->(e:Enquiry)
WHERE NOT (c)-[:PURCHASED]->(:CarModel)
RETURN c.name AS Customers_With_Enquiry_Only;
d. List the highly sold car model
Assuming we define "highly sold" as a car model that has at least one purchase associated with it:
MATCH (c:Customer)-[:PURCHASED]->(m:CarModel)
RETURN m.name AS Highly_Sold_Car_Model, COUNT(c) AS Sales_Count
ORDER BY Sales_Count DESC
LIMIT 1;