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

Answer 1) - There Are Three Basic Ways To Include Style Information in An HTML

The document discusses several ways to include style information in HTML documents: 1) Using an external style sheet linked or imported into the document. 2) Embedding style rules within the <HEAD> element of the document. 3) Providing inline styles directly on HTML elements using the STYLE attribute.

Uploaded by

Saurabh Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Answer 1) - There Are Three Basic Ways To Include Style Information in An HTML

The document discusses several ways to include style information in HTML documents: 1) Using an external style sheet linked or imported into the document. 2) Embedding style rules within the <HEAD> element of the document. 3) Providing inline styles directly on HTML elements using the STYLE attribute.

Uploaded by

Saurabh Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

Answer 1).

There are three basic ways to include style information in an HTML


document. The first is to use an outside style sheet, either by importing it or linking to it.
The second is to embed a document-wide style in the <HEAD> element of the
document. The third is to provide an inline style, right where the style needs to be
applied.

a). Linking to a Style Sheet :- An external style sheet is simply a plain text file
containing the style specifications for HTML tags or classes. The common extensions
indicating that it is a style sheet file is .css for CSS1 style sheets. By this method, we
can use one style sheet for multiple pages.

b). Embedding and Importing Style Sheets :- The second way to include an external
style sheet is to embed it. When you embed a style sheet, you write the style
rules directly within the HTML document. Document-wide style is a very easy way to
begin using style sheets. It involves the use of <STYLE> element found within the
<HEAD> element of an HTML document. Enclose the style rules within the <STYLE>
and </STYLE> tag pair and place these within the head section of the HTML
document.

c). Using Inline Styles :- Other than using style sheet for the whole document, it is
possible to add style information right down to single element. The simplest way to
add style information, but not necessarily the best, is to add style rules to particular
HTML element. This is how it works. Consider an example. Let’s say you want to set
one particular <H1> tag to render 48-point, green, Arial font. Then you need to apply
that style to <H1> elements or to a class of them (discussed later) by applying a
document-wide style. You can also apply the style to the tag in question, using the
STYLE attribute, which can be used within nearly any HTML element.

Answer 2). Different ways of viewing XML:


a). Viewing XML Using the XML Data Source Object :- Data Source objects are used for
what Microsoft calls Data Binding. Data binding is Microsoft’s way of bringing data
manipulation to the browser (client) and away from the server. Normally, if you want a
new view on the data, you resubmit a query to the server. The server performs the
necessary calculations and sends a new HTML page to the client. This doesn’t happen
with data binding. The server sends an HTML page together with the data to the client.
They are stored locally and can be manipulated locally without reconnecting to the
server.
To implement this data binding, you need to first include a data source object in
your page. After the insertion of the data source object, you need to define HTML
elements that are able to read data from the data source: they are called Data
consumers.

b). Using an HTML Table :-


We add the code
<TABLE BORDER ="2” CELLPADDING ="3” CELLSPACING ="2"
width="40%" DATASRC="#xmldso">
<THEAD>
<TH>Musician</TH>
<TH>Instrument</TH>
<TH>Number of recordings</TH>
</THEAD>
<TR>
<TD><SPAN DATAFLD = "name"></SPAN></TD>
<TD><SPAN DATAFLD = "instrument"></SPAN></TD>
<TD><SPAN DATAFLD = "NrOfRecordings"></SPAN></TD>
</TR>
</TABLE>

The output is

In the above example we learnt, about how to view the XML document in the
Browser.

c). Using Cascading Style sheets :-


Step 1: Create a style sheet named cd_catalog.css as below:
CATALOG
{
background-color: #ffffff;
width: 100%;
}
CD
{
display: block;
margin-bottom: 30pt;
margin-left: 0;
}
TITLE
{
color: #FF0000;
font-size: 20pt;
}
ARTIST
{
color: #0000FF;
font-size: 20pt;
}
COUNTRY,PRICE,YEAR,COMPANY
{
Display: block;
color: #000000;
margin-left: 20pt;
}
Step 2: We shall consider the catalog contains 3 cd titles and write the XML
document as follows:
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="cd_catalog.css"?>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tylor</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
</CD>
<CD>
<TITLE>Greatest Hits</TITLE>
<ARTIST>Dolly Parton</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>RCA</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1982</YEAR>
</CD>
</CATALOG>

The output:

Answer 3). Various file handling mechanism in PERL:


a). Opening a file: -
Before writing or reading from a file the file must be opened. To open a file,
Library function open is called whose syntax is as follows.
Open (filevariable, filename)
 The first parameter file variable represents the name that you want to use
