0% found this document useful (0 votes)
22 views

CS HTML QB-1

Uploaded by

Dushyant
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

CS HTML QB-1

Uploaded by

Dushyant
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

4.

HTML

Descriptive Questions
Q.1) What is HTML? Explain advantages and disadvantages of HTML.
Answer:
HTML is an evolving language, and stands for Hyper Text Markup Language
 It is a text file containing small markup tags which are instructions given to
browser about how to display the page.
 An HTML file must have an htm or html file extension.
 An HTML file can be created using a simple text editor (like Notepad in
windows).

Advantages of HTML
1) HTML is an easy to use, learn, implement and flexible alternative to
traditional presentation and tedious software.
2) HTML documents are device and platform independent. (Since it can be
designed to work on not only home PCs but also on graphical workstations,
dumb terminals, network computers, hand-held devices etc.)
3) You can traverse to any HTML document required because of hyper linking
facility available, thus controlled navigation is possible.
4) Required HTML pages can be updated easily, without changing whole
document.
5) Independent work can be done and you need not rely on application or
program vendor.
6) No expensive license software or hardware required.

Disadvantages of HTML
1) HTML doesn’t offer programming languages features and capabilities.
2) It's easy to write "bad" HTML containing errors.
3) Complex HTML code is hard to read and understand and code complexity
increases to make interactive web page. So building complex pages is very time
consuming.
4) It's easy to make mistakes (e.g. leaving out a ">" or "/" character).
5) Special types of software like scripting languages (VB Script, Java Script) are
required for handling different events and validations.
6) Can’t detect errors easily since no special debugging tool is provided.
Q.2) What is element , tag and attribute with respect to HTML?
Answer:
Element:
An element is a fundamental component of the structure of a text document. Some
examples of elements are heads, tables, paragraphs, and lists. Elements can contain
plain text, other elements, or both.

Tags:
HTML elements are defined using HTML tags.
 HTML tags are used to mark-up HTML elements.
 HTML tags are surrounded by the two characters < and >
 The surrounding characters are called angle brackets.
 HTML tags normally come in pairs like <b> and </b>they are usually paired
to start and end the tag instruction.
 The first tag in a pair is the start tag, the second tag is the end tag.
 The text between the start and end tags is the element content.
 HTML tags are not case sensitive; <b> means the same as <B>.

Syntax is:
<tag name> text (element content) </tag name>
<tag name attribute name=”argument/value”> text (element
content)
</tag name>
or just
<tag name>
For example:
1)<TITLE> WELCOME TO MY WEBSITE </TITLE>

2)<A HREF="URL"> CLICK HERE </A>

Tag Attributes :
Tags can have attributes. Attributes can provide additional information about the
HTML elements on your page, included inside the start tag.
Attributes always come in name/value pairs like this: name="value"
Syntax is
<tag name attribute name=”value”>
e.g. <IMG SRC=”c:\a.jpg”>
so here src is an attribute for image tag. Normally its value is specified in quotes.

Q.3) Explain general format of html document.


Answer:
Every HTML document should contain certain standard HTML tags. Each
document consists of head and body text. The head contains the title, and the body
contains the actual text that is made up of paragraphs, lists, and other elements.
Browsers expect specific information because they are programmed according to
HTML and SGML specifications.

 Simple html document

<HTML>
< HEAD >
<TITLE> HOME PAGE
</TITLE>
</HEAD>
<BODY> THIS IS MY FIRST WEB PAGE
</BODY>
</HTML>

Example Explained
The first tag in your HTML document is <HTML>. This tag tells your
browser that this is the start of an HTML document. The last tag in your document is
</HTML>. This tag tells your browser that this is the end of the HTML document.
The text between the <HEAD> tag and the </HEAD> tag is header information.
Header information is not displayed in the browser window. The title is displayed in
your browser's caption.
The text between the <BODY> tags is the text that will be displayed in your
browser.
The text between the <TITLE> tags is the title of your page

Q.4) Explain how html pages can be given name/title.


Answer:
 HEAD
