Study resource

Read at your pace, then save it for later.

Unit 2: HTML Web Development Basics Question Bank

Section A — 1 Mark Questions

1. What is the purpose of <br>? [1 Mark]

Answer: The <br> tag is used to insert a line break in an HTML document, moving the following content to the next line.

2. Which HTML tag is known as the root element? [1 Mark]

Answer: The <html> tag is known as the root element of an HTML document because it contains all other HTML elements.

3. Give an example of hyperlink. [1 Mark]

Answer: An example of a hyperlink is:

<a href="https://www.google.com">Visit Google</a>

4. Which attribute is used to set the background color of a web page? [1 Mark]

Answer: The bgcolor attribute of the <body> tag was traditionally used to set the background color of a web page. In modern HTML, CSS is recommended for this purpose.

5. What is the smallest heading size in HTML by default? [1 Mark]

Answer: The <h6> tag represents the smallest heading level in HTML by default.

Section B — 2 Mark Questions

1. Difference between open tags and close tags. [2 Marks]

Answer: HTML tags are used to define elements in an HTML document. Opening tags and closing tags have different purposes.

Opening Tag Closing Tag
An opening tag marks the beginning of an HTML element. A closing tag marks the end of an HTML element.
It is written without a forward slash. It contains a forward slash (/) before the tag name.
Example: <p> Example: </p>

Example:

<p>This is a paragraph.</p>

In this example, <p> is the opening tag and </p> is the closing tag.

2. What is the purpose of <head> and <body> tags in an HTML document? [2 Marks]

Answer:

  1. <head> Tag: It contains metadata and information about the HTML document, such as the page title, character encoding, links to stylesheets, and other resources. Its contents are generally not displayed directly on the webpage.
  2. <body> Tag: It contains the main visible content of a webpage, such as headings, paragraphs, images, hyperlinks, lists, and tables.

Example:

<html>
<head>
    <title>My Webpage</title>
</head>
<body>
    <h1>Welcome</h1>
    <p>This is my webpage.</p>
</body>
</html>

Section C — 8 Mark Questions

1. Create an HTML webpage that includes the following elements: [8 Marks]

Answer:

The following HTML program creates a simple webpage containing a main heading, a paragraph with bold and italic formatting, an unordered list of three items, and a table with three columns and two rows of data.

HTML Program

<!DOCTYPE html>
<html>
<head>
    <title>My First Webpage</title>
</head>
<body>

    <h1>Welcome to My Webpage</h1>

    <p>
        HTML stands for
        <strong>HyperText Markup Language</strong>.
        It is used to create
        <em>web pages</em>.
    </p>

    <h2>Popular Programming Languages</h2>

    <ul>
        <li>HTML</li>
        <li>CSS</li>
        <li>JavaScript</li>
    </ul>

    <h2>Student Information</h2>

    <table border="1">
        <tr>
            <th>Name</th>
            <th>Roll Number</th>
            <th>Subject</th>
        </tr>
        <tr>
            <td>Rahul</td>
            <td>101</td>
            <td>HTML</td>
        </tr>
        <tr>
            <td>Amit</td>
            <td>102</td>
            <td>CSS</td>
        </tr>
    </table>

</body>
</html>

Explanation of the HTML Elements Used

  1. <h1>: Displays the main heading of the webpage.
  2. <p>: Defines a paragraph of text.
  3. <strong>: Makes important text bold.
  4. <em>: Emphasizes text, usually displayed in italic.
  5. <ul> and <li>: Create an unordered (bulleted) list.
  6. <table>: Creates a table to display structured data.
  7. <tr>: Defines a table row.
  8. <th>: Defines a header cell in a table.
  9. <td>: Defines a standard data cell in a table.

Expected Output

Welcome to My Webpage

HTML stands for HyperText Markup Language. It is used to create web pages.

Popular Programming Languages

  • HTML
  • CSS
  • JavaScript

Student Information

Name Roll Number Subject
Rahul 101 HTML
Amit 102 CSS

Conclusion

This HTML program demonstrates how to create a basic webpage using headings, paragraphs, text formatting, unordered lists, and tables. These elements are essential for designing and structuring web pages.

2. Write down the use and syntax of the following tags: [8 Marks]

Answer:

HTML provides various tags to format text, organize content, and structure webpages. The uses and syntax of the given HTML tags are explained below.

i) <hr> Tag

Use: The <hr> tag is used to create a horizontal rule or thematic break between sections of content. It is an empty (void) element and does not require a closing tag.

Syntax:

<hr>

Example:

<p>First Section</p>
<hr>
<p>Second Section</p>

ii) <strong> Tag

Use: The <strong> tag indicates that the enclosed text has strong importance, seriousness, or urgency. Browsers usually display its content in bold.

Syntax:

<strong>Important Text</strong>

Example:

<p>Read the <strong>important instructions</strong> carefully.</p>

iii) <em> Tag

Use: The <em> tag is used to emphasize a particular word or phrase. Browsers usually display the enclosed text in italic style.

Syntax:

<em>Emphasized Text</em>

Example:

<p>HTML is <em>very important</em> for web development.</p>

iv) <mark> Tag

Use: The <mark> tag is used to highlight or mark text that is relevant in a particular context. Browsers usually display the highlighted text with a yellow background.

Syntax:

<mark>Highlighted Text</mark>

Example:

<p>The examination will begin on <mark>Monday</mark>.</p>

v) <sub> Tag

Use: The <sub> tag is used to display text as subscript, which appears slightly below the normal text baseline. It is commonly used in chemical formulas.

Syntax:

<sub>Subscript Text</sub>

Example:

<p>H<sub>2</sub>O</p>

Output: H2O

vi) <div> Tag

Use: The <div> tag is a block-level container used to group other HTML elements into sections. It helps organize webpage content and is commonly used with CSS for styling and layout.

Syntax:

<div>
    Content goes here
</div>

Example:

<div>
    <h2>About Us</h2>
    <p>Welcome to our website.</p>
</div>

vii) <span> Tag

Use: The <span> tag is an inline container used to group a small portion of text or other inline content. It is commonly used with CSS or JavaScript to target specific parts of content without creating a new line by itself.

Syntax:

<span>Inline Content</span>

Example:

<p>This is a <span>special word</span> in a sentence.</p>

viii) <sup> Tag

Use: The <sup> tag is used to display text as superscript, which appears slightly above the normal text baseline. It is commonly used in mathematical expressions and exponents.

Syntax:

<sup>Superscript Text</sup>

Example:

<p>x<sup>2</sup> + y<sup>2</sup> = z<sup>2</sup></p>

Output: x2 + y2 = z2

Summary Table

HTML Tag Purpose
<hr> Creates a thematic break or horizontal rule.
<strong> Indicates important text.
<em> Emphasizes text.
<mark> Highlights relevant text.
<sub> Displays subscript text.
<div> Groups content into a block-level container.
<span> Groups inline content.
<sup> Displays superscript text.

Conclusion

These HTML tags are useful for formatting text, highlighting important information, displaying mathematical and chemical expressions, and organizing webpage content. Proper use of these tags makes HTML documents more meaningful, structured, and accessible.


xxx

Did this help you understand better?

Your feedback improves the quality of this resource for everyone.