These are the complete exercise solutions for Unit 5, Web Development with HTML, CSS and JavaScript, from the Punjab Board 9th Class Computer Science & Entrepreneurship textbook (PECTAA). They are written by the computer science teachers of Learn with Nexora for the Annual Examination 2027 of BISE Rawalpindi, Lahore and all other Punjab boards, and follow the new ALP Smart Syllabus 2026-27.
All answers follow the wording of the textbook. MCQs show the correct option, short questions are written in the 2-mark style of the PECTAA model paper, and long questions are written in the detailed 8-mark style. Question numbers match the book exercise so you can find each one quickly.
| Unit | 5: Web Development with HTML, CSS and JavaScript |
|---|---|
| Class | 9th Class (Matric Part I), Punjab boards |
| MCQs answered | 5 |
| Short questions answered | 5 |
| Long questions answered | 3 |
| ALP 2027 deletions | Yes β see the red boxes |
Under the ALP Smart Syllabus 2026-27, these topics of Unit 5 are excluded: Styling with CSS (pages 101β107) and Introduction to JavaScript (pages 107β110). The exercise questions from them are listed in a red box in each section below and are not answered, because no question from excluded topics is evaluated in the 2027 board exam.
Unit 5 MCQs with answers
ALP DELETED β NOT ANSWERED
Deleted topics (included in the ALP deleted content):
β’ Styling with CSS (Book pages 101β107): basic structure of CSS, selectors, ways of applying CSS, box model
β’ Introduction to JavaScript (Book pages 107β110): JavaScript syntax, data types, variables, operators and functions
Deleted multiple choice questions (not answered):
β’ MCQ 2 (What does CSS stand for?)
β’ MCQ 4 (HTML attribute used to define inline styles)
β’ MCQ 5 (Correct syntax for a CSS rule)
Reason: excluded under the PECTAA Smart Syllabus (ALP) 2026-27 β no question is evaluated from these topics in the 2027 board examination, so they are not answered here.
1. Which of the following tag is not a correct HTML tag?
(a) <div> (b) <span> (c) <head> (d) <footer>
Answer: (d) <footer>
3. Which of the following tag is used to create a hyperlink in HTML?
(a) <link> (b) <a> (c) <href> (d) <nav>
Answer: (b) <a>
6. In HTML, which markup is used for comments?
(a) /**/ (b) /--/ (c) <-- (d) <!--
Answer: (d) <!--
Note: Printed key of the book lists (b) for this question, but HTML comments start with <!-- and end with -->, so (d) is the correct option.
7. Which HTML tag is used to create an unordered list?
(a) <ol> (b) <ul> (c) <li> (d) <list>
Answer: (b) <ul>
Note: Printed key of the book lists (a) for this question, but <ol> creates an ordered list; the unordered list tag is <ul>, so (b) is the correct option.
8. Which tag is used to display a horizontal line in HTML?
(a) <br> (b) <hr> (c) <line> (d) <hline>
Answer: (b) <hr>
Unit 5 short questions with answers
ALP DELETED β NOT ANSWERED
Deleted topics (included in the ALP deleted content):
β’ Styling with CSS (Book pages 101β107): basic structure of CSS, selectors, ways of applying CSS, box model
β’ Introduction to JavaScript (Book pages 107β110): JavaScript syntax, data types, variables, operators and functions
Deleted short questions (not answered):
β’ Short Question 4 (Different ways to apply CSS to an HTML document)
β’ Short Question 5 (How can you include JavaScript in an HTML file?)
β’ Short Question 7 (Function of the <div> tag)
β’ Short Question 9 (Explain the box model in CSS)
Reason: excluded under the PECTAA Smart Syllabus (ALP) 2026-27 β no question is evaluated from these topics in the 2027 board examination, so they are not answered here.
Q.1 What is the purpose of the <head> tag in HTML?
Ans. The <head> section contains meta-information about the HTML document, like the title. The <title> tag placed inside it sets the title of the web page, which appears in the browser tab.
Q.2 Explain the difference between an ordered list and an unordered list in HTML.
| Basis | Ordered List | Unordered List |
|---|---|---|
| Meaning | A numbered list. | A bulleted list. |
| Tag | Created with the <ol> tag. |
Created with the <ul> tag. |
| List items | Each item is written inside <li> … </li>. |
Each item is written inside <li> … </li>. |
| Example | <ol><li>First item</li><li>Second item</li></ol> |
<ul><li>item 1</li><li>item 2</li></ul> |
Q.3 How do you add a comment in HTML?
Ans. HTML comments begin with <!-- and end with -->. Any text placed within these markers is treated as a comment and is not rendered by the browser. Example: <!-- This is a comment -->. Comments are used to explain the purpose of a specific section of code, leave reminders for future edits and temporarily disable code for testing purposes.
Q.6 Describe the syntax for creating a hyperlink in HTML.
Ans. Links in HTML are used to connect one web page to another. They are created using the <a> tag with the href attribute, which gives the address of the destination. Syntax: <a href="https://www.example.com">Visit Example.com</a>. A link that starts with mailto: opens the email program, e.g. <a href="mailto:example@example.com">Send Email</a>.
Q.8 What is the use of the <table> tag in HTML?
Ans. Tables in HTML are used to display data in a structured format, allowing for easy comparison and organization of information. A table is created using the <table> tag, which contains rows defined by <tr> (table row) tags; each row consists of cells represented by <td> (table data) tags, and headings can be added using <th> (table header) tags.
Unit 5 long questions with answers
ALP DELETED β NOT ANSWERED
Deleted topics (included in the ALP deleted content):
β’ Styling with CSS (Book pages 101β107): basic structure of CSS, selectors, ways of applying CSS, box model
β’ Introduction to JavaScript (Book pages 107β110): JavaScript syntax, data types, variables, operators and functions
Deleted long questions (not answered):
β’ Long Question 4 (Describe any three CSS selectors with examples)
β’ Long Question 5 (Creating a responsive web page using JavaScript)
Reason: excluded under the PECTAA Smart Syllabus (ALP) 2026-27 β no question is evaluated from these topics in the 2027 board examination, so they are not answered here.
Q.1 Explain the process of setting up a development environment for web development. By discussing the necessary softwares and tools.
HTML is the standard language used to create web pages. To start creating websites, you need a few basic tools and environments:
- Text Editor: This is where you write your HTML code. Popular text editors include Notepad, Notepad++, Sublime Text and Visual Studio Code.
- Web Browser: You will use this to view and test your HTML files. Common web browsers are Google Chrome, Mozilla Firefox and Microsoft Edge.
Start with a simple text editor and a web browser. Once you are comfortable with HTML, you can explore more advanced tools.
Creating a "Hello, World!" HTML application (writing the HTML code)
1. Open your text editor. You can use Notepad, Notepad++, Sublime Text or any other text editor.
2. Write the HTML code into your text editor.
3. Save your file with a .html extension, for example, My_first_website.html. (If you are using Notepad, select "All Files" in the "Save as type" dropdown, then type your file name followed by .html.)
<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is my first web page. I am learning HTML in the 9th class!</p>
</body>
</html>
Viewing the HTML file
1. Open your web browser (Google Chrome, Mozilla Firefox and others).
2. Double-click on your file named My_first_website.html.
3. You should see the text "Welcome to My Website" displayed on the web page. If you make any changes to the HTML file, refresh the web page in the browser to see the updated content.
Q.2 Create a basic HTML page that includes a header, a paragraph, an image, and a hyperlink.
Every HTML document has a basic structure: <!DOCTYPE html> tells the browser that this is an HTML5 document, <html> is the root element, <head> contains meta-information like the title, and <body> contains the content of the web page. Headings are defined with <h1> to <h6>, paragraphs with <p>, links with the <a> tag and images with the <img> tag.
HTML Code
<!DOCTYPE html>
<html>
<head>
<title>My Basic Web Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is my first web page. I am learning HTML in the 9th class!</p>
<img src="image.jpg" alt="description of the image">
<a href="https://www.example.com">Visit Example.com</a>
</body>
</html>
Explanation
<h1>: defines a large heading (the header of the page).<p>: defines a paragraph.<img src="image.jpg" alt="...">: adds an image; the alternate text (alt) helps visually impaired users understand what the image represents.<a href="...">: creates a hyperlink to another web page.
Save the file with the .html extension and open it in a web browser to view the output.
Q.3 Create a table using HTML which contains 3 rows and 2 column?
A table is created using the <table> tag, which contains rows defined by <tr> (table row) tags, and each row consists of cells represented by <td> (table data) tags. Headings can be added using <th> (table header) tags.
HTML Code (3 rows and 2 columns)
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Alice</td>
<td>14</td>
</tr>
<tr>
<td>Bob</td>
<td>15</td>
</tr>
</table>
Explanation
<table>…</table>: defines the table.<tr>: defines a table row; there are 3<tr>tags, so the table has 3 rows.<th>: defines the heading cells (Name and Age) in the first row.<td>: defines the data cells; each row has 2 cells, so the table has 2 columns.
| Name | Age |
|---|---|
| Alice | 14 |
| Bob | 15 |
Download the PDFs
The same answers for all units are available as three printable PDFs:
- All units: MCQs (PDF, 9 pages)
- All units: Short Questions (PDF, 12 pages)
- All units: Long Questions (PDF, 22 pages)
More for 9th Class Computer Science
- All units: 9th Class Computer Science exercise solutions 2027
- 9th Class Computer Science pairing scheme, model paper and official ALP list
- 9th Class Computer Science & Entrepreneurship textbook PDF
The exercise questions are from the PECTAA Computer Science & Entrepreneurship Grade 9 textbook; the deleted list follows the PECTAA Smart Syllabus 2026-27. Please confirm all dates and figures on the official website: pectaa.edu.pk
Need help with 9th Class Computer Science? Join our live online classes for Matric (Punjab and Federal Board). Book a free demo class.

Ask a question about this topic