Objective Type Questions
Question 1
To jump to new page, we use
<IMG>
tag<A>
tag<JUMP>
tag- none of the above
Answer
<A>
tag
Reason — The anchor tag <A>
is used to link a hypertext to a new document or jump to a new page.
Question 2
Which of the following is not a valid value for align attribute of <IMG>
?
- top
- middle
- bottom
- center
Answer
center
Reason — The align attribute of <IMG>
tag takes top, middle and bottom values. The value 'center' is not used.
Question 3
If the image you are loading in the web page is not available, then you want a text to appear in the image place holder, which attribute lets you define this text ?
- src
- align
- text
- alt
Answer
alt
Reason — The alt attribute specifies alternate text the browser may show if the image display is not possible or disabled by the user.
Question 4
For linking to another web page, its URL is specified with ............... attribute of <A>
tag.
- href
- title
- name
- none of the above
Answer
href
Reason — For linking to another web page, its URL is specified with href attribute of <A>
tag.
Question 5
For internal linking, the section names are provided by ............... attribute of <A>
tag ?
- href
- title
- name
- none of the above
Answer
name
Reason — For internal linking, the section names are provided by name attribute of <A>
tag.
Question 6
............... attribute is used to specify the location of an image file.
- alt
- src
- align
- name
Answer
src
Reason — src attribute is used to specify the location of an image file.
Question 7
The ............... attribute of <img>
tag specifies an alternate text for an image, if the image cannot be displayed due to any reason.
- alt
- alternate
- tooltip
- text
Answer
alt
Reason — The alt attribute of <img>
tag specifies an alternate text for an image, if the image cannot be displayed due to any reason.
Question 8
The default alignment of images, that are inserted in the web page, is ............... .
- left
- right
- middle
- inline with text
Answer
inline with text
Reason — The default alignment of images, that are inserted in the web page, is inline with text.
Question 9
While creating a Web document, which unit is used to express an image's height and width ?
- Centimetres
- Pixels
- Dots per inch
- Inches
Answer
Pixels
Reason — While creating a Web document, pixels are used to express an image's height and width.
Question 10
The default alignment of images, that are inserted in Web page, is :
- Left
- Right
- Inline with text
- Middle
Answer
Inline with text
Reason — The default alignment of images, that are inserted in Web page, is inline with text.
Question 11
Border, frame, cellspacing, cellpadding, align are the attributes of :
<BODY>
<IMG>
<TABLE>
- None of these
Answer
<TABLE>
Reason — Border, frame, cellspacing, cellpadding, align are the attributes of <TABLE> tag.
Question 12
To create a link you surround the text or image with a(n) ............... tag.
- link
- anchor
- reference
- target
Answer
anchor
Reason — To create a link you surround the text or image with a(n) anchor (<A>) tag.
Question 13
The correct HTML code for inserting an image is :
<img href ="image.gif">
<img>
image.gif</gif>
<image src = "image.gif">
<img src = "image.gif">
Answer
<img src = "image.gif">
Reason — The correct HTML code for inserting an image is :
<img src = "image.gif">
Question 14
Which will let text wrap down the side of the image?
<img src="myImage.gif" align="wrap">
<img src="myImage.gif" align="right">
<img src="myImage.gif" wrap="on">
Answer
<img src="myImage.gif" align="right">
Reason — 'src' attribute specifies the URL of the image file and 'align = right' tells the browser to place an image against the right margin.
Question 15
Consider the following code :
<img src ="Computers.jpg" width ="...." height ="....">
Fill in the blanks to set the image size to be 250 pixels wide and 400 pixels tall.
- 250, 400
- 400, 250
- <250><400>
- <400><250>
Answer
250, 400
Reason — The 'height' and 'width' attribute of <IMG>
tag tell the browser to reserve space before actually downloading an image.
<img src ="Computers.jpg" width ="250" height ="400">
The above command tells the browser to reserve the image place with a width of 250 pixels and a height of 400 pixels.
Question 16
The correct HTML code to display (P + Q)2 is:
<SUB>
( P+) 2</SUB>
- P+Q
<SUP>
2</SUP>
- (P + Q)
<SUP>
2</SUP>
<SUP>
(P+Q) 2</SUP>
Answer
(P + Q) <SUP>
2 </SUP>
Reason — The superscript tag <SUP>
is used to write (P + Q)2 by using the command —
(P + Q) <SUP>
2 </SUP>
Question 17
The < ............... > tag displays text in subscript form.
- sub
- sup
- sups
- subs
Answer
sub
Reason — The <SUB>
tag displays text in subscript form.
Question 18
The tag that starts a table cell is ............... .
<table>
<tc>
<td>
<tr>
Answer
<table>
Reason — The tag that starts a table cell is <table> tag.
Question 19
What tag is used to add columns to tables ?
<colspan>
<td>
<tr>
Answer
<td>
Reason — <td> tag is used to add columns to tables.
Question 20
Which has higher priority, cell settings or table settings ?
- Neither
- Cell settings
- Table settings
Answer
Cell settings
Reason — Cell settings have higher priority than table settings.
Question 21
Choose the correct HTML to left-align the content inside a table cell.
<td valign="left">
<tdleft>
<td align="left">
<td leftalign>
Answer
<td align="left">
Reason — The "align" attribute is used to specify the horizontal alignment of the content within a table cell. By setting the "align" attribute to "left", the content inside the <td>
tag will be left-aligned.
Question 22
Which of these tags are all <table>
tags ?
<thead><body><tr>
<table><tr><td>
<table><head><tfoot>
<table><tr><tt>
Answer
<table><tr><td>
Reason — The <table>
tag is used to define tables, <tr>
tag is used to define table rows and the <td>
tag is used to define data cells.
Question 23
Settings for columns(<td>
tag) have higher priority than settings for rows(<tr>
tag).
- Sometimes true, sometimes not
- True
- False
Answer
True
Reason — In HTML, the <td>
tag is used to define a cell within a table, while the <tr>
tag is used to define a row. When applying settings to cells and rows, the settings applied directly to the <td>
tag will take precedence over settings applied to the <tr>
tag.
Question 24
Which property tells how many rows a cell should span ?
- colspan = n
- Both rowspan = n and colspan = n
- rowspan = n
Answer
rowspan = n
Reason — rowspan attribute specifies the number of rows a cell should span.
Question 25
What is required to create a reference to a remote site that is different from creating a local link ?
- The remote attribute
- A link title
- The Web address of the remote site
- An extra
<a>
tag
Answer
The Web address of the remote site
Reason — When creating a reference to a remote site, the URL of the remote site needs to be specified as the value of the href
attribute in the <a>
tag.
Question 26
Which one of the following is the list type that will create a bulleted list ?
- unordered
- option
- decorated
- ordered
Answer
unordered
Reason — An unordered list type will create a bulleted list.
Question 27
Why is it important to specify an image width and height in an <img>
tag ?
- It ensures that a user will not be able to copy the image to their computer.
- The image will not render if these attributes are left out.
- These attributes constrain the image's proportions.
- Specifying these dimensions helps a browser render pages faster.
Answer
Specifying these dimensions helps a browser render pages faster.
Reason — Specifying the width and height of the image enables the browser to reserve space before actually downloading the image, speeding document rendering and eliminating the content shifting.
Question 28
Which one of the following HTML tags is surrounded by <a></a>
container tags to create an image link ?
<img>
<ul>
<br>
<pic>
Answer
<img>
Reason — <img>
tag is surrounded by <a></a>
container tags to create an image link .
Question 29
What is the general syntax for inline image ?
<src = img>
<src = image>
<img = file>
<img src = file>
<image src = file>
Answer
<img src = file>
Reason — The <img>
tag is used to insert images in HTML, and the "src" attribute is used to specify the path or URL of the image file. Therefore, the correct syntax for an inline image is:
<img src = file>
Question 30
To create a link to an anchor, you use the ............... property in A tag.
- Name
- Tag
- Link
- Href
Answer
Href
Reason — The href property in <A>
tag is used to create a link to an anchor.
Question 31
Which of the following is used to specify the beginning of a table's row ?
- TROW
- TABLER
- TR
- ROW
Answer
TR
Reason — <TR>
tag is used to specify the beginning of a table's row.
Question 32
In order to add border to a table, BORDER attribute is specified in which tag ?
- THEAD
- TABLE
- TBORDER
- none of these
Answer
TABLE
Reason — In order to add border to a table, BORDER attribute is specified in <TABLE>
tag in the following manner:
<TABLE BORDER = "2">
... contents ...
</TABLE>
Question 33
Which of the following is an attribute of <Table>
tag ?
- SRC
- LINK
- CELLPADDING
- BOLD
Answer
CELLPADDING
Reason — 'Cellpadding' is an attribute of <TABLE>
which gives the amount of space between the cell border and the cell contents.
Question 34
What is the correct syntax in HTML for creating a link on a webpage ?
<LINK SRC = "abc.html">
<BODY LINK = "abc.html">
<A SRC = "abc.html">
<A HREF = "abc.html">
Answer
<A HREF = "abc.html">
Reason — In HTML, the <a>
tag is used to create a hyperlink, or link, on a webpage. The href
attribute is used within the <a>
tag to specify the destination of the link.
Question 35
Choose the correct HTML code to create an email link ?
<A HREF = "xx@yy.com"></A>
<A HREF = "mailto:xx@yy.com"></A>
<MAIL = "xx@yy.com"></MAIL>
<A MAILHREF = "xx@yy.com"></A>
Answer
<A HREF = "mailto:xx@yy.com"></A>
Reason — In HTML, to create an email link, we need to use the mailto:
protocol followed by the email address. This protocol tells the browser to open the default email client with a new message addressed to the specified email address.
Question 36
............... attribute is used with <A>
tag to specify the URL of link.
Answer
href attribute is used with <A>
tag to specify the URL of link.
Question 37
No value is specified with ALT attribute of <IMG>
tag. (T/F)
Answer
False
Reason — The alt attribute specifies alternate text the browser may show if the image display is not possible or disabled by the user.
Question 38
ROWSPAN with <TABLE>
tag is used to merge more than one cell row wise. (T/F)
Answer
False
Reason — ROWSPAN with <TD>
tag is used to merge more than one cell row wise.
Question 39
Target attribute with <A>
tag is used to open a link in a new window. (T/F)
Answer
True
Reason — By setting the target attribute to "_blank", the link will open in a new window or tab, depending on the user's browser settings. For example:<a href="example.com" target="_blank">Open in New Window</a>
Question 40
Align and Valign are the attributes used with <TD>
tag to set the alignment of data in a table. (T/F)
Answer
True
Reason — Align attribute is used to control the horizontal alignment of the contents of a cell and Valign is used to control the vertical alignment of the contents of a cell.
Question 41
BORDER is an attribute of <A>
tag. (T/F)
Answer
False
Reason — BORDER is an attribute of <TABLE>
tag.
Theoretical Questions
Question 1
What is meant by inline images in HTML ?
Answer
Inline image means that image displays in line with the text, i.e., the specified image is loaded separately and placed into the text flow as if the image were some special character.
Question 2
Name various types of alignments available for images.
Answer
The various types of alignments available for images are:
- Top alignment
- Middle alignment
- Bottom alignment
- Left and Right alignment
Question 3
Which attributes of <A>
facilitates external linking ?
Answer
The attributes of <A>
tag which facilitate external linking are:
- href — It is used to specify the URL of the target of the link.
- title — It specifies a title for the document to which one is linking.
Question 4
Which attribute of <A>
facilitates internal linking ?
Answer
The attributes of <A>
tag which facilitate internal linking are:
- name — It is used to identify a segment of the document to which a link is to be established.
- href — It is used to link to the named section.
Question 5
What for is Mailto function used ?
Answer
The "mailto" function is used to create email links on webpages, allowing users to click on the link and open their default email client with a new message addressed to the specified email address.
Question 6
Write HTML code to create the following ordered list :
X. Xylophone
Y. Yak
Z. Zebra
Answer
<OL TYPE = "A" START = "24">
<LI> Xylophone </LI>
<LI> Yak </LI>
<LI> Zebra </LI>
</OL>
Question 7
How would you indent a single word and put a square bullet in front of it ?
Answer
To indent a single word and put a square bullet in front of it, we can use an unordered list in the following way:
<UL TYPE = "SQUARE">
<LI> Word </LI>
</UL>
Question 8
Write the HTML code to create the following indentation effect :
Apple pie,
pudding,
and pancake,
All begin with an A.
Answer
Apple pie, <BR>
pudding, <BR>
and pancake, <BR>
All begin with an A.
Question 9
Use a definition list in a table to show that the word "glunch" means "a look of disdain, anger, or displeasure" and that the word "glumpy" means "sullen, morose, or sulky."
Answer
<HTML>
<BODY>
<TABLE>
<TR>
<TD>
<DL>
<DT> Glunch </DT>
<DD> a look of disdain, anger, or displeasure</DD>
</DL>
</TD>
</TR>
<TR>
<TD>
<DL>
<DT> Glumpy </DT>
<DD> sullen, morose, or sulky</DD>
</DL>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Question 10
How would you make the word Elephant appear whenever the actual elephant.jpg image couldn't be displayed by a Web browser ?
Answer
We can do this by setting the value of alt attribute to 'Elephant' in the following way:
<IMG SRC = "ELEPHANT.JPG" ALT = "ELEPHANT">
Question 11
Write the HTML to make the elephant.jpg image appear on the right side of the page, with a big headline reading "Elephants of the World Unit!" on the left side of the page next to it.
Answer
<H1>Elephants of the World Unit!<IMG SRC = "ELEPHANT.JPG" ALIGN = "RIGHT"></H1>
Question 12
How would you insert an image file named elephant.jpg at the very top of a Web page ?
Answer
To insert the image at the very top of a Web page, the align attribute of <IMG>
tag should be set to "top" in the following way:
<IMG SRC = "ELEPHANT.JPG" ALIGN = "TOP">
Question 13
Suppose you have a large picture of a standing elephant named elephant.jpg. Now make a small named fly.jpg appear to the left of the elephant's head and mouse.jpg appear next to the elephant's right foot.
Answer
The HTML code to perform the given task is as follows:
<IMG SRC = "FLY.JPG" ALIGN = "TOP"><IMG SRC = "ELEPHANT.JPG"><IMG SRC = "MOUSE.JPG" ALIGN = "BOTTOM">
Question 14
Your home page will be at http://www.mysite.com/home.htm
when you put it on the Internet. Write the HTML code to go on that page so that when someone clicks the words All About Me, they see the page located at http://www.mysite.com/mylife.htm.
Answer
The command to perform the given task is as follows:
<A HREF = "mylife.htm"> All About Me </A>
Question 15
You plan to publish a CD-ROM disk containing HTML pages. How do you create a link from a page in the \guide folder to the \ guide \ mains \ kolkata.htm page ?
Answer
<A HREF = "mains/kolkata.htm"> Kolkata </A>
Question 16
Name the following with respect to HTML :
Element to create a hyperlink.
Answer
Anchor tag <A>...</A>
Question 17
What is a table ? Which tag is used to create tables in HTML ?
Answer
An HTML table allows a user to arrange data — text, preformatted text, images, links, forms, form fields, other tables, etc., into rows and columns of cells.
The table tag <TABLE>...</TABLE>
is used to create tables in HTML.
Question 18
Which attributes are used to give border to a table ?
Answer
The attributes which are used to give border to a table are:
- border — This attribute tells the table how large the border should be.
- frame — This attribute is used with border attribute and it allows the user to state which portions of the border will be displayed by the browser.
- rules — It is used with border attribute and it allows the user to state which portions of the inside border edges will be displayed.
- bordercolor — This attribute is used to specify the color of a table's border.
Question 19
Which attribute lets you control the display of select border sides of a table ?
Answer
Frame attribute lets us control the display of select border sides of a table.
Question 20
Which attribute is used to control the inside table border ?
Answer
Rules attribute is used to control the inside table border.
Question 21
How is spacing in cells of table controlled ?
Answer
To control the spacing of cells, the 'Cellspacing' and 'Cellpadding' attributes are used.
- Cellspacing — It gives the amount of space between cells.
- Cellpadding — It gives the amount of space between the cell border and the cell contents.
Consider the following example:
<TABLE BORDER = "3" CELLSPACING = "1" CELLPADDING = "1">
<TR> <TD> Fruits </TD> <TD> Vegetables </TD> </TR>
<TR> <TD> Mango, Apple, Banana </TD> <TD> Potato, Aubergine, Gourd </TD> </TR>
</TABLE>
Question 22
What is the role of ALIGN attribute of <TABLE>
tag ?
Answer
Align attribute of <TABLE>
tag is used to align the table on a web page. It can have the following values — left, right and center. These values indicate whether the table should be placed flush against the left or right margin of the text flow, with the text flowing around the table or in the middle with the text flow above and below.
Question 23
What is the use of having a SUMMARY attribute in <TABLE>
tag ?
Answer
The summary attribute is used to provide a long description of the table's purpose. It is usually given for the benefit of people using speech or Braille based user agents.
Question 24
How can you specify following in a table :
(i) background image
(ii) background colour
(iii) table height
(iv) table width ?
Answer
(i) background
attribute is used to specify the background image in a table.
(ii) bgcolor
attribute is used to specify the background color in a table.
(iii) height
attribute is used to specify the height of a table.
(iv) width
attribute is used to specify the width fo a table.
Question 25
Which tag is used to specify
(i) table data ?
(ii) table header ?
(iii) table row ?
Answer
(i) <TD>
tag
(ii) <TH>
tag
(iii) <TR>
tag
Question 26
Name the attributes used for following :
(i) Setting the cell width
(ii) Setting cell's background image
(iii) Setting cell's background colour
(iv) Changing the cell span
(v) Aligning cell contents vertically.
Answer
(i) width
(ii) background
(iii) bgcolor
(iv) rowspan
and colspan
(v) valign
Question 27
What for are <TH>
and <TR>
tags used ?
Answer
<TH>
tag stand for table header. The contents declared as header are displayed in a distinctive style, like bold-faced.
<TR>
tag stands for table row. <TR>
marks the beginning of a table row and </TR>
marks the end of a table row.
Question 28
A set of header rows is defined using ............... tag.
Answer
A set of header rows is defined using <THEAD>
tag.
Question 29
Which tags divide HTML tables in multiple sections ?
Answer
The <THEAD>
, <TBODY>
and <TFOOT>
tags are used to divide HTML tables in multiple sections. While the <THEAD>
and <TFOOT>
tags define the header and footer sections , the <TBODY>
tag defines the body section of the table.
Question 30
What attributes can you use with TABLE tag but not with TR tag ?
Answer
We can use the following attributes with TABLE tag but not with TR tag —
summary
rules
frame
border
bordercolor
cellpadding
cellspacing
height
width
Question 31
Can you insert hyperlinks inside table cells ?
Answer
Yes, we can insert hyperlinks inside table cells by using the anchor tag <A>...</A>
.
Question 32
How do you create different table section ?
Answer
The <THEAD>
, <TBODY>
and <TFOOT>
tags are used to divide HTML tables in different sections. While the <THEAD>
and <TFOOT>
tags define the header and footer sections , the <TBODY>
tag defines the body section of the table.
Consider the following example:
<HTML>
<BODY>
<TABLE>
<THEAD BGCOLOR = "PINK">
<TR>
<TD> Header </TD> <TD> Header </TD>
</TR>
</THEAD>
<TBODY BGCOLOR = "YELLOW">
<TR>
<TD> Body cell data </TD> <TD> Body cell data </TD>
</TR>
<TR>
<TD> Body cell data </TD> <TD> Body cell data </TD>
</TR>
</TBODY>
<TFOOT>
<TR>
<TD> Footer </TD> <TD> Footer </TD>
</TR>
</TFOOT>
</TABLE>
</BODY>
</HTML>
Question 33
Write code to produce following HTML table :
Answer
<HTML>
<BODY>
<TABLE>
<TR> <TD ROWSPAN = "2"> A </TD> <TD> B </TD> </TR>
<TR> <TD> C </TD> </TR>
</TABLE>
</BODY>
</HTML>
Question 34
Write HTML code to produce following table :
Answer
<HTML>
<BODY>
<TABLE frame = "void" rules = "all">
<TR> <TD> A </TD> <TD> D </TD> </TR>
<TR> <TD> B </TD> <TD> E </TD> </TR>
<TR> <TD> C </TD> <TD> F </TD> </TR>
</TABLE>
</BODY>
</HTML>
Question 35
Write HTML code to produce following table :
Answer
<HTML>
<BODY>
<TABLE frame = "lhs" rules = "all">
<TR> <TD> A </TD> <TD> C </TD><TD> E </TD> </TR>
<TR> <TD> B </TD> <TD> D </TD> <TD> F </TD></TR>
</TABLE>
</BODY>
</HTML>
Question 36
Write HTML code to produce following table :
Answer
<HTML>
<BODY>
<TABLE frame = "above" rules = "all">
<TR> <TD> A </TD> <TD> B</TD><TD> C </TD> <TD> D </TD></TR>
<TR> <TD> E </TD> <TD> F </TD> <TD> G </TD> <TD> H </TD></TR>
</TABLE>
</BODY>
</HTML>
Question 37
Create a table having three header rows with yellow background colour, five table-body rows having pink colour and two footer rows having cyan colour. Assume table contents on your own.
Answer
<HTML>
<BODY>
<TABLE>
<THEAD>
<TR> <TD BGCOLOR = "YELLOW"> Names </TD> </TR>
<TR> <TD BGCOLOR = "YELLOW"> Of </TD> </TR>
<TR> <TD BGCOLOR = "YELLOW"> Fruits </TD> </TR>
</THEAD>
<TBODY>
<TR> <TD BGCOLOR = "PINK"> Apple </TD> </TR>
<TR> <TD BGCOLOR = "PINK"> Mango </TD> </TR>
<TR> <TD BGCOLOR = "PINK"> Banana </TD> </TR>
<TR> <TD BGCOLOR = "PINK"> Guava </TD> </TR>
<TR> <TD BGCOLOR = "PINK"> Pineapple </TD> </TR>
</TBODY>
<TFOOT>
<TR> <TD BGCOLOR = "CYAN"> Note </TD> </TR>
<TR> <TD BGCOLOR = "CYAN"> Fruits are rich in fibre. </TD> </TR>
</TFOOT>
</TABLE>
</BODY>
</HTML>
Output
Question 38
Write code to produce following HTML tables :
Answer
(i)
<HTML>
<BODY>
<TABLE frame = "border" rules = "cols">
<TR> <TD> A </TD> <TD> B </TD><TD> C </TD> </TR>
<TR> <TD> D </TD> <TD> E </TD> <TD> F </TD></TR>
</TABLE>
</BODY>
</HTML>
(ii)
<HTML>
<BODY>
<TABLE frame = "border" rules = "none">
<TR> <TD> A </TD> <TD> B </TD><TD> C </TD> <TD> D </TD></TR>
<TR> <TD> E </TD> <TD> F </TD> <TD> G </TD><TD> H </TD></TR>
</TABLE>
</BODY>
</HTML>
Question 39
Write code to produce following HTML table :
Answer
<HTML>
<BODY>
<TABLE>
<TR ALIGN = "CENTER">
<TD> A </TD>
<TD COLSPAN = "3"> B </TD>
</TR>
<TR ALIGN = "CENTER">
<TD> C </TD>
<TD> D </TD>
<TD> E </TD>
<TD ROWSPAN = "2"> H </TD>
</TR>
<TR ALIGN = "CENTER">
<TD> C </TD>
<TD COLSPAN = "2"> H </TD>
</TR>
</TABLE>
</BODY>
</HTML>
Application Oriented Questions
Question 1
Consider the following web page:
(a) The text at P is :
- the title of a book on tennis
- a different web page
- another website
- a web address
(b) The link at R helps the user to :
- close this session on the internet
- access new websites
- use a search engine
- send an email
(c) Clicking on the person serving in the image at Q displays another web page. This area in the image is a :
- hyperlink
- website
- wildcard
- search engine
(d) The Internet can be used to find the websites of other tennis coaching associations by using :
- find and replace
- a search engine
- a CD ROM
- a DVD
Answer
(a) a web address
Reason — We write the URL or web address of a website in the address bar of the browser to access its content.
(b) send an email
Reason — The link at R uses "mailto" function to open an e-mail form directly which can be filled by the user and sent to the given email address.
(c) hyperlink
Reason — A hyperlink lets the user open another web page or document just by clicking on it.
(d) a search engine
Reason — A search engine helps a user to find information about any topic using keywords.
Question 2(a)
Write the HTML code to do the following :
To display a horizontal line of green colour.
Answer
<HR COLOR = "GREEN">
Question 2(b)
Write the HTML code to do the following :
To create a hyperlink on the word CLICK to an image named testimage.jpeg.
Answer
<A HREF = "testimage.jpeg">Click</A>
Question 3
Write output of the following HTML code.
<html> <head> <title> Table </title> </head>
<body>
<table BORDER = "1">
<tr> <th ALIGN = "center" rowspan = "3"> ONE </th> <th> TWO </th>
<th>THREE </th> </tr>
<tr> <td> Rose </td> <td> Lily </td> </tr>
<tr> <td ALIGN = "center"> Pansy </td> <td ALIGN = "center"
colspan = "2"> Dahlia </td> </tr>
</table> </body> </html>
Answer
Output
Question 4
Observe the following table and write the HTML code to generate it :
Answer
<HTML>
<BODY>
<TABLE BORDER = "1">
<TR> <TH ROWSPAN = "2"> Serial No </TH> <TH ROWSPAN = "2"> Class </TH> <TH colspan = "3" ALIGN = "CENTER"> Number of Students </TH> </TR>
<TR ALIGN = "CENTER"> <TD> English </TD> <TD> Hindi </TD> <TD> Regional </TD> </TR>
<TR ALIGN = "CENTER"> <TD> 1 </TD> <TD> X A </TD> <TD> 35 </TD><TD> 10 </TD><TD> 6 </TD> </TR>
<TR ALIGN = "CENTER"> <TD> 2 </TD> <TD> X B </TD> <TD> 31 </TD><TD> 15 </TD><TD> 4 </TD> </TR>
</TABLE>
</BODY>
</HTML>
Output
Question 5(a)
Write HTML code to create tables as shown below :
Answer
<HTML>
<BODY>
<TABLE BORDER = "1">
<TR> <TD> 1 </TD> <TD ROWSPAN = "2" VALIGN = "TOP"> 2 </TD><TD> 3 </TD> </TR>
<TR> <TD> 4 </TD> <TD> 6 </TD></TR>
<TR> <TD> 7 </TD> <TD> 8 </TD> <TD> 9 </TD></TR>
</TABLE>
</BODY>
</HTML>
Question 5(b)
Write HTML code to create tables as shown below :
Answer
<HTML>
<BODY>
<TABLE BORDER = "3">
<TR> <TD COLSPAN = "3"> Title goes here </TD> <TD> A </TD><TD ALIGN = "RIGHT"> B </TD> </TR>
<TR> <TD ROWSPAN = "3" ALIGN = "LEFT"> C </TD> <TD> D </TD><TD> E </TD><TD> F </TD><TD ALIGN = "RIGHT"> G </TD></TR>
<TR> <TD> H </TD><TD COLSPAN = "2" ALIGN = "CENTER"> I </TD><TD> </TD></TR>
<TR> <TD> K </TD><TD> L </TD><TD> M </TD><TD ALIGN = "RIGHT"> J </TD></TR>
<TR> <TD ALIGN = "RIGHT"> N </TD> <TD COLSPAN = "4" ALIGN = "CENTER"> O </TD> </TR>
</TABLE>
</BODY>
</HTML>
Question 5(c)
Write HTML code to create tables as shown below :
Answer
<HTML>
<BODY>
<TABLE BORDER = "1">
<TR> <TD ROWSPAN = "3"> Column 1 </TD> <TD> Row 1 </TD> </TR>
<TR> <TD> Row 2 </TD> </TR>
<TR><TD> Row 3 </TD> </TR>
</TABLE>
</BODY>
</HTML>
Question 5(d)
Write HTML code to create tables as shown below :
Answer
<HTML>
<BODY>
<TABLE BORDER = "1">
<TR> <TH COLSPAN = "2" BGCOLOR = "YELLOW"> Mammals - Plants - Fish </TH> </TR>
<TR> <TD BGCOLOR = "SKY BLUE" ROWSPAN = "3"> <B> Mammals </B> <BR> Farm Animals <BR> Big Game <BR> Small Critters </TD> <TD BGCOLOR = "LIGHTGREEN"> Cow </TD> </TR>
<TR> <TD BGCOLOR = "LIGHTGREEN"> Pig </TD> </TR>
<TR> <TD BGCOLOR = "LIGHTGREEN"> Horse </TD> </TR>
</TABLE>
</BODY>
</HTML>
Practical Assessment
Question 1
How to create hyperlinks.
<HTML>
<BODY>
<P>
<A href = "lastpage.htm">This text</A> is a link to a page on this Web site.</P>
<P>
<A href="http://www.microsoft.com/">
This text</A> is a link to a page on the World Wide Web.
</P>
</BODY>
</HTML>
Answer
Output
Question 2
Jump to another part of same document.
<HTML>
<BODY>
<P>
<A href = "#C4">
See also Chapter 4.
</A>
</P>
<P>
<H2>Chapter 1</H2>
<P>This chapter explains ba bla bla</P>
<H2>Chapter 2</H2>
<P>This chapter explains ba bla bla</P>
<H2>Chapter 3</H2>
<P>This chapter explains ba bla bla</P>
<A name="C4"><H2>Chapter 4</H2></A>
<P>This chapter explains ba bla bla</P>
<H2>Chapter 5</H2>
<P>This chapter explains ba bla bla</P>
<H2>Chapter 6</H2>
<P>This chapter explains ba bla bla</P>
<H2>Chapter 7</H2>
<P>This chapter explains ba bla bla</P>
</BODY>
</HTML>
Answer
Output
Question 3
Create a basic 3x2 table.
<HTML>
<BODY>
<TABLE BORDER>
<TR>
<TD>A</TD> <TD>B</TD> <TD>C</TD>
</TR>
<TR>
<TD>D</TD> <TD>E</TD> <TD>F</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Answer
Output
Question 4
Demonstration of rowspan.
<HTML>
<BODY>
<TABLE BORDER>
<TR>
<TD ROWSPAN=2>Item 1</TD>
<TD>Item 2</TD> <TD>Item 3</TD>
<TD>Item 4</TD>
</TR>
<TR>
<TD>Item 5</TD> <TD>Item 6</TD>
<TD>Item 7</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Answer
Output
Question 5
Demonstration of colspan and headers.
<HTML>
<BODY>
<TABLE BORDER>
<TR>
<TH COLSPAN=2>Head1</TH> <TH COLSPAN=2>Head2</TH>
</TR>
<TR>
<TD>A</TD> <TD>B</TD>
<TD>C</TD> <TD>D</TD>
</TR>
<TR>
<TD>E</TD> <TD>F</TD>
<TD>G</TD> <TD>H</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Answer
Output
Question 6
Demonstration of Side Headers, Rowspan.
<HTML>
<BODY>
<TABLE BORDER>
<TR><TH ROWSPAN=2>Head1</TH>
<TD>Item 1</TD> <TD>Item 2</TD>
<TD>Item 3</TD> <TD>Item 4</TD>
</TR>
<TR>
<TD>Item 5</TD> <TD>Item 6</TD>
<TD>Item 7</TD> <TD>item8</TD>
</TR>
<TR><TH>Head2</TH>
<TD>Item 9</TD> <TD>Item 10</TD>
<TD>Item 3</TD> <TD>Item 11</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Answer
Output
Question 7
Sample table using many things.
<HTML>
<BODY>
<TABLE BORDER>
<TR> <TD><TH ROWSPAN=2></TH>
<TH COLSPAN=2>Average</TH></TD>
</TR>
<TR>
<TD><TH>Height</TH>
<TH>Weight</TH></TD>
</TR>
<TR>
<TH ROWSPAN=2>Gender</TH>
<TH>Males</TH><TD>1.9</TD>
<TD>0.003</TD>
</TR>
<TR>
<TH>Females</TH>
<TD>1.7</TD><TD>0.002</TD> </TR>
</TABLE>
</BODY>
</HTML>
Answer
Output
Question 8
Tables using Cellpadding and Cellspacing.
<HTML>
<BODY>
<TABLE BORDER CELLPADDING=10 CELLSPACING=0>
<TR>
<TD>A</TD> <TD>B</TD> <TD>C</TD>
</TR>
<TR>
<TD>D</TD> <TD>E</TD> <TD>F</TD>
</TR>
</TABLE>
<TABLE BORDER CELLPADDING=0 CELLSPACING=10>
<TR>
<TD>A</TD> <TD>B</TD> <TD>C</TD>
</TR>
<TR>
<TD>D</TD> <TD>E</TD> <TD>F</TD>
</TR>
</TABLE>
<TABLE BORDER CELLPADDING=20 CELLSPACING=20>
<TR>
<TD>A</TD> <TD>B</TD> <TD>C</TD>
</TR>
<TR>
<TD>D</TD> <TD>E</TD> <TD>F</TD>
</TR>
</TABLE>
<TABLE BORDER=5 CELLPADDING=20 CELLSPACING=5>
<TR>
<TD>A</TD> <TD>B</TD> <TD>C</TD>
</TR>
<TR>
<TD>D</TD> <TD>E</TD> <TD>F</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Answer
Output
Question 9
Table with different vertical alignments in its cells.
<HTML>
<BODY>
<TABLE BORDER>
<TR>
<TH>January</TH>
<TH>February</TH>
<TH>March</TH>
</TR>
<TR ALIGN=center>
<TD>all aligned center</TD>
<TD>Cell 2</TD>
<TD>Another cell,<br> cell 3</TD>
</TR>
<TR>
<TD ALIGN=right>aligned right</TD>
<TD ALIGN=center>aligned to center</TD>
<TD>default,<br>aligned left</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Answer
Output
Solutions of Unsolved Examination Questions
Question 1
Fill in the blanks:
(i) To insert a table on a web page, we use ............... tag.
(ii) ............... tag is used to create inline images.
(iii) ............... is an attribute of the <IMG>
tag which specifies the location or URL of the image to be displayed.
(iv) The default colour of a hyperlink on a web page is ............... .
(v) The ............... tag is used to create subscripts and ............... tag is used to create superscripts on a web page.
(vi) An ............... link allows a link to another web page or another web site.
(vii) The attribute ............... is used for specifying the URL of the anchor tag.
(viii) ............... is used to combine the cells horizontally.
(ix) ............... tags creates a bulleted list.
(x) ............... attribute with <HR>
tag is used to specify thickness of the line.
Answer
(i) To insert a table on a web page, we use <TABLE>tag.
(ii) <IMG> tag is used to create inline images.
(iii) SRC is an attribute of the <IMG>
tag which specifies the location or URL of the image to be displayed.
(iv) The default colour of a hyperlink on a web page is blue.
(v) The <SUB> tag is used to create subscripts and <SUP> tag is used to create superscripts on a web page.
(vi) An external link allows a link to another web page or another web site.
(vii) The attribute HREF is used for specifying the URL of the anchor tag.
(viii) COLSPAN is used to combine the cells horizontally.
(ix) <UL>...</UL> tags creates a bulleted list.
(x) SIZE attribute with <HR>
tag is used to specify thickness of the line.
Question 2
State True or False:
(i) Line breaks are given through <BR>
.
(ii) HTML is a programming language.
(iii) The default font size is 5.
(iv) Color attribute is used with <P>
tag.
(v) The colour of the hyperlinks in an HTML document cannot be changed.
(vi) The <A>
tag is called the align tag.
(vii) <TR>
tag is used to specify the individual table data in a table.
(viii) The ALT attribute of the <IMG>
tag is used to specify the text that is to be displayed in case the browser does not support graphics.
(ix) XML is not a markup language.
(x) It is not important to specify an integer value as the width of the border of an image.
(xi) The ALIGN attribute of the <IMG>
tag is used to specify the text that is to be displayed in case the browser does not support graphics.
(xii) <TH>
tag is used to specify the column heading in a table.
(xiii) The NAME attribute of the <A>
tag allows the user to create links within the same document.
(xiv) The <A>
tag is called the align tag.
Answer
(i) True
Reason — <BR>
tag is used to break the current line and jump to the next line.
(ii) False
Reason — HTML is a Webpage Layout Language and a Hyperlink Specification Language. It is not a programming language.
(iii) False
Reason — The default font size is 3.
(iv) False
Reason — Color is not an attribute of <P>
tag. Color is used with <Font>
tag to set the colour of the text.
(v) False
Reason — The colour of the hyperlinks in an HTML document can be changed by using the ALINK, VLINK attributes with the <BODY>
tag.
(vi) False
Reason — The <A>
tag is called the anchor tag.
(vii) False
Reason — <TD>
tag is used to specify the individual table data in a table. <TR>
tag is used to specify a new row in a table.
(viii) True
Reason — The ALT attribute of the <IMG>
tag is used to specify the text that is to be displayed in case the browser cannot display the image for some reason.
(ix) False
Reason — XML stands for Xtensible Markup Language and it is a markup language.
(x) False
Reason — The width attribute requires an integer value that indicates the image size in pixels.
(xi) False
Reason — The ALT attribute of the <IMG>
tag is used to specify the text that is to be displayed in case the browser does not support graphics. The ALIGN attribute is used to align the image.
(xii) True
Reason — <TH>
tag is used to specify the column heading in a table. The headings appear slightly different than the normal table data.
(xiii) True
Reason — The NAME attribute specifies the name of a section in the document. This name is used to create links using the HREF attribute.
(xiv) False
Reason — The <A>
tag is called the anchor tag.
Question 3(i)
To create a link, we must use ............... attribute with tag.
- name
- link
- tag
- href
Answer
href
Reason — For linking to another web page, its URL is specified with href attribute of <A>
tag.
Question 3(ii)
Which of the following is an attribute of <table>
tag ?
- src
- link
- cellpadding
- bold
Answer
cellpadding
Reason — Cellpadding gives the specified amount of space between the cell border and the cell contents.
Question 3(iii)
Which attribute is not valid for <body>
tag ?
- background
- color
- vlink
- leftmargin
Answer
color
Reason — color
is not a valid attribute for <body>
tag. The other attributes are used with <BODY>
tag to specify the following —
- background — It specifies the background image for the document
- vlink — It specifies the color of the visited links in a document
- leftmargin — It specifies the left margin in a document
Question 3(iv)
Which of the following is not an attribute of <Table>
tag ?
- Border
- Background
- Bgcolor
- Src
Answer
Src
Reason — Src
is an attribute of <IMG>
tag which accepts the path or URL of the image. The BORDER, BACKGROUND and BGCOLOR attribute of <TABLE>
tag specify the border, background image and the background colour of the table, respectively.
Question 3(v)
Which command should we use to link a page with an HTML page ?
<a link = "page.htm"> </a>
<a href = "page.htm"> page </a>
<a connect = "page.htm"> </a>
<a attach = "page.htm"> </a>
Answer
<a href = "page.htm"> page </a>
Reason — To link a page with an HTML page, its name and location is specified with href
attribute of <A>
tag.
Question 3(vi)
SRC attribute used with <IMG>
tag stands for :
- Screen
- Screen resolution count
- Source
- Structure
Answer
Source
Reason — SRC attribute is used to specify the source/location of an image file.
Question 3(vii)
Which of the following is not a valid value for align attribute of <IMG>
tag ?
- top
- center
- bottom
- middle
Answer
center
Reason — The align attribute of <IMG>
tag takes top, middle and bottom values. 'center' is not a valid value.
Question 3(viii)
We can create a numbered list using ............... tag.
<ul>
<list>
<ol>
<dl>
Answer
<ol>
Reason — The <ol>
tag is used to define a numbered or ordered list
Question 3(ix)
colspan = n can be added to ............... tag :
<hr>
<table>
<td>
<tr>
Answer
<td>
Reason — COLSPAN attribute is used with <TD>
tag to merge more than one columns into a single cell.
Question 3(x)
The correct HTML code for inserting an image is :
<img href = "image.gif">
<img> image.gif </img>
<img src = "image.gif">
<image src = "image.gif">
Answer
<img src = "image.gif">
Reason — To insert an image in an HTML document, we use the <IMG>
tag along with its attribute SRC which specifies the location or URL of the image.
Question 3(xi)
Which of the following are the attributes of <table>
?
<Border>
<img>
<table>
- None of these
Answer
None of these
Reason — The options specified are HTML tags not attributes.
Question 3(xii)
The attribute used to specify the background colour of a table is :
- COLOR
- BGTABLE
- BACKCOLOR
- BGCOLOR
Answer
BGCOLOR
Reason — The attribute BGCOLOR is used to specify the background colour of a table.
Question 3(xiii)
Which of the following is an attribute of <TABLE>
tag ?
- SRC
- LINK
- CELLPADDING
- BOLD
Answer
CELLPADDING
Reason — Cellpadding specifies the amount of space to be given between the cell border and the cell contents.
Question 3(xiv)
Which of the following tag is suitable for creating numbered list ?
<BL>
<OL>
<UL>
<DL>
Answer
<OL>
Reason — <OL>
tag is suitable for creating numbered list.
Question 3(xv)
The two common attributes of the <IMG>
and the <TABLE>
tag are :
- SRC and HEIGHT
- HEIGHT and WIDTH
- BORDER and SRC
- They do not have any common attributes
Answer
HEIGHT and WIDTH
Reason — Two common attributes of the <IMG>
and the <TABLE>
tag are HEIGHT and WIDTH.
Question 4(a)
Write the full forms of :
(i) XML
(ii) FTP
(iii) <img>
(iv) <HR>
Answer
(i) XML — Xtensible Markup Language
(ii) FTP — File Transfer Protocol
(iii) <img>
— Image tag
(iv) <HR>
— Horizontal rule tag
Question 4(b)
Name the attributes of <img>
tag which are used for specifying its dimensions in a web page.
Answer
The HEIGHT and WIDTH attributes require integer values to specify the height and width of the image in pixels.
Question 5
What do you understand by VLINK ?
Answer
VLINK is an attribute of <BODY>
tag. It specifies the color of the visited links in a document.
Question 6
Identify which of the following is a tag or an attribute :
(i) border
(ii) img
(iii) alt
(iv) src
(v) href
Answer
(i) border — Attribute
(ii) img — Tag
(iii) alt — Attribute
(iv) src — Attribute
(v) href — Attribute
Question 7
Consider the HTML code :
<A HREF = #intro> Introduction </A>
In the above code,
(i) What is the purpose of # ?
(ii) What will happen when the user clicks "Introduction" ?
Answer
(i) # is used to place the anchor at a given section in a document.
(ii) When "Introduction" is clicked, the user is taken to the section of the document named "intro".
Question 8(a)
Observe the following table and write the HTML code to generate it :
Answer
<HTML>
<BODY>
<TABLE BORDER="1">
<TR> <TH COLSPAN = "4" ALIGN = "CENTER">Marks</TH> </TR>
<TR>
<TD ALIGN = "CENTER"> English </TD>
<TD ALIGN = "CENTER"> Maths </TD>
<TD ALIGN = "CENTER"> Economics </TD>
<TD ALIGN = "CENTER"> Physics </TD>
</TR>
<TR>
<TD ALIGN = "CENTER"> 67 </TD>
<TD ALIGN = "CENTER"> 89 </TD>
<TD ALIGN = "CENTER"> 77 </TD>
<TD ALIGN = "CENTER"> 92 </TD>
</TR>
</TABLE>
</BODY>
</HTML>
Question 8(b)
Write the names of two attributes each for the following tags :
(i) <HR>
(ii) <Body>
(iii) <img>
(iv) <Table>
(v) <A>
Answer
(i) <HR>
— WIDTH, NOSHADE
(ii) <Body>
— BGCOLOR, BACKGROUND
(iii) <img>
— SRC, ALT
(iv) <Table>
— BORDER, ALIGN
(v) <A>
— NAME, HREF
Question 9
Observe the following table and write the HTML code to generate it :
Note. 1st row has pink background.
Answer
<HTML>
<BODY>
<TABLE BORDER="1">
<TR>
<TH BGCOLOR = "PINK" ALIGN = "CENTER">Question</TH>
<TH BGCOLOR = "PINK" ALIGN = "CENTER">Marks</TH>
</TR>
<TR>
<TD ROWSPAN = "3" ALIGN = "CENTER">1</TD>
<TD ALIGN = "CENTER">2</TD>
</TR>
<TR>
<TD ALIGN = "CENTER">2</TD>
</TR>
<TR>
<TD ALIGN = "CENTER">5</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Question 10
Write the HTML code to generate the following output :
Note the following points while generating the webpage :
(i) Link colour is green, active link colour is blue and visited link colour is red.
(ii) Title of the page is "Dances of India".
(iii) Heading of the page is maroon.
(iv) Background colour of page is yellow.
(v) Image used is "dance.png".
(vi) Caption of table is blue.
(vii) Table border is blue and of size 2.
(viii) The 3 links are one.html, two.html and three.html.
(ix) The email id for contact us is abc@xyz.com
Answer
<HTML>
<HEAD>
<TITLE> Dances of India </TITLE>
</HEAD>
<BODY LINK = "GREEN" ALINK = "BLUE" VLINK = "RED" BGCOLOR = "YELLOW">
<FONT COLOR = "MAROON">
<H1 ALIGN = "CENTER">Dances of India </H1>
</FONT>
<IMG SRC = "DANCE.JPG" HEIGHT = "100" WIDTH = "100" ALIGN = "RIGHT">
<P>
There are many types of dance in India, from those which are deeply religious in content to those which are danced on more trivial happy occasions. <BR>
Classical dances of India are usually always spiritual in content, although this is often true also of Folk dances.
</P>
<TABLE BORDER = "2" BORDERCOLOR = "BLUE" ALIGN = "CENTER">
<CAPTION>
<FONT COLOR = "BLUE">DANCES OF INDIA</FONT>
</CAPTION>
<TR>
<TH ALIGN = "CENTER">CLASSICAL DANCES </TH>
<TH ALIGN = "CENTER">FOLK DANCES </TH>
</TR>
<TR>
<TD>Mohini Attam</TD>
<TD>Hikat of Himachal Pradesh </TD>
</TR>
<TR>
<TD>Bharata Natyam </TD>
<TD>Rouff of Kashmir </TD>
</TR>
<TR>
<TD>Odissi </TD>
<TD>Hurkia Baol of Kumaon </TD>
</TR>
</TABLE>
<H4>List</H4>
<UL TYPE = "NONE">
<LI>
<A HREF = "one.html">Mohini Attam</A>
</LI>
<LI>
<A HREF = "two.html">Bharata Natyam</A>
</LI>
<LI>
<A HREF = "three.html">Odissi</A>
</LI>
<LI>
<A HREF = "mailto:abc@xyz.com">Contact Us</A>
</LI>
</UL>
</BODY>
</HTML>
Question 11
Write the HTML code to generate the following output :
Note the following points while generating the webpage :
(i) Title of the page should be "Dubai Tourism".
(ii) The heading text "Welcome to Dubai" is in Arial font and is of maroon color.
(iii) The horizontal lines below the heading are 5 pixels thick and of red color.
(iv) Image used in the page is burj.jpg.
(v) The bulleted list contains links as specified below :
- The text Morning is a link to the webpage "morning.html".
- The text Evening is a link to the webpage "evening.html".
Answer
<HTML>
<HEAD>
<TITLE> Dubai Tourism </TITLE>
</HEAD>
<BODY >
<FONT FACE = "ARIAL" COLOR = "MAROON">
<H1 ALIGN = "CENTER">WELCOME TO DUBAI </H1>
</FONT>
<HR SIZE = "5" COLOR = "RED" ALIGN = "CENTER" WIDTH = "50%">
<HR SIZE = "5" COLOR = "RED" ALIGN = "CENTER" WIDTH = "30%">
<FONT SIZE = 5>
Enjoy the world of pure travel masti
</FONT>
<IMG SRC = "BURJ.JPG" HEIGHT = "100" WIDTH = "100" ALIGN = "BOTTOM">
<P>The following is a list of major tourist attractions in Dubai :</P>
<UL TYPE = "DISC">
<LI>
<A HREF = "morning.html">Morning</A> - Dolphinarium and Palm Dubai
</LI>
<LI>
<A HREF = "evening.html">Evening</A> - Ski Dubai and Cruise
</LI>
</UL>
<CENTER>For enquiries write at <A HREF = "mailto:dubai@gmail.com">dubai@gmail.com</A></CENTER>
</BODY>
</HTML>