Class 10 Extra Question & Answer Computer Science Chapter 2

Part 1

Short Answers

1. What does HTML stand for?
Ans:- HTML stands for HyperText Markup Language. It is used to create web pages.

2. What is the purpose of the <head> tag in an HTML document?
Ans:- The <head> tag holds information about the web page, like its title and linked files, but it is not shown on the webpage itself.

3. What does the <title> tag do?
Ans:- The <title> tag sets the name of the webpage that appears on the browser tab.

4. What is the difference between the <br> and <hr> tags?
Ans:- The <br> tag moves the text to a new line, while the <hr> tag draws a horizontal line across the page.

5. What is an empty tag? Give an example.
Ans:- An empty tag is a tag that doesn’t need a closing tag. Example: <br>.

6. Write the syntax of an HTML comment.
Ans:- <!– This is a comment –>

7. What is the use of the <p> tag in HTML?
Ans:- The <p> tag is used to write a paragraph on a web page.

8. What is the function of the <h1> to <h6> tags in HTML?
Ans:- These tags are used to create headings. <h1> is the biggest and <h6> is the smallest.

9. Which tag is used to insert a line break in HTML?
Ans:- The <br> tag is used to break the line and move to the next line.

10. What is the difference between <b> and <strong> tags?
Ans:- Both make text bold, but <strong> also shows that the text is important.

11. Define an HTML element.
Ans:- An HTML element is a complete tag structure that includes opening tag, content, and closing tag.

12. What is the use of the <em> tag?
Ans:- The <em> tag makes the text look italic and shows it is important.

13. Can you nest one HTML tag inside another? Give an example.
Ans:- Yes, tags can be placed inside others. Example: <b><i>Text</i></b>

14. What tag is used to display an image in HTML?
Ans:- The <img> tag is used to show an image on the webpage.

15. What is the default alignment of paragraph text in HTML?
Ans:- Paragraph text is aligned to the left side by default.

16. Write an example of a self-closing tag in HTML.
Ans:- <img src=”pic.jpg” alt=”Picture” />

17. How do you add a horizontal line in an HTML page?
Ans:- You can add it using the <hr> tag.

 

Long Answer Questions.


1. Explain the basic structure of an HTML document.
Ans:-
An HTML document is made up of different parts that work together to create a web page. The basic structure includes:

html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<p>This is the content of the web page.</p>
</body>
</html>


<!DOCTYPE html> tells the browser that the document uses HTML5.
<html> is the main container for the whole webpage.
<head> contains information like the page title and links to stylesheets or scripts.
<title> sets the name seen in the browser tab.
<body> contains everything that is shown on the webpage, like text, images, links, etc.

 

2. What are container and empty tags in HTML? Give suitable examples.
Ans:-
HTML tags are divided into two types: container tags and empty tags.

Container Tags: These tags have both opening and closing parts. They wrap around some content.
Example: <p>This is a paragraph.</p>

Empty Tags: These tags don’t need a closing tag. They stand alone and do their work.
Example: <br> adds a line break.

Container tags are used when you need to hold content, while empty tags perform a task without holding any content.

 

3. How are HTML comments written and why are they used?
Ans:-
HTML comments are written like this:
<!– This is a comment –>

Comments are used to add notes or explanations in the HTML code. They are not shown on the web page. Developers use comments to remember what the code does, to make code easier to understand, or to hide some parts of the code during testing.

 

4. Explain the concept of nested HTML tags with an example.
Ans:-
Nested HTML tags mean putting one tag inside another. When using nested tags, the inner tag should be closed before the outer tag.

Example:

html
<b><i>This is bold and italic text.</i></b>


In this example:

<i> is inside <b>.
The closing order is important: first <i> closes, then <b>.

This helps in combining multiple styles or features in one part of the content.

 

5. List and explain any five commonly used HTML tags with their functions.
Ans:-
Here are five common HTML tags:

1. <html> – It is the main tag that holds all HTML content.
2. <head> – It stores the title and links that are not shown directly on the webpage.
3. <body> – It contains all visible content like text, images, and links.
4. <p> – It is used to create a paragraph.
5. <a> – This tag is used to create hyperlinks to other pages or websites.

Each tag has a specific role to structure and design a webpage.

 

6. Explain the difference between the <b>, <i>, <strong>, and <em> tags with examples.
Ans:-
These tags change how the text looks and what it means:

<b> – Makes the text bold.
Example: <b>Important</b> → Important

<strong> – Also makes text bold but also tells the browser it’s very important.
Example: <strong>Warning!</strong> → Warning!

<i> – Makes text italic without special meaning.
Example: <i>Name</i> → Name

<em> – Italicizes the text and adds importance to it.
Example: <em>Note</em> → Note

So, <b> and <i> are for style, while <strong> and <em> also add meaning.

 

7. Explain with an example how to use comments in an HTML document and why they are useful.
Ans:-
HTML comments are helpful for writing notes inside the code. They do not appear on the webpage but are visible in the code.

Example:

html
<!– This is a paragraph about our product –>
<p>Our product is safe and easy to use.</p>


Why useful:

Helps to understand what the code does.
Can be used to temporarily remove code without deleting it.
Makes teamwork easier when many people work on the same page.

 

8. Write an HTML code to display a formatted paragraph using <br>, <hr>, and <b> tags.
Ans:-

html
<!DOCTYPE html>
<html>
<head>
<title>Formatted Paragraph</title>
</head>
<body>
<p>
<b>Welcome to our website!</b><br>
We are glad you are here.<br>
Enjoy browsing our content.
</p>
<hr>
<p>Contact us anytime for more information.</p>
</body>
</html>


Explanation:

<b> makes the first sentence bold.
<br> breaks lines inside the paragraph.
<hr> adds a horizontal line between sections.

 

Part 2


Short Answers


1. What is the purpose of using lists in HTML?
Ans:- Lists help to arrange information in a clean and readable way, like steps or items.

2. Name the three types of lists supported in HTML.
Ans:- Ordered list, unordered list, and description list.

3. Which tags are used to create an ordered list in HTML?
Ans:- The <ol> tag is used to make an ordered list.

4. What tag is used to define individual list items in an ordered or unordered list?
Ans:- The <li> tag is used for each item in a list.

5. What does the <ol> tag represent in HTML?
Ans:- It stands for an ordered list where items are shown in sequence using numbers or letters.

6. Write the syntax to start an ordered list with Roman numerals.
Ans:- <ol type=”I”>

7. How do you reverse the order of an ordered list in HTML?
Ans:- Add reversed in the <ol> tag like this: <ol reversed>

8. Write the syntax to create an unordered list using square bullets.
Ans:- <ul style=”list-style-type: square;”>

9. What tag is used to define a term in a definition list?
Ans:- The <dt> tag is used to define the term.

10. What tag is used to describe a term in a description list?
Ans:- The <dd> tag gives the meaning or description of the term.

11. What is a nested list in HTML?
Ans:- A nested list is a list inside another list.

12. Which tag is used to create a table in HTML?
Ans:- The <table> tag is used to make a table.

13. What is the function of the <th> tag in a table?
Ans:- It is used to show a heading for a row or column.

14. How can you add a title to a table?
Ans:- By using the <caption> tag inside the <table> tag.

15. What is the difference between <td> and <th> tags?
Ans:- <td> is for normal data, and <th> is for bold and centered headings.

16. What does the BORDER attribute of the <table> tag do?
Ans:- It adds borders around the table and its cells.

17. Name any two attributes used with the <table> tag.
Ans:- border and cellspacing.

18. What CSS property is used to collapse table borders?
Ans:- The border-collapse property.

19. Write a CSS rule to make table borders dashed and red.
Ans:- table, th, td { border: 2px dashed red; }

20. What is the use of the padding property in a table cell?
Ans:- It gives space between the text and the border inside a cell.

21. Which tag is used to insert images in HTML?
Ans:- The <img> tag is used to show images.

22. Is the <img> tag a container tag or an empty tag?
Ans:- It is an empty tag because it does not have a closing tag.

23. Write the syntax of the <img> tag with source and alternate text.
Ans:- <img src=”image.jpg” alt=”My Image”>

24. What are the commonly supported image formats in HTML?
Ans:- JPG, PNG, GIF, and SVG.

25. What does the ALT attribute of the <img> tag do?
Ans:- It shows text if the image can’t be displayed.

26. How do you align an image to the right in HTML?
Ans:- By using: <img src=”pic.jpg” style=”float: right;”>

27. Name a CSS property that adds rounded corners to images.
Ans:- border-radius

