Friday, 6 July 2018

HTML Notes


Information Representation Method—HTML-I 40
Class X: Chapter 5
Summative Assessment
Multiple-Choice Questions (MCQs)

1. The tags that need both starting and ending tags are
called: .
a. Container tags b. Empty tags
c. Closing tags d. None of these
Ans. A

2. tag is used to change the font size,
style, and colour of the text.
a. <BR> b. <HR>
c. <H1> d. <FONT>
Ans. D

3. The hexadecimal RGB value of the black colour is
.
a. #FFFFF b. #000000
c. #0 d. None of these
Ans. B

4. The language of the HTML document is defined
with the help of the attribute of the
<HTML> tag.
a. L b. LANG
c. BODY d. None of these
Ans. B

5. attribute of the <BODY> tag is used
to insert an image as the background of a Web page.
a. IMAGE b. BACKGROUND
c. FORMAT d. None of these
Ans. b
6. tag is used to centralize the text within
the segment.
a. <CENTER> b. <H1>
c. <TEXT> d. None of these
Ans. A

7. The output of the 3<SUP>rd<SUP> code is
.
a. 3rd b. 3<SUP>rd<SUP>
c. 3 d. None of these
Ans. A

8. Among the following, which is the RGB color scheme
for the colour Red?
a. 255, 0, 0 b. 0, 0, 255
c. 0, 255, 0 d. None of these
Ans. A

9. Which is the first version of HTML?
a. HTML 1.0 b. HTML 5
c. HTML 2.0 d. HTML 3.0
Ans. A

10. Which HTML tag is used to insert title in an HTML
document?
a. <TITLE> b. <HEAD>
c. <BODY> d. <HTML>
Ans. A

11. Which types of tags are used in HTML?
a. Predefined tags
b. User-defined tags
c. Tags used only for linking
d. Language-specific tags
Ans. a
12. The FACE attribute of the <FONT> tag is used for
.
a. Changing the font type of the text
b. Changing the font color of the text
c. Changing the font size of the text
d. None of these
Ans. A

13. Which tag is used for line break?
a. <HR> b. <BR>
c. <P> d. <EM>
Ans. B

14. Which attribute is used with the <BODY> tag to
apply the background colour to an HTML page?
a. BACKGROUND b. COLOR
c. BGCOLOR d. BCOLOR
Ans. C