The HEAD contains general information, or meta-information, about the
document. The HEAD tag defines an HTML document header. It is the first thing in
any document, lying above the BODY and just after the <HTML> tag starting the
document. The contents of the HEAD are not displayed as part of the document.
The HEAD tag can contain TITLE, BASE, ISINDEX, META, SCRIPT,
STYLE, and LINK tags.

Syntax
<HEAD>...</HEAD>

e.g. <HTML>
<HEAD>
<TITLE>WELCOME TO FIRST WEBSITE</TITLE>
</HEAD>
</HTML>

SCOAS&C_CS_TG
 TITLE
The title of a document is specified by the TITLE element, which should be
placed in the document HEAD. Each document can have only one title, which should
identify the document content in a general way.
The Title is not part of the document text and cannot contain hypertext links
or special markup commands -- it must be simple text. Often the title is used to label
the window displaying the text, or is used to label a place in a browser's history or
bookmark list. It therefore should be short -- less than 64 characters

Q.5) Explain various attributes of <BODY> tag.


Answer:
<BODY> Defines the document's body
The BODY element contains all the contents of a document
Various mark-up elements are allowed within the body to indicate headings,
paragraphs, lists, hypertext links, images, and so on.

Attributes in body tag


1) The BACKGROUND Attribute
This allows you to specify an image file to use as a background (a bit like a
watermark) behind the displayed text and graphics.
E.g.<BODY BACKGROUND="c:\a.gif">
Text….
</BODY>
So image a.gif will be set as a background to your web page.

2) Background color of the web page


Attribute is:BGCOLOR="#rrggbb"
Sets the background color to the specified RGB color value, where RR GG and
BB are the hexadecimal color codes for the Red, Green and Blue levels, ranging
from 0 to 255 -- that is, 00 to FF. The color "000000" is black, while "FFFFFF" is
white.

3) Setting the text color(TEXT Attribute)


Syntax: <BODY TEXT="#rrggbb">text in a body</BODY>
Sets the default text color to the specified RGB color value.

4) Setting color for hyperlinks (LINK Attribute)


Syntax: <BODY LINK="#rrggbb">text in a body</BODY>
Sets the default text color of hypertext anchors to the specified RGB color value.

5) Setting color for visited hyperlinks (VLINK Attribute)


Syntax: <BODY VLINK="#rrggbb">text in a body</BODY>
Sets the default text color of visited hypertext links to the specified RGB color
value.

Q.6) Explain following tags:


1)<BR> 2)<HR> and 3)headings tag.
Answer:
1) <BR> tag inserts a single line break
Line Breaks:
The <BR> tag is used when you want to end a line, but don't want to start a new
paragraph. The <BR> tag forces a line break wherever you place it.
E.g. This <BR> is line break.
So here This and is line break will appear on two different lines.
The <BR> tag is an empty tag. It has no closing tag.

2)<HR>tag defines a horizontal rule.


Used to produce a horizontal line, the width of browser’s window.
It allows to differentiate sections of your document.
SIZE and WIDTH attributes will let you alter the thickness
And the percentage of the windows covered by it.

e.g.<BODY>
<H1>This is my first web page</H1>
<HR SIZE=5 WIDTH=”20%”>
</BODY>

Headings
<H1>---<H6> Defines heading 1 to heading 6.
Headings are defined with the <H1> to <H6> tags. <H1> defines the largest
heading. <H6> defines the smallest heading (as shown).

Heading Size 1 Heading Size 2


Heading Size 3 Heading Size 4
Heading Size 5 Heading Size 6
E.g.
<H1 STYLE="COLOR: blue">THIS is displayed in large font with blue color </H1>
<H1 STYLE="FONT-FAMILY:verdana">This is displayed in verdana font style
</H1>
<H1 STYLE="FONT-SIZE:150%">You can define size in percentage also.</H1>
HTML automatically adds an extra blank line before and after a heading.

