Web Tech MID Term Exam FA23 - Solution
Web Tech MID Term Exam FA23 - Solution
Web Tech MID Term Exam FA23 - Solution
(Part a) Choose the best answers. Each part carries only ONE correct answer. (10 Marks)
1. _____________ are computers that store and serve web content to users when requested.
a. Web Page b. Web Server c. WWW d. Local Server
2. _________ is a frontend framework / library used for web application development.
a. Node JS b. Vue JS c. Express JS d. Django
3. What is the correct syntax to write an HTML comment?
a. /* comment */ b. <! - - comment - - > c. // comment d. All of the above
4. What are the types of unordered lists in HTML?
a. circle, square, disk b. triangle, square, disk c. oval, triangle, disk d. All of the above
5. If a background image is smaller than the screen on which it is being displayed, what will
occur on the webpage?
a. The blank space will be shown in black. b. They can be used for text only.
c. They can be repeated. d. None of the above
6. How can we select an element with a specific ID in CSS?
a. ^ b. # c. . d. None of these
7. In the below code snippet, in what order will the margins be added?
(Part a) Trace out the output of the following code snippet. Give Brief Explanation also. (10 Marks)
<!DOCTYPE html>
<html>
<head>
<title>Complex Web Code</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
body { background-color: #f0f0f0; }
.container { margin-top: 30px; }
</style>
</head>
<body>
<div class="container">
<h1 class="text-center">Complex Web
Code</h1>
<form id="myForm">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" placeholder="Enter your name">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" placeholder="Enter your email">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<div id="message" class="mt-3"></div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.1/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
document.getElementById('myForm').addEventListener('submit', function (e) {
e.preventDefault();
var name = document.getElementById('name').value;
var email = document.getElementById('email').value;
if (name && email) {
document.getElementById('message').innerHTML = `<div class="alert alert-success">Form submitted successfully.
Name: ${name}, Email: ${email}</div>`;
} else {
document.getElementById('message').innerHTML = `<div class="alert alert-danger">Please fill in all fields.</div>`;
}
});
</script> </body> </html>
(Part b) Find out any 05 hidden errors from the code. Also, rewrite the correct code. (10 Marks)
<!DOCTYPE html>
<html>
<head>
<title>Error-Filled Code</title>
<link rel="stylesheet" href="style.css"> you need to provide a valid path to your stylesheet.
</head>
<body>
<h1>Error-Filled Code</h1>
<div class="container">
<div class="row">
<div class="col-md-6"> You're using Bootstrap grid classes like "col-md-6," but you haven't included Bootstrap in
your project. Add Bootstrap CDNs to include Bootstrap or at least mention this issue.
<label for="name">Name:</label>
</div>
<div class="col-md-6">
<label for="email">Email:</label>
</div>
</div>
<button class="btn btn-primary">Submit</button> You have a submit button outside the form element, which may not
work as expected.
@csrf In the form section, you have an "@" symbol before "csrf" . Remove "@" before "csrf."
<input type="email" name="email" placeholder="Enter your email"> a missing "name" attribute for the second input
element.
</form>
</div>
</body>
</html>
(Part c) Understand the Scenario below and give code according to requirements. (20 Marks)
Scenario:
You are a developer working on a hospital management system. The system is responsible for
managing the records. The hospital wants to improve its digital infrastructure to streamline its
operations. You are tasked with designing and implementing the software.
Questions:
(i) What are the entities in the hospital management system scenario?
// Patient Model
php artisan make:model Patient
// Doctor Model
php artisan make:model Doctor
// Appointment Model
php artisan make:model Appointment
(iii) Write code to create controllers for the chosen entities in question ii.
// Patient Controller
php artisan make:controller PatientController
// Doctor Controller
php artisan make:controller DoctorController
// Appointment Controller
php artisan make:controller AppointmentController
(iv) For the 'ODD registration number' entities, write code for creating and updating records
for 2 of the chosen entities in question iii.
For the 'EVEN registration number' entities, write code for reading and deleting records
for 2 of the chosen entities in question iii.
(v) What is the command for to make changes to the schema of an entity?