Chapter 5: Information Representation Method—HTML-I
Solutions
41 Foundation of Information Technology
Class X: Chapter 5
15. Which HTML tag is used to underline the text?
a. <I> b. <B>
c. <C> d. <U>
Ans. d
16. HTML tags are placed between .
a. Hard brackets b. Angular brackets
c. Curly brackets d. None of these
Ans. b
17. HTML tags can be written in .
a. Capital letters
b. Small letters
c. Both capital and small letters
d. None of these
Ans. c
18. Which value is used for white color?
a. #00FFFF b. #000000
c. #FFFFFF d. #FFFF00
Ans. c
19. Which is not a logical text style?
a. <DFN> b. <EM>
c. <I> d. <CITE>
Ans. c
20. Empty tags require:
a. Opening tag
b. Closing tag
c. Both opening and closing tags
d. None of these
Ans. a
21. Which HTML tag is used to insert a horizontal rule?
a. <HR> b. <BR>
c. <P> d. <EM>
Ans. a
22. Which one is the correct syntax of the HTML tag?
a. <PARA>HTML</PARA>
b. <b>HTML<b>
c. <P>HTML</P>
d. None of these
Ans. c
23. The <BASEFONT> tag is supported by .
a. Internet Explorer b. Mozilla
c. Opera d. All of these
Ans. a
24. The headings can be differentiated on the basis of
their and .
a. Typeface, space
b. Font type, size
c. Font size, alignment
d. Space between the headings, alignment
Ans. a
25. When you want to provide breaks in the text or want
the text to appear as a new, separate line, you need
to use the tag.
a. <BR> b. <P>
c. <HR> d. <BODY>
Ans. a
26. A/an is a code that is put into the
HTML code of a Web page to hide the text in a Web
page.
a. ALIGN attribute b. Comment
c. Content d. None of these
Ans. b
27. Which among the following will create a bulleted
list?
a. Unordered b. Option
c. Decorated d. Ordered
Ans. a
Very Short Answer Questions
28. How can you display the 2D or 3D horizontal rule in
a Web page?
Ans. To display the 2D horizontal rule, you need to put the following
code in your HTML document:
<HR SIZE=”30” NOSHADE>
29. Mention the tags that are used to create a definition
list.
Ans. The <DL> tag is used to create a definition list. You can create
items in the definition list with the <DT> tag and <DD> tag.
30. What are the different types of lists supported in
HTML?
Ans. The following types of lists are supported in HTML:
€€ Ordered
€€ Unordered
€€ Definition
31. What is the full form of RGB?
Ans. The full form of RGB is Red Green Blue.
32. What does <H6> signify?
Ans. <H6> is the smallest of all HTML heading levels.
33. What is the use of the SIZE attribute in the
<BASEFONT> tag?
Ans. In HTML, the SIZE attribute of the <BASEFONT> tag is used to
change the default size of the selected font.
Information Representation Method—HTML-I 42
Class X: Chapter 5
34. Mention the tags that are used to create an
unordered list.
Ans. An unordered list uses <UL> tag and <LI> tag to display the list
of items in the bulleted format.
Short Answer Questions
35. What is the basic difference between <BR> and
<P> tags?
Ans. The main difference between the <BR> and <P> tags is that the
<BR> tag is used to insert a line break on the Web page; whereas,
the <P> tag is used to mark a block of text as a paragraph or
separate your text into different paragraphs. The <P> tag not
only allows you to represent the text in the paragraph format but
also enables you to format the paragraph text.
36. Mention the difference between an attribute and a
tag.
Ans. An attribute provides additional information about the HTML tag.
For example, to specify a background color for a Web page, you
need to use the BACKGROUND attribute with the <BODY> tag. On
the other hand, in HTML, a tag is a command to instruct the Web
browser how to display the content in a Web page. For example,
the <HTML> tag tells the Web browser that the document, which
contains the <HTML> tag, is an HTML document.
37. List the tag specifications of the HEAD tag.
Ans. The <HEAD> tag specifications are defined as follows:
€€ Type: Container element
€€ Function: Header information
€€ Attributes: dir and lang
€€ Contains: Title, style, etc.
€€ Used inside: <HTML> tag
38. What is a Title bar and how is it helpful?
Ans. A Title bar is a horizontal bar placed on the top of an application
window. The Title bar displays the name of the application and
the currently opened document. On the right side of the Title bar,
there are buttons, which you can use to minimize the application
window in the form of a button on the Taskbar, maximize the size
of the application window to cover the entire screen area, and
close the application window.
39. List any five colors and their RGB values.
Ans. The list of colors and their RGB values are shown in the following
table:
Table: RGB Color Values for Predefined Colors
Color Value
Black #000000
Blue #0000FF
Green #008000
Red #FF0000
Yellow #FFFF00
Long Answer Questions
40. Differentiate between the container and empty tags
with examples.
Ans. The container tag refers to a tag that contains an opening as
well as a closing tag. Examples of container tags are <HTML></
HTML>, <HEAD></HEAD>, <TITLE></TITLE>, and
<BODY></BODY>. On the other hand, an empty tag refers to a
tag that contains only an opening tag, such as <BR> and <HR>.
41. Explain the use of the <PRE> tag with the help of
an example.
Ans. The <PRE> tag in HTML defines the preformatted text. This
implies that this tag helps you not only display text in the Web
browser in a fixed-width font but also display the text in the same
way as you have typed it in the code. The <PRE> tag displays the
text in the Web browser with all blank lines and tabs. The default
text font that the <PRE> tag uses is the Courier font. You should
use the <PRE> tag to maintain a text format, which includes line
breaks and tabs.
The following code shows the use of the <PRE> tag:
<HTML>
<HEAD>
<TITLE> WELCOME TO HTML </TITLE>
</HEAD>
<BODY>
<PRE>
This text is inside the PRE tag
and therefore
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks
</PRE> This text
is not inside the PRE tag
and therefore will be displayed
in a single line.
</BODY>
</HTML>
The output of the above mentioned code is shown in
Figure 1:
Figure 1: Showing the <PRE> Tag
42. List the different ways in which a paragraph can be
aligned.
Ans. In HTML, there are three types of alignments, which are:
€€ Left
€€ Right
€€ Center
43. List the attributes of the <FONT> tag.
Ans. The attributes of the <FONT> tag are described in the following
table:
43 Foundation of Information Technology
Class X: Chapter 5
Table: Attributes of the <FONT> Tag
Attribute Name Syntax Description
<SIZE> <FONT SIZE
=”Font size”>
Specifies the size
of the font. For
example, to set
the size of the text
“Hyper Text Markup
Language” in the
Web page to 20,
we type: <BODY
Hyper Text Markup
Language <FONT
SIZE=”20”>.
<FACE> <FONT FACE
=”Font style”>
Specifies the style
of the font. For
example, to set the
font style of the
text “Hyper Text
Markup Language”
in the Web page
as Algerian, we
type: <BODY
Hyper Text Markup
Language <FONT
FACE=”Algerian”>.
<COLOR> <FONT COLOR
=”Font color
name”>
Specifies the color
of the font. For
example, to set the
color of the text
“Hyper Text Markup
Language” in the
Web page as blue,
we type: <BODY
Hyper Text Markup
Language <FONT
COLOR=”blue”>.
44. List the different logical text styles along with their
explanation.
Ans. The various logical text styles are:
€€ <DFN>: Displays the text in italics. You can use this style for
defining a single word.
€€ <EM>: Displays the text in italics. You can use this style for
emphasizing a single line.
€€ <CITE>: Displays the text in italics. You can use this style for
quotations, title of books, and name of characters.
€€ <CODE>: Displays the text in a fixed width font. You can use
this style for including code in your text.
€€ <KBD>: Displays the text in plain width font. You can use
this style for including keyboard entries.
€€ <SAMP>: Displays the text in a fixed width font. You can use
this style for literal characters.
€€ <STRONG>: Displays the text as bold. You can use this style
for strong emphasis.
€€ <VAR>: Displays the text as italics. You can use this style
for variables.
45. What is the difference between superscript and
subscript?
Ans. A character or symbol set, printed or written beneath or
slightly below and to the side of another character is known as
subscript. On the other hand, a character or symbol set, printed
or written above and to one side of another character is known as
superscript.
46. Provide an example of creating an unordered list
inside an ordered list.
Ans. The following source code allows you to create an unordered list
inside an ordered list:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>List the details of students:
<OL>
<LI> Kavya Sharma<UL TYPE=”circle”>
<LI> Passed 10th in 1999 </LI>
<LI> Passed 12th in 2001</LI>
<LI> Passed B.COM in 2004</LI>
<LI> Passed MCA in 2008</LI>
</UL> </LI>
<LI> Ambar <UL TYPE=”circle”>
<LI> Passed 10th in 1998 </LI>
<LI> Passed 12th in 1999</LI>
<LI> Passed B.A. in 2002</LI>
</UL>
</LI>
<LI> Aashi
<UL TYPE=”circle”><LI> Passed 10th in
1997 </LI>
<LI> Passed 12th in 1998</LI>
<LI> Passed BCA in 2001</LI>
</UL> </LI>
<LI> Anjali Gupta</LI>
<LI> Parth Upreti </LI>
</OL>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 2:
Figure 2: Creating an Unordered List Inside an Ordered List
Formative Assessment
Application-Oriented Questions
1. Write the HTML code to display an image as the
background of a Web page.
Ans. The following code allows you to display an image as the
background of a Web page:
<HTML>
<HEAD>
<TITLE>
</TITLE>
Information Representation Method—HTML-I 44
Class X: Chapter 5
</HEAD>
<BODY BACKGROUND=”fish.jpg”>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 3:
Figure 3: Displaying an Image as the Background of a Web Page
2. Write the HTML code to present the following line in
different physical styles:
HTML is a markup language.
Ans. The following code allows you to display the given text in the
different physical styles:
<HTML>
<HEAD>
<TITLE>Physical styles
</TITLE>
</HEAD>
<BODY>
<B> HTML is a markup language. </B> <BR> <BR>
<I> HTML is a markup language. </I> <BR> <BR>
<U> HTML is a markup language. </U> <BR> <BR>
<TT> HTML is a markup language. </TT>
<BR> <BR>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 4:
Figure 4: Showing the Given Line in Different Physical Styles
3. Write the HTML code to present ‘HTML is markup
language’ text in the following style:
a. The text should be at heading level 3
b. The text should be left aligned
c. The text color should be red
d. The font should be Comic Sans Ms
e. The font size should be 5
Ans. The following code allows you to display the text as per given
instructions:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<FONT SIZE=5 COLOR=”red” FACE=” Comic
Sans Ms”>
<P ALIGN=”left”>
<H3>
HTML is markup language
</H3>
</P>
</FONT>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 5:
Figure 5: Showing the Output in the Given Style
4. Create an unordered list in square bullets.
Ans. The following code allows you to create an unordered list and
change the style of bullets:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
Different types of flowers:
<UL TYPE=”square”>
<LI> Rose </LI>
<LI> Lotus </LI>
<LI> Lily </LI>
<LI> Jasmine </LI>
</UL>
</BODY>
</HTML>
The output of the above mentioned code is shown in
Figure 6:
Figure 6: Unordered List with Square Bullets
45 Foundation of Information Technology
Class X: Chapter 5
5. Create an ordered list with the A, B, C numbering
style.
Ans. The following code allows you to create an ordered list and set its
style of numbering:
<HTML>
<HEAD>
<TITLE> Planets
</TITLE>
</HEAD>
<BODY>
The nine planets of the Solar system are:
<OL TYPE=”A”>
<LI> Mercury </LI>
<LI> Venus </LI>
<LI> Earth </LI>
<LI> Mars </LI>
<LI> Jupiter </LI>
<LI> Saturn </LI>
<LI> Uranus </LI>
<LI> Neptune </LI>
<LI> Pluto </LI>
</OL>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 7:
Figure 7: Ordered List in A, B, C Numbering Style
6. Write the HTML code to display the text exactly the
same way as given here:
My first page is:
Welcome to HTML.
Ans. The following code allows you to display the text exactly in the
same way as given in the question:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<PRE>
My first page is:
Welcome to HTML.
</PRE>
</BODY>
</HTML>
7. Write an HTML code to display the ‘HyperText
Markup Language’ text as heading level 2.
Ans. The following code allows you to display the “Hypertext Markup
Language” text as heading level 2:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<H2>
Hypertext Markup Language
</H2>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 8:
Figure 8: Displaying the Given Line as Heading Level 2
8. Write an HTML code to display the background color
of a Web page as red.
Ans. The following code allows you to display the background color of
a Web page as red:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY BGCOLOR=”red”>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 9:
Figure 9: Displaying the Background Color of a Web Page as Red
9. Write an HTML code to the display the text
‘DREAMTECH’ in bold text style.
Ans. The following code allows you to display the text “DREAMTECH”
in bold text style:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<B>
DREAMTECH
</B>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 10:
Figure 10: Displaying the Given Text in Bold
Information Representation Method—HTML-I 46
Class X: Chapter 5
10. Write an HTML code to apply the font size 20 to the
text ‘Delhi.’
Ans. The following code allows you to set the font size of the given
text: <HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<FONT SIZE=20>
Delhi
</FONT>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 11:
Figure 11: Applying the Font Size 20 to the Given Text
11. Write an HTML code to display a horizontal line of
25% size in blue colour.
Ans. The following code allows you to display a horizontal line of the
specified color and size:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<HR SIZE=25%>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 12:
Figure 12: Displaying a Horizontal Line of 25% Size in Blue Color
12. Write an HTML code to display the text in a
paragraph as shown here:
An HTML document is a file in which you can write
code of HTML. HTML document contains HTML tags
and their attributes and plain text that create the
Web page.
Ans. The following code allows you to display the given text in the
paragraph format:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<P>
An HTML document is a file in which you can write code of HTML.
HTML document contains HTML tags and their attributes and plain
text that create the Web page.
</P>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 13:
Figure 13: Displaying the Given Text in a Paragraph
13. Write an HTML code to display the text ‘My First
Web Page’ as title.
Ans. The following code allows you to display the “My First Web Page”
as title:
<HTML>
<HEAD>
<TITLE>
My First Web Page
</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 14:
Figure 14: Displaying the Given Text as Title of the Web Page
14. Write an HTML code to display the body text that
appears 45 pixels away from the top edge of the
Web page and 60 pixels away from the left edge of
the Web page.
Ans. The following code allows you to set the top and left margins of
the Web page:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY TOPMARGIN=40 LEFTMARGIN=60>
An HTML document is a file in which you can write code of HTML.
HTML document contains HTML tags and their attributes and plain
text that create the webpage.
</BODY>
</HTML>
47 Foundation of Information Technology
Class X: Chapter 5
The output of the above mentioned code is shown in Figure 15:
Figure 15: Displaying the Body Text in the Given Style
15. Write an HTML code to display a paragraph in right
alignment.
Ans. The following code allows you to display a paragraph in right
alignment:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<P ALIGN=”right”>
An HTML document is a file in which you can write code of HTML.
HTML document contains HTML tags and their attributes and plain
text that create the webpage.
</P>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 16:
Figure 16: Displaying the Paragraph in Right Alignment
16. Write an HTML code to display the text ‘I am in 10th
standard’ in blue color with heading level 4.
Ans. The following code allows you to display the given text in blue
color with heading level 4:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY TEXT=”blue”>
<H4> I am in 10th standard </H4>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 17:
Figure 17: Displaying the Given Text in Blue Color with Heading
Level 4
17. Write an HTML code to display the 3D horizontal
rules.
Ans. The following code allows you to display the 3D horizontal rules:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<HR>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 18:
Figure 18: Displaying the 3D Horizontal Rules
18. Write an HTML code to display the text ‘HTML
stands for HyperText Markup Language’ in the italic
and underline text style.
Ans. The following code allows you to display the given text in the italic
and underline text style:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<I>
<U>
HTML stands for Hyper Text Markup Language
</U>
</I>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 19:
Figure 19: Displaying the Given Text in the Italic and Underline
Text Style
19. Write an HTML code to display the change in
appearance of the text by changing the base font
size.
Ans. The following code allows you to change the base font size:
<HTML>
<HEAD>
<BASEFONT SIZE=5>
<TITLE>
</TITLE>
</HEAD>
<BODY>
Information Representation Method—HTML-I 48
Class X: Chapter 5
Welcome to HTML
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 20:
Figure 20: Changing the Appearance of the Text
20. Write an HTML code using the <IMG> tag to display
an image in 300x300 pixels with alternate text as
‘Happy Browsing.’
Ans. The following code allows you to insert an image of size 300x300
pixels with alternate text:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<IMG SRC=”internet.jpg” HEIGHT=300 WIDTH=300
ALT=”Happy Browsing”>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 21:
Figure 21: Displaying an Image in 300x300 Pixels
21. Write an HTML code that uses the different text
styles with following instructions:
Text Style Apply to Text
<EM> It specifies the size of the font.
<STRONG> It is used to give strong emphasis.
<VAR> It is used to represent a variable.
Ans. The following code allows you to display the text as per the given
instructions:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<EM> It specifies the size of the font. </EM>
<BR>
<STRONG> It is used to give strong emphasis.
</STRONG> <BR>
<VAR> It is used to represent a variable. </
VAR> <BR>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 22:
Figure 22: Showing the Text in Different Styles
22. Write an HTML code to display the text ‘My First
Web Page’ in the center of the Web page.
Ans. The following code allows you to center align the selected text:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<CENTER>
My First Web Page
</CENTER>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 23:
Figure 23: Display the Given Text at the Center of the Web Page
23. Write an HTML code to display the following output:
The parts of a computer are:
€€ Monitor
€€ Keyboard
€€ Mouse
€€ CPU
Ans. The following code allows you to display the given text in the
given unordered list format:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
The parts of a computer are:
<TABLE>
<TR><TD><UL TYPE="circle"><LI>Monitor</LI></
49 Foundation of Information Technology
Class X: Chapter 5
UL></TD> <TD><UL TYPE="circle"><LI>Mouse</
LI></UL></TD></TR>
<TR><TD><UL TYPE="circle"><LI>Keyboard</LI></
UL></TD> <TD><UL TYPE="circle"><LI>CPU</LI></
UL></TD></TR>
</TABLE>
</BODY>
</HTML>
24. Write an HTML code to display the following output:
To save a notepad file as an HTML document,
perform the following steps:
1. Click the File menu.
2. Select the Save option. The Save As dialog box
appears.
3. Select the location.
4. Type the file name with .html extension.
5. Click the Save button.
Ans. The following code allows you to display the given text in the
given ordered list format:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
To save a notepad file as an HTML document, perform the
following steps:
<OL TYPE=”1”>
<LI> Click the File menu. </LI>
<LI> Select the Save option. The Save As dialog
box appears. </LI>
<LI> Select the location. </LI>
<LI> Type the file name with .html extension.
</LI>
<LI> Click the Save button. </LI>
</OL>
</BODY>
</HTML>
25. Write an HTML code to display a paragraph that is
center aligned.
Ans. The following code allows you to display a paragraph that is center
aligned:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<P ALIGN=”center”>
Hypertext is a text that contains links to
other text in a Web page.
</P>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 24:
Figure 24: Displaying a Paragraph with Center Alignment
26. Write an HTML code to display the output in the
following way:
H2O and SO4
Ans. The following code allows you to display the text as mentioned in
the question:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
H<SUP>2</SUP>O and SO<SUB>4</SUB>
</BODY>
</HTML>
27. Write an HTML code to display the output in the
following way:
Ram Sharma,
(X2 Y2 Z2 ) + (2 X2Y2Z2)
Ans. The following code allows you to display the text as mentioned in
the question:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
RamSharma, <BR>
(X<SUP>2</SUP> Y<SUP>2</SUP> Z<SUP>2 </SUP>)
+ (2 X<SUP>2</SUP>Y<SUP>2</SUP>Z<SUP>2</SUP>)
</BODY>
</HTML>
28. Write an HTML code to display the following output:
The OpenOffice suite includes the following
applications:
€€ Writer
€€ Calc
€€ Base
€€ Impress
Ans. The following code allows you to display the text in the mentioned
unordered list format:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
The OpenOffice suite includes the following applications:
<TABLE>
<TR><TD><UL TYPE="circle"><LI>Writer</LI></
UL></TD><TD><UL TYPE="circle"><LI>Base</LI></
UL></TD></TR>
<TR><TD><UL TYPE="circle"><LI>Calc</LI></
UL></TD><TD><UL TYPE="circle"><LI>Impress</
LI></UL></TD></TR>
</TABLE>
Information Representation Method—HTML-I 50
Class X: Chapter 5
</BODY>
</HTML>
29. Write an HTML code to insert an image by providing
the following parameters to their attributes:
Height=400
Width=500
Alt= ***** Hello ******
Ans. The following code allows you to insert an image as per the
instructions mentioned in the question:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<IMG SRC=”taj.jpg” HEIGHT=400 WIDTH=500
ALT=”***** Hello ******”>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 25:
Figure 25: Inserting an Image with the Given Parameters
The ALT attribute is not supported by Mozilla Firefox. Thus, the
output is shown in Internet Explorer.
30. Write an HTML code to change the font face of the
text as PakType Naqsh.
Ans. The following code allows you to change the font face of the text:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<FONT FACE=”PakType Naqsh”>
Welcome to HTML. The font of the text gets changed into PakType
Naqsh.
</FONT>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 26:
Figure 26: Changing the Font Face of the Text
31. Write an HTML code to display the text ‘Welcome to
HTML’ in font size 20 and font color as red. Ans 31.
The following code allows you to display the code in
the specified font size and color:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<FONT SIZE=20 COLOR=”red”>
Welcome to HTML.
</FONT>
</BODY>
</HTML>
The output of the above mentioned code is shown in
Figure 27:
Figure 27: Displaying the Given Text in Font Size 20 and Font
Colour Red
32. Write an HTML code to display the following output:
My first Web page
Ans. The following code allows you to display the output given in the
question:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
My first Web page
</BODY>
</HTML>
33. Write an HTML code to horizontally divide your Web
page into five parts or sections.
Ans. The following code allows you to horizontally divide your Web
page into five parts or sections:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<HR>
<BR>
<BR>
<BR>
51 Foundation of Information Technology
Class X: Chapter 5
<HR>
<BR>
<BR>
<BR>
<HR>
<BR>
<BR>
<BR>
<HR>
<BR>
<BR>
<BR>
<HR>
<BR>
<BR>
<BR>
</BODY>
</HTML>
The output of the above mentioned code is shown in
Figure 28:
Figure 28: Displaying the Web Page into Five Parts
34. Write an HTML code to display the text in the
following way:
€€ HTML stands for HyperText Markup Language (with Blue
color, Font Size 20)
€€ HTML stands for HyperText Markup Language (with Green
color, Heading 2 style)
€€ HTML stands for HyperText Markup Language (with Red color,
Center align, Underline style)
Ans. The following code allows you to display the text as per the
instructions given in the question:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<UL TYPE=”circle”>
<LI><FONT SIZE=20 COLOR=”blue”>
HTML stands for Hyper Text Markup Language
</FONT> </LI>
<LI><FONT COLOR=”green”>
<H2>
HTML stands for Hyper Text Markup Language
</H2>
</FONT> </LI>
<LI><FONT COLOR=”red”>
<CENTER>
<U>
HTML stands for Hyper Text Markup Language
</U>
</CENTER>
</FONT> </LI>
<LI><B>
<H3>
HTML stands for Hyper Text Markup Language
</H3>
</B> </LI>
<LI><I>
<P ALIGN=”right”>
HTML stands for Hyper Text Markup Language
</P>
</I> </LI>
</UL>
</BODY>
</HTML>
The output of the above mentioned code is shown in
Figure 29:
Figure 29: Displaying the Text in the Given Style
35. Write an HTML code to view the following output:
Ans. The following code allows you to create the output as shown in
the question:
<HTML>
<HEAD> <TITLE>Computer Input and Output Devices</
TITLE>
</HEAD>
<BODY>
<CENTER>
<H1>Computer Input and Output Devices</H1></
CENTER>
<HR>
<H3>Input Devices</H3>
<UL>
<LI>Keyboard</LI>
<LI>Mouse</LI>
<LI>Light Pen</LI>
<LI>Bar Code Reader</LI>
</UL>
<H3>Output Devices</H3>
<UL>
<LI>Printer</LI>
Information Representation Method—HTML-I 52
Class X: Chapter 5
<UL TYPE=”circle”>
<LI>Inkjet Printer</LI>
<LI>Dot-matrix Printer</LI>
<LI>Laser Printer</LI>
</UL>
<LI>Monitor</LI>
<LI>Speaker</LI>
</UL>
</BODY>
</HTML>
36. What should be the output of the following HTML
code:
<HTML>
<HEAD> <TITLE>comment</TITLE> </
HEAD>
<BODY>
<!-- This is a Comment Tag -->
<!-- This is the source code for
definition tag -->
<DL>
<DT>Planet</DT>
<DD>Celestial body that revolves
around the star</DD>
<DT>Satellite</DT>
<DD>Celestial body that revolves
around the planet</DD>
<DT>Star</DT>
<DD>A celestial body that has its
own heat and light</DD>
</DL>
</BODY>
</HTML>
Ans. The output of the above mentioned code is shown in Figure 30:
Figure 30: Displaying the Output of the Given Code
37. Write an HTML code to view the following output:
Ans. The following code allows you to create the output as shown in
the question:
<HTML>
<HEAD>
<TITLE>The Earth</TITLE>
</HEAD>
<BODY BACKGROUND=”wallpaper.jpg”>
<H2> The Earth</H2>
<HR>
<H5>Earth is one of the nine planets of Solar
System...<BR><BR>
The Earth is the densest major body in the
solar system. </H5>
</BODY>
</HTML>
38. Write an HTML code to view the following line on a
Web page:
The < and > are used to create an HTML tag.
Ans. The following code allows you to display the given line:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
The &lt; and &gt; are used to create an HTML
tag.
</BODY>
</HTML>
39. Write an HTML code to write the following text on a
Web page:
H2O is the formula for water.
Ans. The following code allows you to display the text as given in the
question:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
H<SUB>2</SUB>O is the formula for water.
</BODY>
</HTML>
40. Write an HTML code to write the following text on a
Web page:
(x+y)2 is a mathematical formula.
Ans. The following code allows you to display the text as given in the
question:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
(x+y)<SUP>2</SUP> is a mathematical formula.
</BODY>
</HTML>
53 Foundation of Information Technology
Class X: Chapter 5
41. Write an HTML code to view the following text in a
Web page:
Following are the steps to save a file:
1. Press the CTRL+S keys.
2. Enter the name of the file in Save As dialog box.
3. Click the Save button.
Ans. The following code allows you to display the text as given in the
question:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
Following are the steps to save a file:
<OL TYPE=”a”>
<LI> Press the CTRL+S keys </LI>
<LI> Enter the name of the file in Save As dialog box </LI>
<LI> Click the Save button </LI>
</OL>
</BODY>
</HTML>
42. Write an HTML code to add a horizontal rule spread
on the 50% of the browser window.
Ans. The following code allows you to add a horizontal rule:
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<HR WIDTH=”50%”>
</BODY>
</HTML>
The output of the above mentioned code is shown in Figure 31:
Figure 31: Adding a Horizontal Rule
Unsolved Examination Questions
1. a. What is an attribute in HTML?
b. How would you preview changes made in an
HTML code without closing the HTML document
in the text editor?
c. Name two common graphic file formats that
most browsers recognize.
d. Which heading element gives the most
prominent heading?
e. Expand the following tags used in HTML:
<HR>
< SUB >
<UL>
< A >
f. Distinguish between container and empty tags.
g. Write code to insert an image “picture.gif ” on
a Web page and center align it in the browser’s
window.
h. Find error(s) in the following HTML code
segment. Rewrite the correct code and underline
the corrections made. (Outside Delhi 2007)
<UL STYLE : square >
<LI> Water Bottles
<LI> Lunch box
<LI> Handkerchief
</OL>
Ans.
a. An attribute provides additional information about the HTML
tag. For example, to specify a background color for a Web
page, you need to use the BACKGROUND attribute with the
<BODY> tag.
b. You can preview the changes by refreshing the HTML page.
c. .jpg and .gif are two common file formats that most browsers
recognize.
d. The heading level H1 gives the most prominent heading.
e.
<HR>: Horizontal Rule
< SUB >: Subscript
<UL>: Unordered List
< A >: Anchor
f. The difference between container and empty tags is:
Container tag: Refers to a tag that contains an opening as
well as a closing tag.
Empty tag: Refers to a tag that contains only an opening
tag.
g.
<HTML>
<HEAD>
<TITLE>IMAGE
</TITLE>
</HEAD>
<BODY>
<center><IMG SRC=”picture.gif”></IMG></
center>
</BODY>
</HTML>
h. The list tags are not closed properly. The closing tag of a list
should be </UL>.
2. Compare Home page and website. (Outside Delhi 2005)
Ans. A website is collection of Web pages; whereas, a home page is the
main page of a website.