28. Write the syntax to set the height and width of an image using HTML attributes.
Ans:- <img src=”pic.jpg” height=”100″ width=”200″>

29. What is the function of the list-style-image property in CSS?
Ans:- It replaces the bullet points in a list with a custom image.

30. How can you style the list markers using CSS?
Ans:- By using list-style-type or list-style-image in CSS.

Long Answers

1. Explain the different types of lists in HTML with appropriate examples.
Ans:-
HTML provides three main types of lists to organize content:

1. Ordered List (<ol>):
This list shows items in a specific order using numbers, letters, or Roman numerals.
Example:

html
<ol type=”A”>
<li>First item</li>
<li>Second item</li>
</ol>

2. Unordered List (<ul>):
This list displays items using bullets (•), squares, or circles.
Example:

html
<ul style=”list-style-type: square;”>
<li>Apple</li>
<li>Banana</li>
</ul>

3. Description List (<dl>):
This list is used for terms and their descriptions.
Example:

html
<dl>
<dt>HTML</dt>
<dd>A language for creating web pages.</dd>
</dl>

These list types help make web content neat, easy to read, and well-structured.

 

2. What are the advantages of using tables in a webpage?
Ans:-
Tables are useful for showing data in rows and columns. They help organize and compare information clearly. Some advantages include:

Easy Data Organization: Tables display large data sets in a structured way.
Improved Readability: Users can read values by scanning rows and columns.
Supports Headers: Table headers help label data properly.
Customizable with CSS: Tables can be styled for better design.
Supports Layouts: Tables were traditionally used for page layouts, though now CSS is preferred.

Tables are commonly used for schedules, pricing plans, comparisons, and reports.

 

3. How can you insert an image using HTML?
Ans:-
To insert an image in HTML, we use the <img> tag. It is an empty tag that requires two important attributes:

src: Tells the browser where to find the image.
alt: Provides alternate text if the image doesn’t load.

Example:

html
<img src=”flower.jpg” alt=”A red flower”>


This code will display the image “flower.jpg” and show “A red flower” if the image can’t load. Images make webpages more attractive and informative.

 

4. How can CSS be used to style table headers and data cells differently? Provide sample code.
Ans:-
CSS can be used to apply different styles to <th> (table header) and <td> (data cell) tags. This helps highlight headings and format data neatly.

Example:

html
<style>
th {
background-color: #4CAF50;
color: white;
font-weight: bold;
}

td {
background-color: #f2f2f2;
color: black;
padding: 10px;
}
</style>

<table border=”1″>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Ali</td>
<td>15</td>
</tr>
</table>


In this code:

Table headers have a green background and white text.
Data cells have a light grey background with padding for space.

This makes the table easy to read and pleasant to view.

 

5. Describe the role of the padding property in a table and how it improves readability.
Ans:-
The padding property in CSS adds space inside a table cell, between the content and the cell border. This space makes the text less cramped and easier to read.

Without Padding:

Text may touch the borders.
It looks tight and hard to follow.

With Padding:

There’s space around the content.
It looks clean and more professional.

Example:

css
td {
padding: 12px;
}


Part 3


Short Answer Type Questions and Answers


1. What is a website?
Ans:- A website is a collection of related web pages that are stored on a server and accessed through the internet using a browser.

2. What is a hyperlink in HTML?
Ans:- A hyperlink is a link that connects one web page to another, allowing users to click and move between pages.

3. How are hyperlinks usually displayed in a browser?
Ans:- Hyperlinks usually appear as blue, underlined text, and change color when visited.

4. Name the two types of linking in HTML.
Ans:- The two types of linking are internal linking and external linking.

5. What is internal linking?
Ans:- Internal linking connects one part of a web page to another part within the same website.

6. What is external linking?
Ans:- External linking connects a web page to a different website on the internet.

7. Which HTML tag is used to create hyperlinks?
Ans:- The <a> tag is used to create hyperlinks.

8. What does the href attribute in an anchor tag do?
Ans:- The href attribute tells the browser where the link should go when clicked.

9. What is the purpose of the target attribute in a hyperlink?
Ans:- The target attribute decides where the linked page will open, like in a new tab or the same window.

10. Write the syntax of an anchor tag in HTML.
Ans:- <a href=”URL” target=”_blank”>Link Text</a>