SCOAS&C_CS_TG
Q.7) Explain following HTML tags:
1)<MARQUEE> 2)<SUB>3)<SUP>
Ans:
1)<MARQUEE> TAG
MARQUEE, supported only by the Microsoft Internet Explorer 2 (and later)
browser, is used to create a scrolling text marquee.
e.g. <MARQUEE ALIGN=”top”>Scrolling text </MARQUEE>
creates a text marquee with the enclosed text scrolling along the frame.
The another attribute is DIRECTION defining direction of the marquee text.
e.g.<MARQUEE DIRECTION=”RIGHT”>WELCOME</MARQUEE>
So here WELCOME scrolls from left towards right. The default direction is
right to left.
But other commercial browsers, including Netscape Navigator, do not support
this element.

2) <SUB> tag: (Oct 2004,2005,Oct 2007,Mar 2008)


It is subscript tag. The text enclosed in <SUB>and </SUB> is displayed in subscript
form. This is useful in representation of mathematical formulae or chemical
equations.
e.g. H<SUB>2</sub>SO<SUB>4</SUB>
output displayed as :H2SO4

3) <SUP> tag:- It is superscript tag. The text enclosed in <SUP>and </SUP> is


displayed in superscript form. This is also useful in representation of mathematical
formulae or chemical equations.
e.g. volume of sphere is=(4/3)(3.14)r<SUP>3</SUP>
Output displayed as: volume of sphere is= (4/3)(3.14)r3

Q.8) What is URL? Explain hyper linking facility provided by html in detail
with various examples.
Answer:
URL stands for Uniform Resource Locator, which may represent an address
of document on web or Internet or simply a path to a document in a specific directory.
The World Wide Web uses Uniform Resource Locators (URLs) to specify the
location of files on other servers. A URL includes the type of resource being accessed
(e.g., Web, gopher, FTP), the address of the server, and the location of the file.
HTML provides you to jump from a link to any document or image or any
local or WebPages by using special tag, called <a> i.e. Anchor tag.
Syntax is: <A HREF=”URL”>name or image which can be treated as link</A>
Thus anchor is a piece of text or some other object (e.g. image), which marks
the beginning and/or the end of a hypertext link. The <A> element is used to mark that
piece of text (or inline image), and to give its hyper textual relationship to other
documents. The text between the opening and closing tags, <A attributes> ...text... </A>
can act as start or destination (or both) of a link. The HREF attribute (which is
actually optional) marks the anchor as the start of a link to another document or
resource (it could point, for example, to an image file), or to a particular place in
another document.
Syntax is:
<A HREF="URL (absolute or relative path)">anchor name </A>
An absolute or partial URL can specify the address of the referenced document:

Q.9) List any three types of hyperlinks with suitable examples.


Answer:
1) Link to a page on the World Wide Web.
<A HREF="http://www.yahoo.com">Enter your email-id</A>
The string ` Enter your email-id ' is a hypertext link to the website indicated
by URL specified

2) Link to an image by image as a link.


<A HREF="image2.jpeg"> <IMG SRC="image1.gif"> </A>
The image `image1.gif' is a hypertext link to the image file located in the same
directory. This will allow you to use a small icon that links the user to a larger version
of the same image.

3) Link to document located in different directory


<A HREF="d:\soft\a.html"> Click Here. </A>
Here by clicking on Click Here link, destination page will be
displayed which is specified in the path given.

4) Link to the same page (Links to a Particular Place in a Document)


<P><A HREF="#samepage">This is link to the same page. </A></P>
<A NAME="samepage"><H2>Yes You are in the same page.</H2></A>
Particular places in an HTML document can be marked as specific destinations of
hypertext links via the NAME attribute. Links to Specific Sections
Anchors can also be used to move a reader to a particular section in a document
(either the same or a different document) rather than to the top, which is the default.
This type of an anchor is commonly called a named anchor because to create the
links, you insert HTML names within the document.

5) Link to Mail (Mailto)


You can make it easy for a reader to send electronic mail to a specific person
or mail alias by including the mailto attribute in a hyperlink.
Syntax is:
<A HREF="mailto:emaiid@host">Name</A>
e.g.
<A HREF="mailto:[email protected]">Mail me</A>