in your Perl program to refer to the file. In other words it can be termed as
the file handle name that may be used in your program. Rules that apply
for naming the scalar variables apply for the file variable also except for
the absence of starting $ character. It is good idea to use all uppercase letters
for your file variable names. This makes it easier to distinguish file variable
names from the reserved words.
 Filename represents the location of the file in your machine. If file is inside the
current working directory, then filename is just the name of the file. On the
other hand if the file is located somewhere else, the filename consists of the full
path address to that file. Ex. open(FILE1, "file1");
There are 3 file access modes: read mode, write mode and append mode. In any of
the modes it is not possible to simultaneously read from and write into the same
file. By default open assumes the mode to be in read mode. To specify other
modes you must follow the following statements.
Read mode open (MYFILE,"file1");
Write mode open (OUTFILE, ">file1");
Append mode open (OUTFILE,">>file1");
Write mode will clear the contents of the file if any already present, and start
writing the contents. But in append mode the data to be written is appended to the end
of the existing contents. On successful operation open returns a nonzero value. On
error in opening a zero value is returned.

b). Reading from a file


Once a file is opened, you can read information from that file. To do so the
following syntax is followed.
$line =<MYFILE>; where MYFILE is the file variable name.

c). Writing to a file


To write to a file, file must be opened in write or append mode. Specifying the file
variable with the print function as shown below may do writing into a file that
you have opened.
open(OUTFILE, ">outfile");
print OUTFILE "Here is an output line.";

d). Closing a file


When you are finished reading from a file, you can tell the Perl interpreter that
you have completed by calling the close library function.. The syntax for the
function is as given below.
close(filevariable name).
One important point is that you need not call close when you have finished with a
file: Perl automatically closes the file when the program terminates or when you
open another file using a previously defined file variable. Consider the following
example.
open(MYFILE, ">file1");
print MYFILE "Here is a line of output";
open(MYFILE, ">file2");
print MYFILE " Here is another line of output";

e). Determining the status of a file( File test operators)


Many jobs involving the file operations open a file and test the successfulness of
the open operation. If open fails, it might be useful to find exactly why file could
not be opened. To do this, use one of the file-test operators. Syntax to use the file
test operator is as following.
-x expr. Here, x is an alphabetic character representing a file test operator
and expr is any expression. The value of expr is assumed to be a string that
contains the name of the file to be tested.
In the following example the file test operator -e for finding the existence of the
file is illustrated.
$var1 = "file1";
if(-e $var1){
print "The file1 exists";
}
if( -e $var1."a"){
print "The file1.a exists";
}

Answer 4).
<script type="text/javascript">
//Write a "Good morning" greeting if
//the time is less than 10

var d=new Date();


var time=d.getHours();

if (time<10)
{
document.write("<b>Good morning</b>");
}
</script>

Answer 5). VBSCRIPT DATA TYPES :


VBScript has only one data type called a variant. A variant is a special kind of
data type that can contain different kinds of information, depending on how it is
used. Since variant is the only data type in VBScript, it is also the data type
returned by all functions in VBScript.
At its simplest, a variant can contain either numeric or string information. A
variant behaves as a number when we use it in a numeric context and as a string
when we use it in a string context. If we are working with data that looks like
numbers, VBScript processes them as numbers . Similarly, if we are working
with data that can only be string data, VBScript treats it as string data. We can
make numbers behave as strings by enclosing them in quotation marks (" ").

 Variant Subtypes

In addition to the simple numeric or string classifications, a variant can make


further distinctions about the specific nature of numeric information. For example,
we can have numeric information that represents a date or time. When used with
other date or time data, the result is always expressed as a date or time. A
variant can also have a variety of numeric data ranging from Boolean values to
huge floating-point numbers. These different categories of information that can
be contained in a variant are called subtypes.
The following table shows the subtypes of data that a variant can contain.
Subtype Description
Empty Variant is not initialized. Value is 0 for numeric variables or
a zero-length string("") for string variables.
Null Variant intentionally contains no valid data.
Boolean Contains either True or False.
Byte Contains integer in the range 0 to 255.
Integer Contains integer in the range -32,768 to 32,767.
Currency -922,337,203,685,477.5808 to 922,337,203,685,477.5807.
Long Contains integer in the range -2,147,483,648 to 2,147,483,647.
Single Contains a single-precision, floating-point number in the range
-3.402823E38 to -1.401298E-45 for negative values;
1.401298E-45 to 3.402823E38 for positive values.
Double Contains a double-precision, floating-point number in the range
-1.79769313486232E308 to -4.94065645841247E-324 for
negative values;
4.94065645841247E-324 to 1.79769313486232E308 for positive
values.
Date (Time) Contains a number that represents a date between January 1,
100 to December 31, 9999.
String Contains a variable-length string that can be up to approximately
2 billion characters in length.
Object Contains an object.
Error Contains an error number.