11. How does an unvisited link appear on a web page?
Ans:- An unvisited link usually appears as blue and underlined.

12. How does a visited link appear on a web page?
Ans:- A visited link typically appears as purple and underlined.

13. What is the appearance of an active link?
Ans:- An active link may appear red and shows when a link is being clicked.

14. What does the CSS selector a\:hover represent?
Ans:- a:hover applies styles to a link when the mouse pointer is over it.

15. Which CSS selector is used for an unvisited hyperlink?
Ans:- The selector a:link is used for unvisited links.

16. What is the use of the a\:active selector in CSS?
Ans:- a:active styles a link when it is being clicked by the user.

17. Can links be displayed as buttons using CSS?
Ans:- Yes, CSS can style links to look like buttons using background and padding.

18. Which HTML tag is used to embed audio in a web page?
Ans:- The <audio> tag is used to add sound to a web page.

19. Name any two attributes of the <audio> tag.
Ans:- controls and autoplay are two common attributes of the <audio> tag.

20. Mention any two audio file formats supported by HTML5.
Ans:- MP3 and OGG are supported audio formats.

21. Which HTML tag is used to embed a video in a web page?
Ans:- The <video> tag is used to display videos on a web page.

22. Write any two attributes of the <video> tag.
Ans:- controls and width are two attributes used with the <video> tag.

23. What is the use of the <iframe> tag in HTML?
Ans:- The <iframe> tag is used to show another web page inside the current page.

24. Define frameset.
Ans:- A frameset divides the browser window into multiple sections, each showing a different HTML page (used in older HTML versions).

25. List any three border styles that can be applied to iframes using CSS.
Ans:- Solid, dashed, and dotted are three border styles used with iframes.

26. What is the purpose of HTML forms?
Ans:- HTML forms collect user input like names, messages, or files and send it to a server.

27. Name any three form controls in HTML.
Ans:- Textbox, checkbox, and radio button are three common form controls.

28. Which tag is used to create a form in HTML?
Ans:- The <form> tag is used to create a form.

29. Which tag is used to create a single-line text input?
Ans:- The <input type=”text”> tag is used for single-line input.

30. What is the difference between a password input and a regular text input?
Ans:- A password input hides the typed text, while a text input shows it clearly.

31. Which tag is used for multi-line text input?
Ans:- The <textarea> tag is used for multi-line input.

32. How do checkboxes differ from radio buttons?
Ans:- Checkboxes allow multiple selections, but radio buttons allow only one selection.

33. Which HTML element is used to create checkboxes?
Ans:- The <input type=”checkbox”> element is used.

34. Which HTML element is used to create radio buttons?
Ans:- The <input type=”radio”> element is used.

35. What is a select box?
Ans:- A select box is a dropdown menu that lets users choose one or more options.

36. How can a file be uploaded using an HTML form?
Ans:- Use <input type=”file”> inside a <form> to upload files.

37. What is the purpose of the <fieldset> tag in HTML?
Ans:- The <fieldset> tag groups related form controls together.

38. What is the purpose of the <legend> tag in HTML?
Ans:- The <legend> tag gives a title to a fieldset section.

39. What does the “submit” type button do?
Ans:- It sends the form data to the server when clicked.

40. What is the function of a reset button in a form?
Ans:- It clears all the input fields and resets them to default values.

41. What type of button is used to trigger a script in a form?
Ans:- The <button type=”button”> is used to run JavaScript functions.


Long Answers


1. Differentiate between internal linking and external linking with examples.
Ans:-
Internal linking refers to creating hyperlinks that connect different sections or pages within the same website. It helps in better navigation and improves user experience.
For example:

html
<a href=”about.html”>About Us</a>


This link points to a page within the same site.

External linking connects a web page to a page on a different website. These links usually lead the user away from the current website.
For example:

html
<a href=”https://www.wikipedia.org”>Visit Wikipedia</a>


This link takes the user to an external website.

 

2. Describe the attributes and usage of the HTML anchor tag <a>.
Ans:-
The <a> tag in HTML is used to create hyperlinks. It allows users to click and go to another page, a section of the same page, or an external site.

Key attributes of <a> tag:

href: Specifies the destination URL.
target: Defines where to open the link (\_blank, \_self).
title: Gives extra info when mouse hovers over the link.
download: Tells the browser to download the link target.