SCOAS&C_CS_TG
Q.10) Explain various list types in html.
Answer:
HTML supports ordered, unordered and definition lists.
The different types of list tags are as follows
<OL> Defines an ordered list
<UL> Defines an Unordered List
<LI> Defines a list item
<DL> Defines a definition list
<DT> Defines a definition term
<DD> Defines a definition description
1. Unordered Lists
An unordered list is a list of items. The list items are marked with bullets (typically
small black circles). To make an unnumbered, bulleted list,
1. Start with an opening list <UL> (for unnumbered list) tag Enter the <LI> (list item)
tag followed by the individual item; no closing </LI> tag is needed
2. End the entire list with a closing list </UL> tag
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
e.g. <HTML>
<BODY>
<H4>This is Unordered List</H4>
<UL type = "circle">
<LI>Sunday</LI>
<LI>Monday</LI>
<LI>Tuesday</LI>
</UL>
</BODY>
</HTML>

The output displayed in browser is as follws:

This is Unordered List:


 Sunday
 Monday
 Tuesday
By specifying type attribute in the <UL> tag you can change shape of the bullet. The
standard shapes provided are "disk", "circle", and "square"

2. Ordered Lists
An ordered list is also a list of items. The list items are marked with
numbers. A ordered list also called as numbered .It is identical to an unnumbered
list, except it uses <OL> instead of <UL>. Inside a list item you can put paragraphs, line
breaks, images, links, other lists, etc. You can specify style of numbering for the list
items by giving type attribute in <OL> tag and it can take values "I" for uppercase
roman, "i" for lower case roman, "A" for uppercase letters, "a" for lower case alpha
numeric letter. The start attribute in <OL> tag is used to start the list from the
required number. e.g. <OL start = "6"> will start the list items from number 6.
e.g. <HTML>
<BODY>
<H4><B>This is an Ordered List</B></H4>
<OL type = "i">
<LI>Sunday</LI>
<LI>Monday</LI>
<LI>Tuesday</LI>
</OL>
</BODY>
</HTML>
so output given by browser is:

This is an Ordered List:


i) Sunday
ii) Monday
iii) Tuesday

3. Definition Lists
A definition list is not a list of items. This is a list of terms and explanation of
the terms. A definition list starts with the <DL> tag. Thus a definition list (coded as
<DL>) usually consists of alternating a definition term (coded as <DT>) and a
definition description (coded as <DD>). Web browsers generally format the definition
on a new line and indent it.
e.g.
<HTML>
<BODY>
<H4>This is a Definition List</H4>
<DL>
<DT>VB</DT>
<DD>Programming Language</DD>
<DT>VB SCRIPT</DT>
<DD>Scripting Language </DD>
</DL>
</BODY>
</HTML>
so output given by browser is:

This is a Definition List:


VB
Programming Language

SCOAS&C_CS_TG
VB SCRIPT
Scripting Language
Inside a definition-list definition (the <DD> tag) you can put paragraphs, line breaks,
images, links, other lists, etc.

4.Nested lists
Lists can be nested. You can also have a number of paragraphs, each containing a
nested list, in a single list item.
e.g.
<HTML>
<BODY>
<H4>This is example of Nested List</H4>
<UL>
<LI>Scripted Programming</LI>
<LI>Structured Programming
<UL>
<LI>Basic</LI>
<LI>PASCAL</LI>
</UL>
</LI>
<LI>Object Oriented Languages</LI>
</UL>
</BODY>
</HTML>

Q.11) Explain the various attributes of table tag.


Answer:
The TABLE tag defines a table. Inside the TABLE tag, use the TR tag to
define rows in the table, use the TH tag to define row or column headings, and use the
TD tag to define table cells. The TABLE tag can also contain a CAPTION tag, which
specifies the caption for the table you can specify the width of the border surrounding
the table and the default background color of the table. Table tag contains following
attributes.
Syntax :
<TABLE
ALIGN="LEFT|RIGHT|CENTER"
BGCOLOR="color"
BORDER="value"
CELLPADDING="value"
CELLSPACING="value"
HEIGHT="height"
WIDTH="width"
COLS="numOfCols"
HSPACE="horizMargin"
VSPACE="vertMargin"
>
...
</TABLE>