Answer 6). ACTIVEX CONTROLS


ActiveX defines new specification for OLE controls, which allows them to be
much smaller and more efficient in the Internet environment. ActiveX provides a
means for interaction on the World Wide Web. Similar to OLE, ActiveX is also
based on COM. However, its services to the developer are quite different from
that of OLE. ActiveX allows the controls to be embedded in Web pages and also
allows them to be used interactively. ActiveX is designed for speed and size.
ActiveX focuses on integrating various objects written in a variety of programming
languages, such as C, C++, Java, and Visual Basic. ActiveX is currently
supported by the Windows operating system. There are more than one thousand
controls available for use on the Internet.
An ActiveX control can be embedded to an HTML document by using
<OBJECT> tag. The <OBJECT> tag has several attributes to describe the properties of
the object. Two most important attributes that are required when including the
ActiveX controls in Web page are CLASSID and ID. The CLASSID identifies the type of
control and code needed for its execution and ID attribute gives the name to the object
which is used to reference the control within the document. <OBJECT> tag
requires a corresponding </OBJECT>tag. The <OBJECT> tag has one or more
optional <PARAM> elements placed within the object definition to define and initialize
properties of the object.
Example
<OBJECT ID = "IeLabel1" WIDTH = 100 HEIGHT= 200 CLASSID = "CLSID:
99B42120- 6EC7-11CF-A6C7-00AA00A47DD2">
</OBJECT>

Answer 7). Dynamic Host Configuration Protocol (DHCP) provides a framework for
passing configuration information to hosts on a TCP/IP network. DHCP is based on
the BOOTP protocol, adding the capability of automatic allocation of reusable
network addresses and additional configuration options. DHCP messages use
UDP port 67, the BOOTP server's well-known port and UDP port 68, the BOOTP
client's well-known port. DHCP participants can interoperate with BOOTP
participants.
DHCP consists of two components:
1. A protocol that delivers host-specific configuration parameters from a DHCP
server to a host.
2. A mechanism for the allocation of temporary or permanent network
addresses to hosts. IP requires the setting of many parameters within the protocol
implementation software. Because IP can be used on many dissimilar kinds of network
hardware, values for those parameters cannot be guessed at or assumed to have
correct defaults. The use of a distributed address allocation scheme based on a
polling/defense mechanism, for discovery of network addresses already in use,
cannot guarantee unique network addresses because hosts may not always be
able to defend their network addresses.
DHCP supports three mechanisms for IP address allocation:
1. Automatic allocation: DHCP assigns a permanent IP address to the host.
2. Dynamic allocation: DHCP assigns an IP address for a limited period of
time. Such a network address is called a lease. This is the only mechanism
that allows automatic reuse of addresses that are no longer needed by the
host to which it was assigned.
3. Manual allocation: The host’s address is assigned by a network administrator

Answer 8). Open Shortest Path First (OSPF)

The Open Shortest Path First (OSPF) protocol is another example of an interior
gateway protocol. It was developed as a non-proprietary routing alternative to
address the limitations of RIP. OSPF provides a number of features not found in
distance vector protocols. Support for these features has made OSPF a widely-
deployed routing protocol in large networking environments. In fact, RFC 1812 –
Requirements for IPv4 Routers, lists OSPF as the only required dynamic routing
protocol. The following features contribute to the continued acceptance of the
OSPF standard:
 Equal cost load balancing: The simultaneous use of multiple paths may
provide more efficient utilization of network resources.
 Logical partitioning of the network: This reduces the propagation of
outage information during adverse conditions. It also provides the ability to
aggregate routing announcements that limit the advertisement of
unnecessary subnet information.
 Support for authentication: OSPF supports the authentication of any node
transmitting route advertisements. This prevents fraudulent sources from
corrupting the routing tables.
 Faster convergence time: OSPF provides instantaneous propagation of
routing changes. This expedites the convergence time required to update
network topologies.
 Support for CIDR and VLSM: This allows the network administrator to
efficiently allocate IP address resources.
OSPF is a link state protocol. As with other link state protocols, each OSPF
router executes the SPF algorithm to process the information stored in the link
state database. The algorithm produces a shortest-path tree detailing the
preferred routes to each destination network.

You might also like