Exercise & Question Answers Class X

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Exercise & Question Answers

Chapter 4
Class X
D. Short answer questions:

a) Why are tables useful?

Ans. The HTML table model allows authors to arrange data -- text, preformatted text, images, links,
forms, form fields, other tables, etc. -- into rows and columns of cells. Each table may have an associated
caption that provides a short description of the table's purpose.

b) Can you use an image as a hyperlink? If yes give the syntax.


Ans. Yes, an image can be used as a hyperlink, for that we have to use <img> tag in the place of writing
hyper-link text.

Syntax: <a href=file name with extension which we want to link><img src=”image name with extension
which we want to show as link”></a>

c) What do you mean by External linking?

Ans. An external link is used to interconnect two html webpages. When you want to navigate to some
other page or any other URL by clicking on a link on webpage, external links are created. An external link
can be created by using anchor tag in html web page.

Syntax: <a href= “Pagename.html or URL”> text to be written on link </a>

d) What is a Hyperlink?

Ans. A hyperlink is an element in an HTML document that links to either another portion of the
document or to another document altogether. On webpages, hyperlinks are usually colored purple or
blue and are sometimes underlined, they can be in form of image.

e) What is <TD> tag used for?

Ans. <td> tag is container tag. It is used to create column cells to define the table data. By default the
cell data is left aligned horizontally and center aligned vertically.

Syntax: <td>text </td>

f) What is cellpadding?

Ans. Cellpadding is an attributes of table tag. It is used to increase space between cell borders and
content within cells.

g) What is the use of colspan and rowspan attributes of the <TD> tag?

Ans. The rowspan and colspan are the attributes of <td> tag. These are used to specify the number of
rows or columns a cell should span. The rowspan attribute is for rows and the colspan attribute is for
columns.

h) How is the bgcolour and bordercolor different?

Ans. Bgcolor attribute is used to apply background color in whole table or desired rows or desired cells
while bordercolor attribute is used to change the color of table borders.

i) What is the use of <TH> tag?

Ans. <th> tag is container tag. It is used to create column cells to define the coloumn heading in table.
By default the cell heading text is bold and aligned to the center (horizontally & vertically both).

Syntax: <th>text </th>

j) Which tag will you use to give a heading to the table?

Ans. <Caption> tag is used to give a heading to the table.

Syntax: <Caption>Text for Caption</Caption>

k) How is CSS useful?


Ans. HTML is the standard way to describe how the content in a webpage is to be displayed. But when
there are large website it is difficult to modify or make changes in the webpages which are all linked
together. Here CSS (Cascading Style Sheet) is useful as it can make our task easy.

E. Long answer question:

a) Which attribute of the table tag is used to add an image in the background give the syntax?

Ans. Background attribute is used to set background image for whole table or just for one cell.

Syntax: <table background=”filename”>

b) Differentiate between cell spacing and cell padding.

Ans. The cellspacing attribute defines space between table cells, while cellpadding represents the
distance between cell borders and the content within a cell.

c) How is the align attribute different from the valign attribute?

Ans. Align attribute aligns the text in cell horizontally, i.e. left or center or right, default alignment is left
while valign aligns the text vertically, i.e. top or middle or bottom, default alignment is middle.

Example of align:

Example of valign:

d) How can you create an internal link? Give the two steps.

Ans. To create a link within the page, two HTML tags are required.
 First create a link or fragment (bookmarks) at the place where we want to reach within a
webpage and name it using <a…> tag. It will create a bookmark. We can use the name or id
attribute to name the fragment.
 Second step is to create a hyperlink to the Fragment in the document.

We must start the link with a # (pound symble) which indicates the name part to be used in the
second tag.

Example:

<a name = “top”> ……..</a>

This will create an anchor “top” in the page.

<a href=”#top”>Top</a>

When user clicks on the “Top” link, the browser would then go to the name tag, if found on the same
page of the link.

e) Differentiate between internal and external linking.

External Linking-

The external linking means linking two different webpages. When we create a hyperlink that on clicking
directs us to some another web page or some another website, it is known as external linking between
the webpages.

For Example – On a website there may be the different external links as- website link audio link, video
link, for going to another webpage on same website.

Internal linking-

Sometime the page or document on the website is long and we have to scroll up and down to view the
content, for this purpose we can create links within a chapter or a page, so that we can click on the link
and reach that part of the page. This is called as Internal Linking.

For Example- Wikipedia is a single page website with different types of contents, so to reach to desire
content there are created many internal links.

f) What are the different values that align attribute of the table tag can have? Explain their effect
briefly.

Ans. Align attribute of Table tag can have three values-left, center or right, default alignment is left.

Explanation:

Default alignment Left-


Center alignment-

Right alignment-

g) In how many ways can you add CSS to an HTML file? Explain briefly.

Ans. CSS can be added to HTML elements in 3 ways:

 External Stylesheet- defines style sheet rules in a separate .css file and then include that file in
HTML document using HTML <link> tag.
 Internal Style Sheet- Define style sheet rules in header section of the HTML document using
<style> tag.
 Inline Style Sheet- Define style rules directly along with the HTML elements using style attribute.
h) Reema has written the code given below to add an image to the table as follows, but she is not
able to get the image in the table. Locate the error and make the connection.
<Table background=”balloons.gif”>

Ans. There is not any error in the code.

i) Write the code to create a table with the following -


 Make the text center aligned in the cells (vertically and horizontally).

Ans. <td align=”center” valign=”center”>


 Add the border with thickness 3 and colour red.

Ans. <table boder=”3” bordercolor=”red”

j) Write the code to do the following-


 To change the colour of the table to yellow.

Ans. <table bgcolor=”yellow”>

 To change the colour of a row to Green.

Ans. <tr bgcolor=”green”>

 To align the text in the cells to right.

Ans. <td align=”right”>

 To change the cellspacing to 2.

Ans. <table border=1 cellspacing=2>

You might also like