3. How can one insert horizontal lines in a Web page?
Ans. One can insert horizontal lines in a Web page by using the <HR> tag.

4. How are comments inserted in an HTML code?
Explain with example.
Ans. Comments are written inside the opening and closing (<!-- and
-->) tags. Any content written as a comment is not displayed by
the Web browser.

5. Write the extension of an HTML code file.
Ans. The extension of an HTML code file is .html.

6. How would you display text in the Title bar of a
browser?
Ans. You can display text in the title bar of a browser by using the
<TITLE> tag.

7. How can the font size of a single line on a Web page
be changed? [Delhi 2005 (1 mark)]
Ans. The font size of a single line on a Web page can be changed by
using the <FONT> tag or using the Heading levels.

8. Distinguish between the <P> tag and the
<BR> tag with the help of an example.
Ans. The main difference between the <BR> and <P> tags is that the
<BR> tag is used to insert a line break on the Web page; whereas,
the <P> tag is used to mark a block of text as a paragraph or
separate your text into different paragraphs. The <P> tag not
only allows you to represent the text in the paragraph format but
also enables you to format the paragraph text.

9. Why do we insert comments in an HTML document
even though they are not displayed on a Web page?

Ans. Comments are meant for the developers and programmers to
understand code. They are not displayed in the Web browser.

10. What do you mean by the term ‘source code’ of the
current page viewed in a Web browser?
Ans. The source code is the HTML code of the current page viewed in
the Web browser.


No comments:

Post a Comment

MCQ Question Bank Microsoft PowerPoint