Example:

html
<a href=”page.html” target=”_blank” title=”Open Page”>Click Here</a>


This will open “page.html” in a new tab with a tooltip saying “Open Page”.

 

3. Define iframes. How are they created in HTML? Mention key attributes with an example.
Ans:-
An iframe (Inline Frame) is used to embed another HTML page within the current page. It’s like showing a small browser window inside a web page.

Syntax:

html
<iframe src=”https://example.com” width=”400″ height=”300″></iframe>


Important attributes:

src: The URL of the page to embed.
width/height: Defines the size of the frame.
title: Accessibility text.
frameborder (deprecated): Used to show/hide the border.
allowfullscreen: Allows full-screen display for embedded content.

Iframes are useful for showing videos, maps, or content from other websites without redirecting the user.

 

4. What is an HTML form? Describe its purpose and common use cases.
Ans:-
An HTML form is a section on a web page that collects user input and sends it to a server for processing. It’s created using the <form> tag.

Purpose:

To gather information from users.
To allow file uploads.
To submit user choices, search queries, or feedback.

Common use cases:

Login or registration pages.
Contact forms.
Online surveys.
Payment forms.

Example:

html
<form action=”submit.php” method=”post”>
<input type=”text” name=”name”>
<input type=”submit” value=”Send”>
</form>

 


5. Discuss different types of form input controls with examples.
Ans:-
HTML forms support several input controls to accept various types of data.

Common types:

Text field: <input type=”text”> – for single-line text.
Password field: <input type=”password”> – hides entered text.
Radio buttons: <input type=”radio”> – allows one choice from options.
Checkboxes: <input type=”checkbox”> – allows multiple selections.
Text area: <textarea> – for multi-line input.
Drop-down list: <select> – lets user pick from a list.
File upload: <input type=”file”> – lets user upload files.
Button: <input type=”submit”>, <input type=”reset”>, <button>

Example:

html
<input type=”text” name=”username”>
<input type=”password” name=”pass”>
<textarea name=”message”></textarea>

 


6. Compare and contrast checkboxes and radio buttons in HTML forms.
Ans:-
Both checkboxes and radio buttons are used to take user choices, but they behave differently.

| Feature | Checkbox | Radio Button |
| | | |
| Selection type | Multiple selections allowed | Only one selection per group |
| Syntax | <input type=”checkbox”> | <input type=”radio” name=”grp”> |
| Use case | Choose multiple hobbies | Choose one gender |
| Grouping needed | Not required | Must use same name for grouping |

Example of checkboxes:

html
<input type=”checkbox” name=”hobby” value=”Reading”>Reading


Example of radio buttons:

html
<input type=”radio” name=”gender” value=”Male”>Male

 


7. Describe the different types of buttons in HTML forms and their functionality.
Ans:-
HTML forms can have different buttons based on the task to perform:

1. Submit Button

Submits the form data to the server.
Syntax: <input type=”submit”> or <button type=”submit”>

2. Reset Button

Clears all input fields and resets to default.
Syntax: <input type=”reset”>

3. Button (Custom)

Used to trigger JavaScript or other actions.
Syntax: <button type=”button”>Click Me</button>

Example:

html
<form>
<input type=”text” name=”user”>
<input type=”submit” value=”Submit”>
<input type=”reset” value=”Clear”>
<button type=”button” onclick=”alert(‘Hello’)”>Greet</button>
</form>

ed into a worksheet or presentation format!

Looking for complete and easy-to-understand Class 10 Computer Science SEBA notes? You’re in the right place! This page offers all chapter-wise notes based on the latest SEBA 2025 syllabus. Whether you’re preparing for exams, doing classwork, or revising before a test, our notes are perfect for you. The content includes definitions, short and long answer questions, solved examples, diagrams, and key concepts explained in simple English. Topics covered include Introduction to Computers, Generations of Computers, Computer System Components, Hardware and Software, Memory Devices, Input and Output Devices, Computer Languages, Operating System, Internet Basics, and Programming Fundamentals. All notes are designed to help students understand concepts clearly and score better in exams. PDF downloads are also available for offline use. These SEBA Class 10 Computer Science notes are trusted by many students and written by subject experts. Start learning now and boost your computer knowledge with the best Class 10 ICT resources online!

Scroll to Top