Web Development Essentials - DIT 2nd Term 2026 (Fully Solved). This paper covers HTML, CSS, JavaScript, Web Browser, Web Server, Search Engine, Box Model, Cookies and Forms. Complete exam-ready answers for Part-A, Part-B and Part-C are given below.
b) <a> - Anchor tag. Example: <a href="...">
b) parseInt() - Correct: parseInt("123")
c) color - Example: p { color: red; }
c) ID - # = ID, . = Class
c) Math.max() - Math.max(10,20,5) = 20
c) <footer>
c) for (let i=0; i<5; i++)
b) Padding - Margin = outside, Padding = inside
b) content is fixed and remains the same
c) SMTP - Simple Mail Transfer Protocol
False - JavaScript is primarily a client-side language. It can be used on server-side with Node.js, but not only server-side.
False - <br> is a self-closing / void tag. It does not need </br>.
True
False - It is linked using <link> tag. Example: <link rel="stylesheet" href="style.css">. <script> is for JS.
True
Web Browser: A software application on client side used to access and display websites. It sends requests to servers. Example: Chrome, Firefox, Edge. Web Server: A computer/software on server side that stores website files and responds to browser requests. It sends HTML, CSS, JS files back to browser. Example: Apache, Nginx. Browser = Requests, Server = Responds.
The <form> tag is used to create an interactive form to collect user input and send it to a server for processing. It can contain input fields like text boxes, password, radio buttons, checkboxes, submit button etc. Attributes: action (where to send data), method (GET / POST).
External CSS is written in a separate .css file and linked to HTML using <link> tag inside <head>.
p { color: blue; }
Step 2: Link in HTML
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
This is best for maintaining large websites.
A variable is a container to store data. In JS we declare it with var, let, const. let: Value can be changed/reassigned. Block scoped. Example: let age = 20; age = 21; const: Value cannot be changed after declaration. Block scoped. Must be initialized. Example: const PI = 3.14; var is old, function-scoped, avoid using it.
Box Model is the concept that every HTML element is considered as a rectangular box. Its 4 components from inside to outside: Content: The actual text/image Padding: Space between content and border (inside space) Border: Line around padding and content Margin: Space outside the border (outside space)
Formula: Total Width = Content + Padding + Border + Margin
In <a> tag, target="_blank" opens the linked page in a new browser tab/window instead of same tab. Example: <a href="https://google.com" target="_blank">Open Google</a>
Cookies are small text files stored by website on user's browser. Uses: Remember login sessions, Remember user preferences (language, theme), Shopping cart tracking, Analytics and tracking user behavior. They have expiry date and can be deleted.
Definition: A Search Engine is a software system designed to search information on the World Wide Web. Example: Google, Bing. How it Works (3 steps): 1) Crawling: Bots (spiders) crawl the web and collect pages. 2) Indexing: Collected pages are analyzed and stored in a huge database (index) with keywords. 3) Ranking & Retrieval: When user searches, engine finds relevant pages from index and shows them ranked by relevance using algorithms (like PageRank). Importance: Without search engines, WWW would be unusable. It helps find information in billions of pages quickly, connects users to businesses, education, and is the gateway to the internet.
Selectors are used to select HTML elements to style them. 1. Universal Selector *: Selects all elements. * { margin: 0; padding: 0; } 2. Element Selector: Selects by tag name. p { color: red; } 3. ID Selector #: Selects one unique element with specific id. #header { background: black; } HTML: <div id="header"></div> 4. Class Selector .: Selects all elements with same class. Can be used multiple times. .myClass { font-size: 20px; } HTML: <p class="myClass"></p>
Program:
let i = 1;
let count = 0;
while (count < 10) {
if (i % 2 == 0) {
document.write(i + "<br>");
count++;
}
i++;
}
</script>
Output: 2, 4, 6, 8, 10, 12, 14, 16, 18, 20
Basic Structure of a JavaScript Function: A function is a block of reusable code.
function functionName(parameter1, parameter2) { // code to be executed return result; }
Example: function sum(a, b) { return a + b; } sum(5, 10); // calling function. Parts: function keyword, name, parameters (), body {}, and optional return.
HTML tables are used to display data in rows and columns. <table>: Defines the whole table container. <tr>: Table Row - defines a row. <th>: Table Header - defines heading cell (bold & centered). <td>: Table Data - defines normal data cell.
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Ali</td>
<td>20</td>
</tr>
</table>
This will create a table with 1 header row and 1 data row, 2 columns each.