Table Attributes
 ALIGN
It specifies the horizontal placement of the table.
LEFT aligns the table on the left (the default).
RIGHT aligns the table on the right.
CENTER aligns the table in the center

 BGCOLOR="color"
It sets the color of the background for the table. This color can be overridden by a
BGCOLOR tag in the TH, TR, or TD tags.

 BORDER="value" It indicates the thickness, in pixels, of the border to draw


around the table. Give the value as an integer. no border. means value 0

 CELLPADDING="value"
It determines the amount of space, in pixels, between the border of a cell and the
contents of the cell. The default is 1.

 CELLSPACING="value"
It determines the amount of space, in pixels, between individual cells in a table.
The default is 2.

 HEIGHT="height"
It specifies the height of the table. The default is the optimal height determined by
the contents of each cell. It can be a number of pixels, or a percentage of the
height of the page or parent element.

SCOAS&C_CS_TG
 WIDTH="width"
It defines the width of the table. The default is the optimal width determined by
the contents of each cell. It can be a number of pixels, or a percentage of the
height of the page or parent element.

 COLS="numberOfColumns"
It indicates how many virtual columns of equal width fit in the width of the
window. If the WIDTH attribute is supplied, the COLS attribute indicates how
many virtual columns fit in the specified width. Suppose that the WIDTH
attribute is "80%" and the COLS attribute is 4. In this case, each column takes up
20% of the width of the window. Note, however, that if the minimum width
needed to display the contents of an actual column is greater than the width of a
virtual column, then the width of the column is expanded to fit its contents.

 HSPACE="horizontalMargin"
It specifies the distance between the left and right edges of the table and any
surrounding content.

 VSPACE="verticalMargin"
It specifies the distance between the top and bottom edges of the table and any
surrounding content.
Similarly you can define attributes within <TH> ... </TH> or <TD> ... </TD>
cells as---
 ALIGN (LEFT, CENTER, RIGHT):- Horizontal alignment of a cell.
 VALIGN (TOP, MIDDLE, BOTTOM):- Vertical alignment of a cell.
 COLSPAN=n The number (n) of columns a cell spans.
 ROWSPAN=n The number (n) of rows a cell spans.

Q.12) Explain with example use of rowspan and colspan attributes.


Answer:
HTML defines rowspan and colspan attributes which are written in <TD> or
<TR> tags.
Rowspan defines how many number of rows, a cell should span while colspan
defines how many number of columns ,a cell should span
Example:
<HTML>
<BODY>
<H4>WITHOUT CELLPADDING :</H4>
<TABLE BORDER="1">
<TR>
<TD COLSPAN=2 ALIGN=CENTER>PRGRAMMING LANGUAGE</TD>
</TR>
<TR>
<TD ROWSPAN=2>OBJECT ORIENTED LANGUAGE</TD>
<TD>JAVA</TD>
</TR>
<TR>
<TD>C++</TD>
</TR>
<TR>
<TD ROWSPAN=2>STRUCTURED LANGUAGE</TD>
<TD>C</TD>
</TR>
<TR>
<TD>BASIC</TD>
</TR>
</TABLE>
</BODY>
</HTML>

So the output displayed by browser. is:--

PRGRAMMING LANGUAGE
JAVA
OBJECT ORIENTED LANGUAGE
C++
C
STRUCTURED LANGUAGE
BASIC

Q.13) Explain <IMAGE>tag with different attributes associated with it.


Answer:
The IMG tag specifies an image to be displayed in an HTML document. An
image can be a plain image that simply appears on the page. An image can be
embedded in an <A HREF> tag so that the user can click it to open a URL. An image
can also be an image map, which has multiple clickable areas that each link to
different URLS. The HEIGHT and WIDTH attributes indicate the dimensions of the
image.
Images can be in the following types of formats:
 GIF (Graphics Interchange Format)
 JPEG (Joint Photographic Experts Group)
 XPM (X PixMap)
 XBM (X Bitmap)

