Sample Question Paper Mid-Term Test 1
Sample Question Paper Mid-Term Test 1
A web server is a software or hardware system that stores, processes, and delivers
web pages to users over the Internet. It responds to client requests (usually from
web browsers) using the HTTP/HTTPS protocols.
1. Hosting Websites – Stores and serves website files (HTML, CSS, JavaScript).
3. Running Server-Side Code – Supports dynamic content using languages like PHP,
Node.js, or Python.
Example: Apache, Nginx, Microsoft IIS, and LiteSpeed are popular web servers.
✅ Technologies Used:
HTML (Structure)
CSS (Styling)
JavaScript (Interactivity)
✅ Example:
A login page with a form, styled buttons, and animations built using HTML, CSS, and
JavaScript.
Back-end development deals with the server, database, and application logic that
power a website.
✅ Technologies Used:
✅ Example:
A back-end login system that verifies user credentials, interacts with a database, and
sends a response to the front end.
The Internet is a global network that connects computers and devices, allowing them
to communicate and exchange data. It works using a combination of network
infrastructure, protocols, and servers.
1. User Request: When you enter a URL (e.g., www.google.com), your browser sends a
request.
2. DNS Resolution: The Domain Name System (DNS) translates the domain name into
an IP address (e.g., 172.217.160.78).
3. Data Routing: The request is sent through a series of routers and networks using the
TCP/IP protocol.
4. Server Processing: The web server receives the request, processes it, and retrieves
the required web page or data.
5. Response Sent Back: The web server sends the data back to your browser using the
HTTP/HTTPS protocol.
6. Page Rendering: The browser receives the response and displays the web page.
Key Protocols:
<img src="image.jpg">
Example of XHTML:
<img src="image.jpg" />
Conclusion:
SVG (Scalable Vector Graphics) is an XML-based format used to create vector images
that can be scaled without losing quality. It is commonly used in web development
for icons, logos, charts, and animations.
</svg>
svg {
fill: blue;
stroke: black;
stroke-width: 2px;
</circle>
</svg>
CSS (Cascading Style Sheets) is used to style and format web pages, enhancing their
visual appeal and user experience.
5. Boosts Performance – Reduces page load times by replacing bulky inline styles with
external stylesheets.
body {
background-color: lightblue;
text-align: center;
}
✅ Changes the background color, font, and text alignment of a web page.
The CSS Box Model is a fundamental concept in web design that describes how
HTML elements are structured and spaced. It consists of four layers around each
element:
| |
| | Padding | |
| | | Text | | |
| | +----------+ | |
| +------------------+ |
| |
+------------------------+
.box {
width: 200px;
padding: 10px;
margin: 20px;
}
✅ Total width = 200px + 10px (padding) + 5px (border) + 20px (margin) = 250px
The Box Model is essential for layout design, spacing, and positioning in web
development.
/* Default styles */
body {
background-color: lightblue;
body {
background-color: pink;
✅ If the screen width is 600px or less, the background color changes to pink.
Version control is a system that tracks changes to files, allowing developers to manage
and collaborate on code efficiently. It enables teams to:
✅ Track modifications over time
✅ Revert to previous versions
✅ Work collaboratively without conflicts
1. History Tracking – Keeps a record of all changes, making it easy to review previous
versions.
3. Error Recovery – If a mistake is made, you can roll back to a previous version.
4. Branching & Merging – Developers can work on different features separately and
merge them later.
5. Backup & Security – Ensures a safe copy of the project is always available.
git init
git add .
✅ This tracks changes and stores the project in GitHub or GitLab for
collaboration.
1. Front-End (Client-Side)
The front-end is responsible for the visual and interactive part of the website that
users interact with.
✅ Technologies Used:
🔹 Example: A navigation bar and form built using HTML, CSS, and JavaScript.
2. Back-End (Server-Side)
The back-end handles the logic, authentication, and communication with the
database.
✅ Technologies Used:
Programming Languages: Node.js, Python, PHP, Java
3. Database Management
✅ Types of Databases:
✅ Hosting Platforms:
✅ Tools Used:
🔹 Example: Using GitHub for collaborative coding and Heroku for automated
deployment.
Conclusion:
An HTML document is structured using different tags to define its elements. The
basic structure includes:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
<form>
<button type="submit">Submit</button>
</form>
</body>
</html>
Tag Purpose
<meta
Makes the page responsive.
name="viewport">
Conclusion:
This basic HTML document forms the foundation for any web page. You can enhance
it with CSS for styling and JavaScript for interactivity.
3. Write HTML code to create a table with four rows and three columns.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Table</title>
<style>
table {
width: 50%;
border-collapse: collapse;
margin: 20px 0;
th, td {
padding: 10px;
text-align: center;
th {
background-color: lightgray;
</style>
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>Age</th>
<th>Grade</th>
</tr>
<tr>
<td>John Doe</td>
<td>20</td>
<td>A</td>
</tr>
<tr>
<td>Jane Smith</td>
<td>22</td>
<td>B</td>
</tr>
<tr>
<td>David Lee</td>
<td>21</td>
<td>A</td>
</tr>
<tr>
<td>Emma Brown</td>
<td>19</td>
<td>B+</td>
</tr>
</table>
</body>
</html>
CSS Styling:
4. What are the different types of Internet protocols? Explain any two.
Internet protocols are a set of rules that govern how data is transmitted over the
internet. Some important types of internet protocols include:
✅ Purpose:
TCP/IP is the foundation of internet communication. It ensures data is transmitted
correctly between devices over a network.
✅ How It Works:
TCP breaks data into packets and ensures they reach the destination in the correct
order.
✅ Example:
When you visit a website, TCP ensures the webpage data is delivered correctly, and IP
routes the data to the correct destination.
✅ Purpose:
HTTP is used for transferring web pages from a server to a browser, while HTTPS is
the secure version that encrypts data for protection.
✅ How It Works:
When you enter a URL in a browser, HTTP requests the webpage from the server.
The server responds with the webpage data, which is then displayed in the browser.
✅ Example:
Conclusion:
5. How can images and links be added to an HTML page? Provide code snippets.
6. Discuss the use of CSS classes and IDs with suitable examples.
1. Padding
✅ Padding is the space between the content of an element and its border.
✅ It creates inner spacing within an element.
📌 Example:
.box {
background-color: lightblue;
padding: 20px; /* Adds 20px space inside the border */
}
✅ Visual Representation:
[ Border ]
[ Padding ]
[ Content ]
2. Margin
📌 Example:
.box {
background-color: lightblue;
margin: 30px; /* Adds 30px space around the element */
}
✅ Visual Representation:
[ Margin ]
[ Border ]
[ Padding ]
[ Content ]
Difference between Padding and Margin:
Padding: Increases the size of the element itself.
Margin: Moves the element away from others without changing its size.
3. Alignment in CSS
Alignment in CSS is used to position text, images, and elements horizontally or
vertically.
Text Alignment (text-align)
✅ Used for aligning text inside an element.
p{
text-align: center; /* Centers the text */
}
Block Alignment (margin: auto;)
✅ Used to center block elements.
.container {
width: 50%;
margin: auto; /* Centers the div horizontally */
}
Flexbox Alignment (Modern Approach)
✅ Used for advanced layouts.
.container {
display: flex;
justify-content: center; /* Centers horizontally */
align-items: center; /* Centers vertically */
height: 100vh;
}
Conclusion:
✔ Padding = Space inside the element.
✔ Margin = Space outside the element.
✔ Alignment = Controls positioning of elements.
8. What are HTML5 form controls and how do they simplify form validation?
✅ 1. Built-in Validation:
Example
✅ 2. required Attribute:
Example:
Example
<label for="password">Password:</label>
<input type="password" id="password" required minlength="6">
<label for="age">Age:</label>
<input type="number" id="age" min="18" max="100" required>
<button type="submit">Submit</button>
</form>
Conclusion
✔ HTML5 form controls reduce the need for JavaScript validation.
✔ They improve user experience with built-in error messages.
✔ Developers can create secure, structured forms easily.
1. Create a simple HTML page with proper text markup, links, images, and embedded
media.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 20px;
img {
width: 300px;
display: block;
margin: 10px 0;
video {
width: 400px;
display: block;
</style>
</head>
<body>
<p>This is an example of an HTML page with text markup, links, images, and
embedded media.</p>
<h2>About Me</h2>
<p>I am learning web development and this is my first webpage.</p>
<h2>Useful Links</h2>
<h2>Embedded Video</h2>
<video controls>
<source src="https://www.w3schools.com/html/mov_bbb.mp4"
type="video/mp4">
</video>
<h2>Contact Me</h2>
<form>
<label for="name">Name:</label>
<label for="email">Email:</label>
<button type="submit">Submit</button>
</form>
</body>
</html>
Key Features in This Page:
2. Explain the process of web hosting and the role of domain names and DNS.
Web hosting is the process of making a website accessible on the internet. It involves
storing website files on a web server and linking them to a domain name for easy
access.
Web hosting is a service provided by hosting companies that allows individuals and
businesses to store website files (HTML, CSS, JavaScript, images, videos, etc.) on a
server. These servers are always connected to the internet, allowing users to access
websites anytime.
Cloud Hosting: Websites are hosted across multiple servers for reliability.
📌 Example:
A hosting provider like Bluehost, Hostinger, or AWS offers storage and services to
host your website.
Subdomain: blog.example.com
📌 Example:
DNS (Domain Name System) is like the "phonebook of the internet." It translates
domain names into IP addresses that computers use to communicate.
3. The DNS server finds the IP address of the website (e.g., 192.168.1.1).
4. The browser connects to the web server and loads the website.
✅ DNS Components:
📌 Example:
Typing www.facebook.com triggers a DNS lookup, which fetches Facebook's IP
address, allowing the browser to load the website.
Conclusion
3. Describe how JavaScript can be used to create dynamic web pages. Provide code
examples.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<h1 id="heading">Hello, Welcome to My Website!</h1>
<script>
function changeText() {
</script>
</body>
</html>
📌 How it Works?
✔ When the button is clicked, JavaScript changes the text inside the <h1> tag
dynamically.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Form Validation</title>
</head>
<body>
<button type="submit">Submit</button>
</form>
<p id="message"></p>
<script>
function validateForm() {
return false;
return true;
</script>
</body>
</html>
📌 How it Works?
✔ If the user tries to submit an empty name, an error message appears without
reloading the page.
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script>
function changeColor() {
document.body.style.backgroundColor = "lightblue";
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script>
function changeColor() {
document.body.style.backgroundColor = "lightblue";
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Fetch Data</title>
</head>
<body>
<p id="data"></p>
<script>
function loadData() {
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(data => {
});
</script>
</body>
</html>
📌 How it Works?
✔ JavaScript fetches data from a fake API and updates the webpage dynamically
without refreshing.
3. Why JavaScript is Important for Dynamic Pages?
Conclusion
4. What are CSS transformations and transitions? Create a simple animation using CSS.
CSS transformations and transitions are used to create animations and interactive
effects in web design without requiring JavaScript.
📌 Example:
.box {
width: 100px;
height: 100px;
background-color: red;
transform: rotate(45deg);
✅ Key Properties:
📌 Example:
.box {
width: 100px;
height: 100px;
background-color: red;
.box:hover {
background-color: blue;
✔ When hovered, the box smoothly changes color from red to blue over 1 second.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS Animation</title>
<style>
body {
text-align: center;
margin-top: 50px;
.box {
width: 100px;
height: 100px;
background-color: red;
position: relative;
.box:hover {
background-color: blue;
</style>
</head>
<body>
<h2>Hover Over the Box</h2>
<div class="box"></div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS Animation</title>
<style>
body {
text-align: center;
margin-top: 50px;
.box {
width: 100px;
height: 100px;
background-color: red;
position: relative;
.box:hover {
background-color: blue;
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
📌 How It Works?
✔ The box moves right (translateX) and rotates (360deg) when hovered.
✔ The background color changes from red to blue smoothly.
Conclusion
5. Discuss the importance of responsive web design and how CSS media queries help
achieve it.
Answer:
Responsive Web Design (RWD) ensures that a website adapts to different screen sizes
(desktops, tablets, and smartphones) for a seamless user experience.
✅ Key Features of RWD:
CSS media queries allow developers to apply different styles based on screen size,
resolution, or device type.
body {
background-color: lightblue;
📌 How It Works?
✔ If the screen width is 768px or less, the background color changes to light blue.
4. Example: Responsive Navigation Menu
This example demonstrates how media queries change navigation for smaller screens.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
text-align: center;
.menu {
background-color: #333;
padding: 10px;
.menu a {
color: white;
text-decoration: none;
display: inline-block;
}
@media (max-width: 600px) {
.menu a {
display: block;
padding: 15px;
text-align: center;
</style>
</head>
<body>
<div class="menu">
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Contact</a>
</div>
</body>
</html>
📌 How It Works?
✔ On large screens, menu links are displayed horizontally.
✔ On small screens (max-width: 600px), menu links become stacked vertically.
6. Conclusion