SCOAS&C_CS_TG
Syntax
<IMG
SRC="location"
ALT="alterntiveText"
ALIGN="alignment"
BORDER="borderWidth"
HEIGHT="height"
WIDTH="width"
HSPACE="horizMargin"
VSPACE="verticalMargin"
>
The SRC attribute is compulsory
SRC="location (URL)"
It specifies the URL of the image to be displayed in the document.

ALT="alternative Text"
It specifies text to be displayed if the browser does not support the IMG tag or if the
user has suspended image loading in the browser.

ALIGN
It specifies the alignment of the image in relation to the surrounding text. If you do
not specify a value for ALIGN, browser uses BOTTOM as the default LEFT aligns
an image with the left margin.
 RIGHT aligns an image with the right margin.
 TOP aligns the top of an image with the top of the tallest item in the current line.
 TEXTTOP aligns the top of an image with the top of the tallest text in the current
line.
 MIDDLE aligns the middle of the image with the baseline of the text in the
current line.
 BASELINE aligns the bottom of an image with the baseline of the text in the
current line.
 BOTTOM is the same as BASELINE.

BORDER="border Width"
It specifies the width, in pixels, of a border around the image. The value must be an
integer.

HEIGHT="height"
It specifies the height of the image, either in pixels or as a percentage of the height of
the window, frame, or positioned block of HTML that contains the image. To indicate
a number of pixels specify the value as an integer, for example, "100". To indicate a
percentage, specify the value as an integer followed by the percentage sign, for
example "20%”.
WIDTH="width"
It specifies the width of the image either in pixels or as a percentage of the window,
frame, or positioned block of HTML containing the image. To indicate a number of
pixels specify the value as an integer, for example, "100". To indicate a percentage,
specify the value as an integer followed by the percentage sign, for example, "20%".

HSPACE="horizMargin"
It specifies a margin in pixels between the left and right edges of the image and
surrounding text and images. Give the value as an integer

VSPACE="verticalMargin"
It specifies a margin in pixels between the top and bottom edges of the image and
surrounding text and images. Give the value as an integer.

1) QuickTime movie :-- .mov


2) MPEG movie :-- .mpeg or .mpg

Q.14) Explain how image can be set as a background in web page.


Answer:
Inserting Image as a background:
Newer versions of Web browsers can load an image and use it as a
background when displaying a page. Background images can be a texture (linen
finished paper, for example) or an image of an object (a logo possibly). You create
the background image as you do any image.
<HTML>
<BODY BACKGROUND="background Image. jpg">
……….text within a body
</BODY>
</HTML>

Both gif and jpg files can be used as HTML background.


If the image is smaller than the page, the image will repeat itself.

Q.14) Explain the <script>tag.


Answer:
HTML pages with scripts are used to make them more dynamic and
interactive.
There are various scripting languages like VB Script; JavaScript etc.These can
be associated with HTML document using <script> tag.

SCOAS&C_CS_TG
Insert a Script into HTML Page
A script in HTML is defined with the <script> tag. Note that you will have to
use the type attribute to specify the scripting language
e.g.
<HTML>
<HEAD>
<TITLE>JAVA SCRIPT</TITLE>
</HEAD>
<BODY>
<SCRIPT TYPE="text/javascript">
document. write("Hello World!")
</SCRIPT>
</BODY>
</HTML>

The script above will produce the following output:


Hello World!
Beginning and ending <SCRIPT> tags surround the code. The LANGUAGE
attribute indicates the scripting language.You must specify the language because
browsers can use other scripting languages. You can use SCRIPT blocks anywhere
in an HTML page. You can put them in both the BODY and HEAD sections.
However, you will probably want to put all general-purpose scripting code in the
HEAD section in order to keep all the code together. Keeping your code in the HEAD
section ensures that the whole code is read and decoded before it is called from
within the BODY section.

e.g Random number generator using VB Script (Specimen paper)


<%@ LANGUAGE="VBSCRIPT" %>
<%
x=0
y=0
dim xarr(9)
Do While x < 10
Randomize
Myval= Int((100 * Rnd) + 1)
Y=0
For y=0 to 9
If MyVal = xarray(y) then
Match = True
Exit for
Else
Match = False
End If
Next
If Match = False then
xarray(x) = MyVal
x=x+1
End If
Loop
%>
<HTML>
<BODY>
<TITLE>RANDOM GENERATOR</TITLE>
<%x=0'for x=0 to 9%>
< P><%response.write(x+1)%>)&nbsp;<%response.write(xarray(x))%> </P>
<%'next%>
</BODY>
</HTML>

Solved Examples
Q.1) Write HTML code to display a Message using different Font attributes.
Answer:
<HTML>
<HEAD>
<TITLE> HTML Document </TITLE>
</HEAD>
<BODY><FONT SIZE="7" face="Comic Sans MS">This is font size 7 with comic
sans ms font</FONT>
<p><FONT SIZE="5" COLOR="red">This is red colored text with font size
5</FONT></p>
</BODY>
</HTML>
Output is:

SCOAS&C_CS_TG
Q.2) Write HTML code to explain Different levels of headings with different
alignments.
Answer:
<HTML>
<HEAD>
<TITLE>Headings </TITLE>
</HEAD>
<BODY>
<H1 align="left">First level left aligned Heading</H1>
<H2 align="center">Second Level center aligned heading</H2>
<H3 align="center">Third level center aligned heading</H3>
<H4 align="right">Fourth level right aligned heading</H4>
<H5 align="right">Fifth level right aligned heading</H5>
<H6 align="left">Sixth level left aligned heading</H6>
</BODY>
</HTML>
Output is:
Q. 3) Write HTML code to explain different Lists in Html.
Answer:
<HTML>
<HEAD>
<TITLE> lists </TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H3>Sample of Unordered lists</H3>
<UL type="disc">
<LI>HI
<LI>HELLO
</UL>
<H3>Sample of Ordered lists</H3>
<OL type="A" start=3>
<LI>WELCOME
<LI>NAMASKAR
</OL>
<H3>Sample of Definition lists</H3>
<DL>
<DT>HTML
<DD>HYPER TEXT MARKUP LANGUAGE
<DT>URL
<DD>UNIFORM RESOURCE LOCATOR
</DL></BODY>
</HTML>
Output is:

SCOAS&C_CS_TG
Q.4) Write HTML code for the following:
Answer:

YEAR
1998 1999 2000
UNITS 500 400 1000
SALES
INCOME 1000 800 2000
<HTML>
<BODY>
<TABLE BORDER>
<TR>
<TH ROWSPAN="2" COLSPAN="2">
<TH COLSPAN="3">YEAR
<TR>
<TH>1998
<TH>1999
<TH>2000
</TR>
<TR>
<TH ROWSPAN="2">SALES
<TH>UNITS
<TD>500
<TD>400
<TD>1000
</TR>
<TR>
<TH>INCOME
<TD>1000
<TD>800
<TD>2000
</TR>
</TABLE>
</BODY>
</HTML>

Q.5) Write the exact output of the following HTML code with font specifications
in brackets:
Answer:
<HTML>
<BODY>
<H1> LIST OF BOOKS </H1> <HR>
<UL TYPE = "CIRCLE">
<LI> How to solve it By computer
<LI> HTML in Easy Steps
<LI> C++ Programming
</UL>
<OL type = "A">
<LI> Microprocessor Programming
<LI> Networking Essentials
<LI> Microcontrollers
</OL>
</BODY>
</HTML>

Output given by browser is:


List of books (text size hl)
 How to solve it By computer
 HTML in Easy steps
 C ++ Programming
A. Microprocessor Programming
B. Networking Essentials
C. Micro Controllers

6) Write a HTML code with VBscript for a web page which greets “Good Morning “
if time is 12.00A.M. to 12 P.M. else greets “Good Afternoon”.

<HTML>
<HEAD>
<TITLE>Greeting </TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=”VBSCRIPT”
Function Greeting ()
If time()=#12:00:00 AM # and
time()<=12:00:00 PM # Then
greeting=”Good Morning”
else
greeting=”Good Morning”
End if
End function
Document .write Greeting ()
</SCRIPT>
<BR>
<H2> Welcome to world of HTML & WEB DESIGNING</H2>

SCOAS&C_CS_TG
</BODY>
<HTML>

Objective Questions
Select the correct alternative and rewrite the following. [1 Mark each]
i) The ------------- tag contains general information, or meta-information, about the
document.
a) <HEAD> b) <MARQUEE> c) <TITLE> d)<BODY>
ii) The block-level elements contain ------------- tag.
a) <PRE> b) <BODY> c) <MARQUEE> d) <HTML>
iii) ------------- Attribute is used for setting color for visited hyperlinks
a) VLINK b) LINK c)HLINK
iv) ------------- specifies the distance between the left and right edges of the table
and any surrounding content.
a) CELLSPACING b) CELLPADDING
c) HSPACE d)VSPACE
v) A ------------- tag, specifies the title for the table
a) CAPTION b)TITLE c)HEAD
vi) In ------------- type of list, list items are marked with bullets.
a) ORDERED b)DEFINITION c) NESTED d)UNORDERED
vii) ------------- attribute in the body tag specify an image file to use as a
background.
a) BGCOLOR b) BACKGROUND
c) BGIMAGAE d) BACKGROUNDIMG
viii) <a> tag has attribute ------------- which defines URL of the document to be
linked.
a) SRC b ) HREF c)VREF d)REF
ix) URL stands for -------------.
a) Uniform Resource Locator b) Unified Resource Location
c) Uniform Resource Link
x) HREF attribute in <A>tag stands for -------------.
a) Horizontal reference b)Hypertext reference
c) Hyperlink reference d)Hypermedia reference
xi) To place the image into an HTML file ------------- attribute is used in IMG
tag.
a) < URL > b) < ALT > c) < SRC > d) < HREF>
xii) ------------- tag is used to put a line break in HTML code.
a)<HR> b) <BR> c) <P> d)<TR>
Answers: i) <HEAD>, ii) <BODY>, iii) VLINK, iv) HSPACE, v) UNORDERED,
vi) BACKGROUND, vii) HREF, viii) Uniform Resource Locator, ix) Hypertext
Reference x) <BR>

 Write HTML code to do following:-


Q.1) Write HTML code to do following.:--
a) Give title to your web page as “Exam”.
b) Include background color as pink and text in green colour. Have a different font
for page title and contents of the page.
c) Have a hyperlink to different page having url as “Result1.htm”
d) The resultant web page of this hyperlink should contain scrolling text as “All
THE BEST ” in bold, italic and black color and light blue as a background
color.

Q.2) Write HTML code for following:---

Collge Name:S.P.College.

Admission data.
streams capacity
Commerce 150
Science 100
Arts 100

Here Admission data. Should be the scrolling text.


Collge Name:S.P.College should be in bold, italics and in red color.
It should be hyper linked with th page containing college information.

Q.3) Write HTML code to do following.:--


a) Give title to your web page as “TUTORIAL”.
b) Include background color as light blue and
c) Text in red color.
d) Have a image “IMAGE.JPG” as an hyperlink.
e) The resultant web page of this hyperlink should contain scrolling text as”Best
Of Luck” in bold, italic and green color. And “IMGNEW.JPG” image as the
background of the page.

SCOAS&C_CS_TG
Q.4) Write HTML code for following.:---
Collge Name:Cummins College Of Engg.

CCOEW

Courses No.of students.


Computer 120
Instrumentation 80
E & TC 60

Where image “LOGO.JPG” is shown as: CCOEW


W
Q.5) Write HTML code to do following:
Todays Special:---
PIZZA With toppings 150. Rs.
(Domino’s) Without toppings 125.Rs.
Mashroom PavBhaji 40 .Rs.
Cheese PavBhaji 42Rs. (With Butter) 40Rs.
PavBhaji
Jain PavBhaji 40. Rs.

Q.6) Write the HTML code for the following table: (Mar.2004)

Year
1999 2000 2001
Units 300 750 1,200
Sales
Income Rs. 3,000 Rs. 7,500 Rs. 12,000




You might also like