0% found this document useful (0 votes)
49 views37 pages

Two Mark Questions

The document contains a compilation of two-mark questions and answers related to Web Essentials for B.Tech IT students at Anna University. It covers various topics including networking concepts, protocols, HTTP, CGI, and server functionalities. Each question is succinctly answered, providing essential definitions and explanations relevant to the subject matter.

Uploaded by

anitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views37 pages

Two Mark Questions

The document contains a compilation of two-mark questions and answers related to Web Essentials for B.Tech IT students at Anna University. It covers various topics including networking concepts, protocols, HTTP, CGI, and server functionalities. Each question is succinctly answered, providing essential definitions and explanations relevant to the subject matter.

Uploaded by

anitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

lOMoARcPSD|50370378

two mark questions

Web essentials (Anna University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Anitha A ([email protected])
lOMoARcPSD|50370378

B.Tech IT – IV SEM
TWO MARKS QUESTIONS AND ANSWERS
CODE / SUBJECT : IT3401/WEB ESSENTIALS

Unit -1
1. What is the difference between node and host?
A node is any addressable device connected to a network whereas the host is a more
specific descriptor that refers to a networked general-purpose computer rather than a single
purpose device (such as a printer).

2. What is the purpose of routers?


Router operates like electronic postal workers that evaluate and forward packets between
networks.

3. Define protocol.
A protocol is a formal set of rules that must be followed in order to communicate.

4. Why are the protocols layered?


Layering protocols simplifies the task of communicating over the network and it allows
for reuse of layers that are not specific to a particular application.

5. Define encapsulation.
Placing the data inside a package of headers is known as encapsulation.

6. Define port.
A port is a logical channel to an application running on a host. ie., The applications
running on the host machines are uniquely identified by port numbers.

7. What do you mean by well-known ports?


Port numbers can range from 1 to 65535, however ports 1 to 1023 are reserved. These
reserved ports are referred to as we1l-known ports because the Internet Assigned Numbers
Authority publicly documents the applications that use them.

8. What is meant by Name Resolution?


Name Resolution is the process of mapping a hostname to its corresponding IP Address.
One way to translate a hostname to an IP address is to look it up in a simple text file. The second
way is the domain name service, which is a distributed database containing all registered
hostnames on the Internet and their IP addresses.

9. Define protocol tunneling.


Protocol tunneling is the process of encapsulating one protocol within another protocol
that operates on the same layer.

10. Define URI, URL, URN.


 URI (Uniform Resource Identifier): It identifies an object on the Internet.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

 URL (Uniform Resource Locator): It is a specification for identifying an object such as a


file, newsgroup, CGI program or e-mail address by indicating the exact location on the
internet.
 URN (Uniform Resource Name): It is a method for referencing an object without
declaring the full path to the object.

11. What are the components of HTTP URL?
(or)
Explain the general form of URL(May/June 2009)

http://faculty.uscupstate.edu/atzacheva/lect
The
documen Host Path to File Denotes
t can be Name - the Web Name that the File
obtained The Page is Written in
using the Name HTML
1 of 2Web 3 HyperText
Hypertext
Protoco Server
Host Name File Name
Markup
Transfer
l
Protocol Language
(HTTP)

The components are host, an optional port, path, filename, and section and query string.

12. Define URL encoding.


URL encoding involves replacing all unsafe and nonprintable characters with a percent
sign (%) followed by two hexadecimal digits corresponding to the character's ASCII value.

13. What are the issues of next generation IP?


The issues to be considered in IP next generation are
 Addresses Space Growth
 Support large Global networks
 A clear way of transition from the existing IP to new IP next generation

14. What is the difference between TCP and UDP?
TCP:
 Connection oriented transport protocol
 Sends data as a stream of bytes
 Guarantee of delivery
UDP:
 Connection less protocol
 Datagram service
 No guarantee of delivery.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

15. What does ICMP provide?


ICMP provides
 Error messaging
 Demand reply functions

16. Define IGMP.


It is Internet Group Management protocol. It provides
 Broadcasting
 Multicasting

17. List the goals of SGML.


 To manage the flow of millions of pages.
 For structuring information exchange
 For modeling inter-document linkages
 For managing information flows between departments and weapons systems

18. What is the role of server?


The server
 Manages application tasks
 Handles storage
 Handles security
 Provides scalability
 Handles accounting and distribution

19. What are the necessities of using HTML forms?


 Gathering user information
 Conducting Surveys
 Interactive services

20. What are the sequences of steps for each HTTP request from a client to the server?
 Making the connection
 Making a request
 The response
 Closing the connection

21. Define MIME.


MIME (Multipurpose Internet Mail Extensions) is an open standard for sending
multipart, multimedia data through Internet email. It is a internet standard, which allows the
transfer of binary files. It uses media types to describe content

22. List the predefined MIME content types.


 Text
 Multipart
 Message
 Image

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

 Audio
 Video
 Model
 Application

23. Define HTML.


It is a simple page description language, which enables document creation for the web.

24. What is meant by loop back address?


A zone that enables the server to direct traffic to itself. The host number is almost always
127.0.0.1.

25. Define CGI -Common Gateway Interface.


 A specification for transferring information between a World Wide Web server and a CGI
program. ACGI program is any program designed to accept and return data that conforms to
the CGI specification. The program could be written in. any programming language,
including C, Perl, Java, or Visual Basic.
 CGI programs are the most common way for Web servers to interact dynamically with users.
Many HTML pages that contain forms, for example, use a CGI program to process the form's
data once it's submitted. Another increasingly common way to provide dynamic feedback for
Web users is to include scripts or programs that run on the user's machine rather than the
Web server. These programs can be Java applets, Java scripts, or ActiveX controls.
 These technologies are known collectively as client-side solutions, while the use of CGI is a
server-side solution because the processing occurs on the Web server. One problem with CGI
is that each time a CGI script is executed, a new process is started. For busy Web sites, this
can slow down the server noticeably. A more efficient solution, but one that it is also more
difficult to implement, is to use the server's API, such as ISAPI or
 NSAPI. Another increasingly popular solution is to use Java servlets.

26. Write a note on Internet Information Server (IIS).


Microsoft's Web server that runs on Windows NT platforms, In fact, IIS comes bundled
with Windows NT 4.0. Because IIS is tightly integrated with the operating system, it is relatively
easy to administer. However, currently IIS is available only for the Windows NT platform,
whereas Netscape' s Web servers run on all major platforms, including Windows NT platform,
OS/2 and UNIX.

27. What are ISAPI (Internet Server API) and NSAPI (Netscape Server API)
ISAPI (Internet Server API): An API for Microsoft's IIS (Internet Information Server)
Web server. ISAPI enables programmers to develop Web-based applications that run much faster
than conventional CGI programs because they're more tightly integrated with the Web server. In
addition to IIS, several Web servers from companies other than Microsoft support ISAPI.
NSAPI -Netscape Server API: An API for Netscape's Web servers. NSAPI enables
programmers to create Web-based applications that are more sophisticated and run much faster
than applications based on CGI scripts.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

28. What is API -Application Program Interface?


 A set of routines, protocols, and tools for building software applications. A good API
makes it easier to develop a program by providing all the building blocks. A programmer
puts the blocks together.
 Most operating environments, such as MS- Windows, provide an API so that
programmers can write applications consistent with the operating environment. Although
APIs are designed for programmers, they are ultimately good for users because they
guarantee that all programs using a common API will have similar interfaces. This makes
it easier for users to learn new programs.

35.Explain about HTTP Connection.


It is a communication channel between web browser and web server. It begins on the
client side with the browser sending a request to the web server for a document.
Request Header Fields are
1. From
2. Reference
3. If_modified_since
4. Pragma
5. User Agent
36. What is meant by Stateless Connection?
When a web server receives a HTTP request from a web browser it evaluates the request
and returns the requested document, if it exists, and then breaks the HTTP connection. This
document is preceded by the response header, which has details about how to display the
document that will be sent by the server. Each time a request is made to the server, it is as if
there was no prior connection and each request can yield only a single document. This is known
as Stateless Connection.

37. Write a note on Environment variables.


In CGI, the server prepares the environment variables before it launches the CGI script.
These represent the current state of the server that is asking for the information. The environment
variables are not set from the command line but are created on the fly, and lasts only until that
particular script is finished. Each script gets its own unique set of variables and multiple scripts
can be executed at once, each in its own environment.

39. What are the two commonly used Request methods?


(or)
What is the primary function of an HTTP server

The request methods tell the script how it was invoked. Based on this information, the
script decides how to act. The request method is passed to the script using environment variable
called REQUEST- METHOD. The two most common request methods used are GET and POST.
GET

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

GET is a request for data, the same method used for obtaining static documents. The
GET method sends request information as parameter tacked onto the end of the URL. These
parameters are passed to the CGI program in the environment variable QUERY-STRING.

E.g.: If the script is called myprog.exe and is invoked from a link with the form

<A HREF="cgi-bin/myprog.exe? lname=blow&fname=joe"> The REQUEST_METHOD


will be the string GET, and the QUERY_STRING will contain lname=blow & fname=joe.
A mandatory question mark separates the name of the script from the beginning of the
QUERY_STRING. If a slash is used instead of the question mark; the server passes the
information to script using the PATH_INFO variable instead of the QUERY_STRING variable.

POST
POST operation occurs when the browser sends data from a fill-in form to the server.
With POST, the QUERY_STRING mayor may not be blank, depending on the server. The data
from a POSTed query gets passed from the server to the script using STDIN. Because STDIN is
a stream and the script needs to know how much valid data is waiting, the server also supplies
another variable, CONTENT_LENGTH, to indicate the size in bytes of the incoming "data. The
format for POSTed data is

Variable1=value1 & variable2=value2 &etc.

After the required data is available, the script executes and writes its output to the
STDOUT. The MIME code that the server sends to the browser indicates the type of the file that
is being sent. This information that precedes the file is usually called the header. Since the script
generates the output on the fly the server will not be able to create a header for that information.
Hence this information has to be supplied by the script itself. Failure will result in the browser
receiving information that it does not know how to display.

40. Explain about URL Encoding.


HTTP specification requires that the URL data should be encoded in such a way that it
can be used on almost any hardware and software platforms. Information specified in this way is
called URL encoded. If parameters are passed as a part of query string or path information, they
will take the form of ‘Name-Value’ pairs.

variablel=valuel&variable2=value2& so on for each variable defined in the form.

The variables or name value pairs are separated by '&'. Real ampersand is escaped –that
is, encoded as a two-digit hexadecimal value representing the character. Escaped characters are
indicated in URL-encoded string by the percent (%) sign. Blank spaces are replaced by '+' sign.
Before the script can deal with the data it has to parse and decode it. The script scans
through the string looking for an ampersand. When it is found the string is broken from that
point. The variable's name is everything up to the equal sign in the string and the value is
everything after the equal sign. The script continues to parse the original string for the next
ampersand, and so on until the original string is exhausted. After the variables are separated, they
are decoded as follows.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

1. Replace all plus signs with blank spaces.


2. Replace all %## (Percent sign followed by two hexadecimal digits) with the corresponding
ASCII character. Separate the name-value pairs from the URL and store the values separately.

41. List the advantages of CGI scripting?


 CGI programs are relatively safe to run.
 A CGI program can crash without damaging the server, since it only has limited access to
the server.
 Reduces the burden of server
 Sends prepared messages / mails e customer reply
 Capability to process forms and prepares output based on form input.
 Hit counts / Page counters.

42. Explain about Session tracking.


A session is basically a conversation between a browser and a server. All the above
technologies can save information for the current session for a particular user visiting a site.
The session is important, as H1TP is a stateless protocol. This means that the connection
between web server and a web browser is not automatically maintained, and that the state of a
web session is not saved.
State is a general term that includes "everything about your situation" and the specifics
vary based on the application. In a word processor, the state of the application would include
which windows are open, where they are on the screen, and what files you most recently used.
In a web application, the state would include any data that you had entered, the results of
any queries that you had had run, and your security access information (e.g. whether you have
logged in to the site).

43. Define packet switched networks.


Packet switched network means that data traveling on the network is broken into chunks
called packets and each packet is handled separately.

44. Distinguish between online services and ISP (Nov/Dec 2008)


An organization that provides an information service over the Internet is called online
services. Example is search engines, online backup services and application service providers.
An organization that provides access to the internet as well as proprietary content. Before
the internet became widely used by general public, all online services were self-contained
organizations known for their unique mix of databases and resources. If email was provided, it
was only within the same service
After the internet became popular, all the services either provided web access to their
specialized databases or added general purpose internet access such as AOL and CompuServe.
Internet Service Providers
An ISP is a company that supplies Internet connectivity to home and business customer.
ISP’s support one or more forms of internet access, ranging from traditional modern dial-up to
DSL and cable modem broadband service to dedicated T1/T3 lines
More recently, wireless internet service providers or WSIP’s have emerged that offer
internet access through wireless LAN or wireless broadband networks

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

In addition to basic connectivity, many ISP’s also offer related Internet services like
email, web hosting and access to software tools

45. Define client and server system. Write any two examples for a client server

Web server
Web client 2

Web client 3

The server waits for a client to connect and then it provides a service. Webserver sends the
browser the files it requests.

Building Entities of Client – Server Model:

Application Server:

This server acts an independent or an interface unit along with database server
application servers holds all the business logic within it.

Database Server:

The server is the key server for all business services. The organization day-to-day
Transactions are stored here.

The success of any online business is the communication link between consumer,
producer, management and employers which are mainly supported by the server.

46. Justify the need of client side scripting with an example

Client-side scripts are often embedded within an HTML document (hence known as an
"embedded script"), but they may also be contained in a separate file, which is referenced by the
document (or documents) that use it (hence known as an "external script"). Upon request, the
necessary files are sent to the user's computer by the web server (or servers) on which they
reside. The user's web browser executes the script, then displays the document, including any
visible output from the script. Client-side scripts may also contain instructions for the browser to
follow if the user interacts with the document in a certain way, e.g., clicks a certain button. These
instructions can be followed without further communication with the server, though they may
require such communication.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

47. Name the four services offered by internet and specify their default port number
 It is a Network:
 It is a loose organization:
 It’s a relaxing place
 It is a Business tool:
 It is a Mail box:
 It is an information pool:
 Default port number is 80

48. What is a proxy server

In computer networks, a proxy server is a server (a computer system or an application


program) that acts as a go-between for requests from clients seeking resources from other
servers. A client connects to the proxy server, requesting some service, such as a file, connection,
web page, or other resource, available from a different server. The proxy server evaluates the
request according to its filtering rules. For example, it may filter traffic by IP address or protocol.
If the request is validated by the filter, the proxy provides the resource by connecting to the
relevant server and requesting the service on behalf of the client. A proxy server may optionally
alter the client's request or the server's response, and sometimes it may serve the request without
contacting the specified server. In this case, it 'caches' responses from the remote server, and
returns subsequent requests for the same content directly.
A proxy server has two purposes:
 To keep machines behind it anonymous
 To speed up access to a resource (via caching). It is commonly used to cache web pages from
a web server.
A proxy server that passes requests and replies unmodified is usually called a gateway or
sometimes tunneling proxy.
A proxy server can be placed in the user's local computer or at various points between the
user and the destination servers or the Internet. A reverse proxy is a proxy used as a front-end to
accelerate and cache in-demand resources (such as a web page).

49. Mention any two types of special addresses in Internet addressing


 Loop back address 127.0.0.1
 Special Network ID and Host ID Address Patterns
Special IP addresses are constructed by replacing the normal network ID or host ID (or both)
in an IP address with one of two special patterns. The two patterns are:
o All Zeroes: When the network ID or host ID bits are replaced by a set of all zeroes, the
special meaning is the equivalent of the pronoun “this”, referring to whatever was
replaced. It can also be interpreted as “the default” or “the current”. So for example, if we

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

replace the network ID with all zeroes but leave the host ID alone, the resulting address
means “the device with the host ID given, on this network”. Or alternatively, “the device
with the host ID specified, on the default network or the current network”.
o All Ones: When the network ID or host ID bits are replaced by a set of all ones, this has
the special meaning of “all”. So replacing the host ID with all ones means the IP address
refers to all hosts on the network. This is generally used as a broadcast address for
sending a message to “everyone”.
50. What are the components of web? What is the communication protocol between them?

1. Client and Server:

A web server us a computer that is connected to the Internet that has software capable of storing,
retrieving and distributing some of the web application files.

A web client (web browser) is a computer that requests file, from the web. When a client is
requesting for a file is the web the network directs the request to the web server where the file
has been available Web server by accepting requests sends the file to the client.
Web Client / web Web Server
Browser Internet

2. Web Languages and Protocols:

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

The web server and client may be running different Operating System, software and
hardware so that a well defined set of languages and protocols are required that are independent
of the hardware or operating system on which they run.

Web Languages: HTML, DHTML, XML, CSS, ASP, etc.


Web Protocols: HTTP, FTP, TCP, UDP, IP, ARP, RARP, etc.

3. Web Pages:

A Webpage is a HTML document that is stored in a web server and that has an URL so
that it can be accessed via the web.

Website: www.annauniv.org
Webpage: www.annauniv.org/index.html

4. Home Page:

A Home page is the front door of the web site. Sometimes homepage may not be visible
to the user. It can be configured in the web browser.

5. Web Browser:

A web browser is a software tool that computers use to communicate with web servers on
the Internet.
 It enables to download and display the web pages that user requests.
 A web browser should be capable of understanding HTML and display text.
 It supports pictures, video, sound and even 3d images.
 In the address bar of the browser, type of URL and it will display the web pages.

Browsers: IE – Outlook Express


Netscape Navigator – display java Applets
Opera, Konqueror and Mosaic - others

6. Offline Browser:

It is a pull product that enables the users to retrieve web pages automatically from their
websites during the prescribed time.

Eg: useful for retrieving newspapers from new agencies.

7. Web Sites:

A web site is a collection of WebPages belonging to particular person or organization


51. What is the difference between an absolute pathname and a relative path name
(Nov/Dec 2007)
Absolute Path URLs

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

Absolute paths are called that because they refer to the very specific location, including
the domain name. The absolute path to a Web element is also often referred to as the URL. For
example, the absolute path to this Web page is:
http://webdesign.about.com/library/weekly/aa040502a.htm
Relative Path URLs
Relative paths change depending upon what page the links are located on. There are several rules
to creating a link using the relative path:
 links in the same directory as the page have no path information listed
filename
 sub-directories are listed without any preceding slashes
weekly/filename
 links up one directory are listed as
../filename

52. List out the devices used to form Internet work and specify each one of its purpose
(Apr/May 2008)
IP ADDRESSES DOMAIN NAMES
Every device
Human
connected has a DNS
Readable
unique 32-bit
cnn.com
address
Translation Every device
Machine connected
Between domain
Readable has an
e.g. Names and IP
Addresses alphanumeric
151.196.19.22 address

 IP address and domain name allocation requires central administration to avoid


duplication
 Previously administered by U.S. government contract (NSI)
 In 1998, technical coordination assigned to ICANN (Internet Corporation for Assigned
Names and Numbers).

 How DNS works


 When you type a URL into the address portion of your browser, the browsers’ first task is
to convert the domain name into an IP address so that it can send a request to the appropriate
web server at that IP address for the web page that you are requesting
 To accomplish this task, the browser interacts with a name server, a machine that
maintains lists to translate the domain names into IP addresses
 Once the browser receives the IP address from the name server, it sends a request for the
web page that you are requesting
 Let us retrieve the IP address of the name server that we are using…

53. What is an IP address? How it is relevant in internet(May/June 2009)

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

Each host computer on the has a unique number and it is called as Internet Protocol Address (IP
Address)

Format: A.B.C.D

Where A, B, C, D = values range of 0 to 255 and each one is called as an octet.

The IP addresses identifies a particular computer in the Internet when a system is


connected in the Internet, an IP Address is allocated dynamically by the ISP and this help the
host to communicate with each other system available in any part of the world.
Unit -II

1. List out the Document structure tags.


<HTML>, <HEAD>, <BASE>, <ISINDEX>, <META>, <LINK>, <SCRIPT>,
<STYLE>, <TITLE>, <BDO>, and <BODY>.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

2. List out the formatting tags.


<B>, <BASEFONT>, <BIG>, <FONT>, <I>, <S>, <STRIKE>, <SMALL>, <SUB>,
<SUP>, <TT>, <U>, <ABBR>, <ACRONYM>, <ADDRESS>, <CITE>, <CODE>, <DEL>,
<DFN>, <EM>, <INS>, <KBD>, <Q>, <SAMP>, <STRONG>, <VAR>,
<BLOCKQUOTE>, <BR>, <CENTER>, <DIV>, <HR>, <H1>-<H6>, <P>, <PRE>, and
<SPAN>.

3. List out the list tags.


<LI>, <DIR>, <DL>, <DT>, <DD>, <MENU>, <OL>, and </UL>.

4. List out the image tags.


<IMG>, <MAP>, and <AREA>.

5. List out the frame tags.


<FRAMESET>, <FRAME>, <NOFRAMES>, and <IFRAME>.

6. List out the form tags.


<FORM>, <INPUT>, <SELECT>, <OPTION>, <OPTGROUP>, <TEXTAREA>,
<BUTTON>, <LABEL>, <FIELDSET>, and <LEGEND>.

7. List out the table tags.


<TABLE>, <CAPTION>, <THEAD>, <TFOOT>, <TBODY>, <COLGROUP>,
<COL>, <TR>, <TD>, and <TH>.

8. List out the executable content tags.


<APPLET>, <PARAM>, and <OBJECT>.

9. How we can classify the tags. List them


Every HTML tag is either a container tag or a standalone tag.

A container tag is one that activates an effect and that has a companion tag that
discontinues the effect. For example, <I> is a container tag that, together with its
companion closing tag </I>, causes all text found between them to be rendered in italic.
The <I> tag turns on the italic effect and the </I> tag turns it off.
A standalone tag or empty tags is one that does not have a companion tag. For
example, the <IMG> tag simply places an image on a page. <IMG> has no effect that
was turned on and needs to be turned off, so no closing tag is needed.

10. What is meant by attribute? List out the some of the Global HTML attributes.
Although most tag attributes tend to be unique to the tag, some are almost universal and
usable with any tag. Table 3.1 summarizes these attributes, showing which tags do take
the attributes and how each attribute is used.
TABLE 3.1 Global HTML Attributes
Attribute Purpose Used With

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

CLASS Space-separated list


of All tags but <BASE>,
classes of the tag <BASEFONT>, <HEAD>,
<HTML>, <META>,
<PARAM>, <SCRIPT>,
<STYLE>, and <TITLE>.
DIR Direction for weak or All tags but <APPLET>,
neutral text <BASE>, <BASEFONT>,
<BDO>, <BR>,
<FRAME>,
<FRAMESET>, <HR>,
<IFRAME>, <PARAM>,
and <SCRIPT>.
ID Unique, document-wide All tags but <BASE>,
identifier <HEAD>, <HTML>,
<META>, <SCRIPT>,
<STYLE>, and <TITLE>.
LANG Specifies document All tags but <APPLET>,
language context <BASE>, <BASEFONT>,
<BR>, <FRAME>,
<FRAMESET>, <HR>,
<IFRAME>, <PARAM>,
and <SCRIPT>.
STYLE Binds style information to All tags but <BASE>,
the tag <BASEFONT>, <HEAD>,
<HTML>, <META>,
<PARAM>, <SCRIPT>,
<STYLE>, and <TITLE>.
TITLE Advisory title All tags but <BASE>,
<BASEFONT>, <HEAD>,
<HTML>, <META>,
<PARAM>, <SCRIPT>,
<STYLE>, and <TITLE>.

11. What is meant by event handlers? List out some of them


The HTML 4.0 recommendation also allows for several event handlers that can be used
to trigger the execution of script code embedded in an HTML document.
Each event handler is tied to a specific event that can occur during a person's use of a
browser.
When a user submits a form, for example, you can capture that event and launch a field
validation script using the onsubmit event handler:

<FORM ACTION="register.cgi" METHOD="POST" onsubmit="validate();">

Thus, when a user clicks the Submit button, the scripted function named "validate" fires
and checks the data the user is submitting for appropriate formatting, content, or other
validation checks.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

12. How we can classify the text level formatting tags?(refer table)
13. List out the tags used for font formatting. (refer table)
14. List out the tags used for phrase formatting. (refer table)
15. List out the tags used for block level formatting. (refer table)

16. Enumerate the different types of List created by the list tag.

 Definition lists
 Directory lists (deprecated)
 Menu lists (deprecated)
 Ordered (numbered) lists
 Unordered (bulleted) lists

17. Explain the use of Hyperlink tag with an example.


The capability of linking Web resources is what makes the Web so fascinating.

1. <A>
Type: Container
Function: This helps make navigating a large document easier because we can set up anchors
at the start of major sections and then place a set of links at the top of the document that
points to the anchors at the beginning of each section.

Syntax:

<!-- Setting up a hyperlink -->


<A HREF="URL_of_linked_document" TARGET="frame_name"
REL="forward_link_type" REV="reverse_link_type"
ACCESSKEY="key_letter" TABINDEX="tab_order_position">
... hyperlinked element goes here ...
</A>

18. Explain the attributes used with image and imagemap tags.
<IMG SRC="URL_of_image_file"
WIDTH="width_in_pixels" HEIGHT="height_in_pixels"
ALT="text_description" BORDER="thickness_in_pixels"
ALIGN="TOP|MIDDLE|BOTTOM|LEFT|RIGHT"
HSPACE="horizontal_spacing_in_pixels"
VSAPCE="vertical_spacing_in_pixels"
LONGDESC="URL_of_long_description"
ISMAP USEMAP="map_name">

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

19. State about the different usage of HTML frames. (APR/MAY 2008)
Framed layouts are ones in which the browser window is broken into multiple regions called
frames. Each frame can contain a distinct HTML document, enabling you to display several
documents at once, rather than just one screen all the time, while other parts of the page
change.

20. Write the HTML code for creating multi – line text box with necessary
parameters(May/June 2009)
<TEXTAREA NAME="field_name" ROWS="number_of_rows"
COLS="number_of_columns"
DISABLED READONLY
ACCESSKEY="shortcut_key_letter" TABINDEX="tab_position">
... default text to appear in window ...

</TEXTAREA>
21. What is meant by CSS? (Nov/Dec 2008)
 CSS stands for Cascading Style Sheets
 Styles define how to display HTML elements
 Styles are normally stored in Style Sheets
 Styles were added to HTML 4.0 to solve a problem
 External Style Sheets can save you a lot of work
 External Style Sheets are stored in CSS files
 Multiple style definitions will cascade into one

22. What are the types of CSS available?


VERSION OVERVIEW OF FEATURES
CSS1 Text handling, including fonts, sizing,
styles, and spacing. Background and
colors, margins, borders and padding
control of objects, list styles
CSS2 Printing specific features, aural render
up, downloadable fonts, positioned
elements, table support, support for CSS
with XML, some interface control such
as cursor display, limited behavior such
as hover effects on links
CSS3 Support for vertical running text,
multicolumn layout facilities. Increased
support for associating behaviors and
styles, integration with graphics, color
and font technologies

23. What is meant by inline CSS?


 An inline style loses many of the advantages of style sheets by mixing content with
presentation. Such as when a style is to be applied to a single occurrence of an
element.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

 To use inline styles we use the style attribute in the relevant tag.
 The style attribute can contain any CSS property. The example shows how to change
the color and the left margin of a paragraph:
<p style="color: sienna; margin-left: 20px">
This is a paragraph
</p>

24. What is meant by DHTML?


"Dynamic HTML is a term used by some vendors to describe the combination of
HTML, style sheets and scripts that allows documents to be animated."

25. What is the different event handlers found in DHTML?


Event Occurs when...
onabort a user aborts page loading
onblur a user leaves an object
onchange a user changes the value of an object
onclick a user clicks on an object
ondblclick a user double-clicks on an object
onfocus a user makes an object active
onkeydown a keyboard key is on its way down
onkeypress a keyboard key is pressed
Onkeyup
a keyboard key is released
a page is finished loading. Note: In Netscape this event occurs
onload
during the loading of a page!
onmousedown a user presses a mouse-button
onmousemove a cursor moves on an object
onmouseover a cursor moves over an object
onmouseout a cursor moves off an object
onmouseup a user releases a mouse-button
onreset a user resets a form
onselect a user selects content on a page
onsubmit a user submits a form
onunload a user closes a page

26. What are the keyboards events can be designed on a page using DHTML?
Keyboard events
onhelp Fires when the user initiates help (i.e., by pressing the F1 key).
onkeydown Fires when the user pushes down a key.
onkeypress Fires when the user presses a key.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

onkeyup Fires when the user ends a key press.

27. What are the mouse events can be designed on a page using DHTML?
Mouse events
oncontextmenu Fires when the context menu is shown (right-click).
ondblclick Fires when the mouse is double clicked.
ondrag Fires during a mouse drag.
ondragend Fires when a mouse drag ends.
ondragenter Fires when something is dragged onto an area.
ondragleave Fires when something is dragged out of an area.
ondragover Fires when a drag is held over an area.
ondragstart Fires when a mouse drag begins.
ondrop Fires when a mouse button is released over a valid target
during a drag.
onmousedown Fires when a mouse button is pressed down.
onmouseup Fires when a mouse button is released.

28. How to create a tooltip using DHTML code?


<html>
<head>
<script type="text/javascript">
function gettip(txt)
{
document.getElementById('tip').innerHTML=txt
}
function reset()
{
document.getElementById('tip').innerHTML=""
}
</script>
</head>
<body>
<p>Mouse over these drinks:</p>
<span onmouseover="gettip('Hot black drink')"
onmouseout="reset()">Coffee</span>
<br /><br />
<span onmouseover="gettip('Cold white drink')"
onmouseout="reset()">Milk</span>
<p id="tip"></p>
</body>
</html>

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

29. Which function can be used to create an Alert popup dialog box? Write an example
to create an Alert popup box. (NOV/DEC 2007)
<HTML>
<HEAD>
<TITLE>Object Model</TITLE>

<SCRIPT LANGUAGE = "JavaScript">


function start()
{
alert( pText.innerText );
pText.innerText = "Thanks for coming.";
}
</SCRIPT>

</HEAD>

<BODY ONLOAD = "start()">

<P ID = "pText">Welcome to our Web page!</P>

</BODY>
</HTML>

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

30. State the commands in cascading style sheet used for grouping of elements.
(NOV/DEC 2007)
We can group selectors. Separate each selector with a comma. In the example below we
have grouped all the header elements. Each header element will be green:
h1,h2,h3,h4,h5,h6
{
color: green
}

31. Define DHTML Event bubbling. (APR/MAY 2008)


Event bubbling is the process whereby events fired in child elements bubble up to their
parent elements. When a child event is fired , the event is first delivered to the child’s
event handler and then to the parent’s event handler. This might result in event handling
that was not intended
8. Write down the DHTML syntax for bind an image to the data and sort the data
on the data source. (APR/MAY 2008)

<img datasrc = "#Images" datafld = "image" alt = "Image"


style = "position: relative; left: 45px" /><br />

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

32. Define DOM (May/June 2009)


The Document Object Model gives us access to every element in a document.

Object Description
Window The window object is the top level object in the DHTML DOM. It
contains information about the window and the frames
Document The document object represents the HTML document, and is used
to access the HTML elements inside the document
Navigator The navigator object contains information about the user's browser
Event The event object contains information about events that occurs

33. What is meant by data bound control? Give example(May/June 2009)


 Dynamic HTML helps web application developers to produce more responsive data –
intensive applications
 With data binding, data need no longer reside exclusively on server. Data can be
maintained on the client
 To bind external data to HTML elements, Internet Explorer employs software capable o
connecting the browser to live data sources. These are known as data source
objects(DSOs)-Tabular Data Control(TDC)
 The TDC is an ActiveX control that is added to a page with the object element
 Data is stored on a separate file and not embedded in the HTML document
 The data file begins with an header row
 This row specifies the names of the columns
 Data in each field is enclosed with text qualifiers (@) and each field is separated with a
field delimiter (|)
 The object element inserts the TDC-one of the Microsoft ActiveX controls built in to IE6.
 Attribute classid specifies the ActiveX control to add to the web page. The classid if the
TDC has a fixed value
 The param tag specifies parameters for the object in the object element
 The parameter DataURL is the data source

UNIT-III
1. What is the difference between Vbscript and Java script?

JavaScript is case sensitive and also it is used on client side mainly for checking form
validations.. vbscript is mainly used on the server side.. i.e. for server side validations.. along
with asp code.. also vbscript is the default language for asp.. most of the tasks which are
complicated or based on some logic are very easy in vbscript like .. to check the blank field
validation we just need to use trim function and pass the value as parameter in vbscript which is
not possible in JavaScript
JavaScript
==============
Javascript case sensitive.
Javascript will be run on client side.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

VBScript
==============
VBScript not case sensitive.
VBScript will be run on server side.

2. Write the operators that can be used in Java script.

 Arithmetic
 Logical
 Conditional
 Comparison
 Assignment

3. Write a script code to call a function with argument using java script.
<html>
<head>
<script type="text/javascript">
function myfunction(txt)
{
alert(txt)
}
</script>
</head>
<body>
<form>
<input type="button"
onclick="myfunction('Hello')"
value="Call function">
</form>
<p>By pressing the button, a function with an argument will be called. The function will
alert
this argument.</p>
</body>
</html>

4. Write some of the window objects used in javascript.


How to display an alert box.
<html>
<body>
<script type="text/javascript">
alert("Hello World!")
</script>
</body>
</html>

5. How to open multiple windows using java script?

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

<html>
<head>
<script language=javascript>
function openwindow()
{
window.open("http://www.microsoft.com/")
window.open("http://www.w3schools.com/")
}
</script>

</head>
<body>
<form>
<input type=button value="Open Windows" onclick="openwindow()">
</form>
</body>
</html>

6. Write down the benefits of java script code in an HTML document (NOV/DEC
2007)
 JavaScript gives HTML designers a programming tool - HTML authors are normally not
programmers, but JavaScript is a scripting language with a very simple syntax! Almost
anyone can put small "snippets" of code into their HTML pages
 JavaScript can put dynamic text into an HTML page - A JavaScript statement like this:
document.write("<h1>" + name + "</h1>") can write a variable text into an HTML page
 JavaScript can react to events - A JavaScript can be set to execute when something
happens, like when a page has finished loading or when a user clicks on an HTML
element
 JavaScript can read and write HTML elements - A JavaScript can read and change the
content of an HTML element
 JavaScript can be used to validate data - A JavaScript can be used to validate form data
before it is submitted to a server, this will save the server from extra processing

7. For the following form, write down the JavaScript code to swap the contents of the
two text boxes
<FORMNAME=”DaForm”>
Input text 1: <INPUT TYPE=”TEXT” NAME=”A”>
Inputtext 2: <INPUT TYPE=”TEXT” NAME=”B”>
</FORM> (NOV/DEC 2007)

<html>
<head>
<title>swapAJN.html</title>
<script type="text/javascript">
function swap(oField1, oField2){

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

var temp = oField1.value;


oField1.value = oField2.value;
oField2.value = temp;
}
</script>
</head>
<body>
<form name="capsform">
<input type="text" name="caps1" size="40" value=""

onchange="this.value=this.value.toUpperCase();" />
<input type="text" name="caps2" size="40" value=""

onchange="this.value=this.value.toUpperCase();" />
<input type="button" value="Swap" onclick="swap(this.form.caps1, this.form.caps2)" />
</form>
</body>
</html>

8. List out the objects involved in Java Script with its purpose. (APR/MAY 2008)
(refer java script objects)

9. Differentiate between java and java script(Nov/Dec 2008)


The main difference is that java is a platform; whereas JavaScript is a computer
programming/ scripting language that does not refer to how the scripts are executed

10. Comment on the statement “ each object of a class has its own instance of static
member variable(Nov/Dec 2008)
Member variables are declared within the opening and closing braces of the class
body and outside of any method declarations for the class. Typically they are declared as
the first thing in the class body, but they don’t have to be. Some programmers’ put all
their variable declarations at the end of the class body. Member variables fall in to two
groups: instance variables and static variables
Instance variables hold data which is unique for each object instance. Each
instance has its own copy of the variable. For example, if we created a human class, we
might have an instance variable called name. As we created instances of the class, we
would assign each instance a name which would be held in the name variable
Static variables should be thought of as belonging to the class as a whole. Every
instance that accesses a given static variable will see the same data because there is only a
single copy of it. For example, the human class could have a static variable called
population count that holds the number of instances currently in existence.

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

11. What is the need for client side scripting(May/June 2009)

Client-side scripts are often embedded within an HTML document (hence known as an
"embedded script"), but they may also be contained in a separate file, which is referenced by the
document (or documents) that use it (hence known as an "external script"). Upon request, the
necessary files are sent to the user's computer by the web server (or servers) on which they
reside. The user's web browser executes the script, and then displays the document, including
any visible output from the script. Client-side scripts may also contain instructions for the
browser to follow if the user interacts with the document in a certain way, e.g., clicks a certain
button. These instructions can be followed without further communication with the server,
though they may require such communication.
UNIT-IV
1. What is Variable? How variables are declared in PHP?
o Integers: are whole numbers, without a decimal point, like 4195.
o Doubles: are floating-point numbers, like 3.14159 or 49.1.
o Booleans: have only two possible values either true or false.
o NULL: is a special type that only has one value: NULL.
o Strings: are sequences of characters, like 'PHP supports string operations.'
o Arrays: are named and indexed collections of other values.
o Objects: are instances of programmer-defined classes, which can package up
both other kinds of values and functions that are specific to the class.
o Resources: are special variables that hold references to resources external to PHP
(such as database connections
2. What is PhP?
PHP - Hypertext Preprocessor -one of the most popular server-side scripting languages for
creating dynamic Web pages. - an open-source technology - platform independent
3. List the features of PhP.
 Simplicity
 Efficiency
 Security
 Flexibility
 Familiarity
1. List possible data types available in PHP.

2. How comments are made in PHP.


1. Shell style comments - denoted #THIS IS A COMMENT

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

2. C++ style comments - denoted THIS IS A COMMENT—


3. C style comments - denoted /* ALL THIS COMMENTED! */
<!DOCTYPE html>
<html>
<body>

<?php
// This is a single-line comment

# This is also a single-line comment

/*
This is a multiple-lines comment block
that spans over multiple
lines
*/

3. How singly quoted string and doubly quoted string differs.


In PHP, people use single quote to define a constant string, like 'a' , 'my name' , 'abc xyz' ,
while using double quote to define a string contain identifier like "a $b $c $d" . echo "my
$a"; This is true for other used of string.

4. Differentiate echo() and print() function.


They are both used to output data to the screen. The differences are small: echo has no return
value while print has a return value of 1 so it can be used in expressions. echo can take
multiple parameters (although such usage is rare) while print can take one argument. echo is
marginally faster than print .

5. What do you mean by expression? Give examples.


Anything that has a value is an expression. In a typical assignment statement ($x=100), a
literal value, a function or operands processed by operators is an expression, anything that
appears to the right of assignment operator (=)

Syntax
$x=100; //100 is an expression
$a=$b+$c; //b+$c is an expression
$c=add($a,$b); //add($a,$b) is an expresson
$val=sqrt(100); //sqrt(100) is an expression
$var=$x!=$y; //$x!=$y is an expression

6. What do you mean by QueryString in PhP?


A query string is a part of a uniform resource locator (URL) that assigns values to specified
parameters. PHP can create a query string from array using http_build_query() function. This
function take an associative array of field names and values and returns the entire query
string.
7. How type conversion is done in PHP?

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

In PHP, data-type conversion can be performed by passing the data type as an argument to
function settype. Function settype takes two arguments: The variable whose data type is to be
changed and the variable ’s new data type. E.g., settype( $testString, "double" );
8. Write the uses of text manipulation with regular expression in PHP.
 PHP processes text data easily and efficiently, enabling straightforward searching,
substitution, extraction and concatenation of strings.
 Text manipulation in PHP is usually done with regular expressions — a series of
characters that serve as pattern-matching templates (or search criteria) in strings, text
files and databases.
 This feature allows complex searching and string processing to be performed using
relatively simple expressions
9. How to Include PHP in a Web Page?
There are 4 ways of including PHP in a web page
<html>
<head>
<title>Hello World</title>
<body>
<?php echo "Hello, World!";?>
</body>
</html>

we can also use print instead of echo


• Method (1) is clear and unambiguous
• Method (2) is useful in environments supporting mixed scripting
languages in the same HTML file
 Methods (3) and (4) depend on the server configuration
10. Write a simple PHP script
 Here is PHP script which is embedded in HTML using level one header with the
PHP output text. The name of this file is called hello.php.
 <!DOCTYPE html>
<html>
<body>

<?php
ECHO "Hello World!<br>";
echo "Hello World!<br>";
EcHo "Hello World!<br>";
?>

</body>
</html>

11. What is the scope of variables in PHP?


Once PHP variables have been defined they are known for the rest of the Web page:
• Obeying standard scoping rules of course.
• Variables can be local to functions etc, much like any languages

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

12. Write a PHP script to set the background colour to blue on Tuesday in a given date
<?php
$day=date("l");
switch($day)
{
case 'Monday':
$bg_color = "red";
break;
case 'Tuesday':
$bg_color = "blue";
break;
case 'Wednesday':
$bg_color = "blue";
break;
case 'Thursday':
$bg_color = "gray";
break;
case 'Friday':
$bg_color = "yellow";
break;
case 'Saturday':
$bg_color = "green";
break;
case 'Sunday':
default:
$bg_color = "black";
break;
}
echo "
Welcome to my Homepage
";
?>
13. What is cookie? Give example in PHP
A cookie is a text string stored on the client machine by your script (to track
users and manage transactions). Cookies are automatically returned (by the
client), and can be accessed using a variable of the same name
• The following script reads and displays a cookie, and sets it with a new value
(string) that was passed to the script as a parameter.
• The cookie will expire after 20 minutes (1200 seconds)
<?php setCookie("CookieTest", $val, time()+1200); ?>
<html>
<head><title>Welcome</title></head>
<body>
<?php echo("<h2>The cookie is: $CookieTest</h1>
</body>
</html>

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

14. How do you declare and initialize an array in PHP


Two ways of declaring and initializing an array:
a) Individual element initialization in an array
$myArray[0]= "Apples";
$myArray[1]= "Bananas";
b) Arrays can be constructed using the array() keyword
$person =array("Dave", "Adam", "Ralph");
Unit -V
1. What is meant by WWW?
The World Wide Web is a system of interlinked hypertext documents accessed via the
Internet. With a web browser, one can view Web pages that may contain text, images,
videos, and other multimedia and navigate between them using hyperlinks. Using
concepts from earlier hypertext systems, the World Wide Web was invented in 1989 by
the English physicist Tim Berners-Lee, now the Director of the World Wide Web
Consortium, and later assisted by Robert Cailliau, a Belgian computer scientist, while
both were working at CERN in Geneva, Switzerland. In 1990, they proposed building a
"web of nodes" storing "hypertext pages" viewed by "browsers" on a network,[1] and
released that web in December

2. What is meant by servlets?


Servlets are generic Extensions to java-enabled servers. Their most common use is to extend
web servers, providing a very Efficient, portable, and easy-to-use replacement for cgi. A
servlet is a dynamically loaded module that Services requests from a web server. It
runs entirely inside the java virtual machine. Because the servlet Is running on the
server side, it does not depend on browser compatibility. Figure 5.1 depicts the execution
of a java servlet.

Figure 5.1: execution of a java servlet.

3. What are the stages in the life cycle of servlet? (APR/MAY 2008) (Nov/Dec 2008)

The interface that declares this framework is the javax.servlet. Servlet interface. The servlet
Interface defines the life cycle methods. These methods are init(), service(), and destroy().

init()

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

The init() method is where the servlet's life begins. It is called by the server immediately after
the Servlet is instantiated. It is called only once. In the init() method, the servlet creates and
initializes any Resources, including data members, that it will be using while handling
requests. The init() method's Signature is defined as follows:

Public void init(ServletConfig config) throws ServletException;

The init() method takes a ServletConfig object as a parameter. You should save this object so
that It can be referenced later. The most common way of doing this is to have the init()
method call Super.init(), passing it the ServletConfig object. You will also notice that the
init() method can throw a servletexception. If, for some reason, the Servlet cannot initialize
the resources necessary to handle requests, the init() method will throw a Servletexception.

service()

The service() method handles all requests sent by a client. It cannot start servicing requests
until the init() method has been executed. You will not usually implement this method
directly, unless you extend the GenericServlet abstract class.
The most common implementation of the service() method is in the HttpServlet class. The
HttpServlet class implements the servlet interface by extending GenericServlet. Its service()
Method supports standard http/1.1 requests by determining the request type and calling the
appropriate Method.

The signature of the service() method is as follows:

Public void service(ServletRequest req, ServletResponse res) Throws ServletException,


IOException;

The service() method implements a request and response paradigm. The servletrequest object
Contains information about the service request, encapsulating information provided by the
client. The Servletresponse object contains the information returned to the client.

destroy()

This method signifies the end of a servlet's life. When a service is being shut down, it calls
the servlet's destroy() method. This is where any resources that were created in the init()
method will be cleaned Up. If you have an open database connection, you should close it
here. This is also a good place to save any persistent information that will be used the next
time the servlet is loaded.
The signature of the destroy() is :
Public void destroy();

4. What is meant by http servlet?


The HttpServlet class has already implemented it for you.
The following is the Prototype:

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

Protected void service(HttpServletRequest req, HttpServletResponse resp) Throws


ServletException, IOException;

When the HttpServlet.service() method is invoked, it reads the method type stored in the
request And determines which method to invoke based upon this value. These are the
methods that you will want to override. If the method type is GET, it will call doGet(). If the
method type is POST, it will call doPost(). There are five other method types and these will
be covered later in this chapter. All these Methods have the same parameter list as the
service() method.

The HttpServletRequest and HttpServletResponse classes Are just extensions of


servletrequest and servletresponse with http-specific information stored In them. Figure 5.4
diagrams the flow of an HttpServlet request.

Figure 5.4: an HttpServlet request

Method Description
doDelete Called in response to an HTTP delete request. Such a request is normally
used to delete a file from a server. This may not be available on some
servers, because of its inherent security risks (e.g., the client could delete
a file that is critical to the execution of the server or an application).
doHead Called in response to an HTTP head request. Such a request is normally
used when the client only wants the headers of a response, such as the
content type and content length of the response
doOption Called in response to an HTTP options request. This returns information
s to the client indicating the HTTP options supported by the server, such as
the version of HTTP (1.0 or 1.1) and the request methods the server
supports.
doPut Called in response to an HTTP put request. Such a request is normally
used to store a file on the server. This may not be available on some
servers, because of its inherent security risks (e.g., the client could place
an executable application on the server, which, if executed, could damage
the server— perhaps by deleting critical files or occupying resources).

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

doTrace Called in response to an HTTP trace request. Such a request is normally


used for debugging. The implementation of this method automatically
returns an HTML document to the client containing the request header
information (data sent by the browser as part of the request).

5. What is meant by generic servlet?


The GenericServlet. service () method has been defined as an abstract method in order to
force you to Follow this framework.
The service() method prototype is defined as follows:

Public abstract void service(ServletRequest req, ServletResponse res) throws


ServletEexception, IOException;

The two objects that the service() method receives are ServletRequest and ServletResponse.
The ServletRequest object holds the information that is being sent to the servlet, whereas the
ServletResponse object is where you place the data you want to send back to the server.
Figure 5.3 Diagrams the flow of a GenericServlet request.

Figure 5.3: a GenericServlet request.

6. What is meant by MIME?


Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends
the format of e-mail to support:
 Text in character sets other than ASCII
 Non-text attachments
 Message bodies with multiple parts
 Header information in non-ASCII character sets

7. What is the protocol used in web based applications?


HTTP-Hyper text transfer protocol

8. What is servlet? How do you compare servlet and traditional CGI programs?
(NOV/DEC 2007)

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

Both are server-side technologies, but CGI programs execute in their own shell, at run-time
they create there own shell, and it involves an heavy weight activity. but where as servlets
can be requested using different threads.

Advantages of CGI:
Can be written in variety of languages ,primarily written in perl
Bugs does not crash the web server
Easy for reference
Execute in their own OS Shell, doesn’t have concurrency conflicts
All service providers support CGI Programs

Disadvantages:
Response time is high, the creation of an OS Shell is an heavy weight activity
CGI is not scalable
Not always secure or object-oriented
No separation of presentation and business logic
Scripting languages are often platform-dependent

Advantages of servlets over CGI


Request is run in a separate thread,so faster than CGIs
Scalable,can serve many more requests,
Robust and Object Oriented.
Can be written in Java Programming language.
Platform independent.
Access to Logging Capabilities.
Error handling and Security.

9. What are the four JDBC drivers in java (Nov/Dec 2008)


JDBC drivers are available for most database platforms, from a number of vendors and in a
number of different flavors. There are four driver categories:
Type 1- JDBC-ODBC Bridge Driver
Type 1 drivers use a bridge technology to connect a Java client to an ODBC database service.
Sun's JDBC-ODBC bridge is the most common Type 1 driver. These drivers are
implemented using native code.
Type 4- Native-API Partly-Java Driver
Type 2 drivers wrap a thin layer of Java around database-specific native code libraries. For
Oracle databases, the native code libraries might be based on the OCI (Oracle Call Interface)
libraries, which were originally designed for C/C++ programmers. Because Type 2 drivers
are implemented using native code, in some cases they have better performance than their
all-Java counterparts. They add an element of risk, however, because a defect in a driver's
native code section can crash the entire server.
Type 3- Net-Protocol All-Java Driver
Type 3 drivers communicate via a generic network protocol to a piece of custom middleware.
The middleware component might use any type of driver to provide the actual database
access. WebLogic's Tengah product line is an example. These drivers are all Java, which
makes them useful for applet deployment and safe for servlet deployment.
Type 4- Native-Protocol All-Java Driver

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

Type 4 drivers are the most direct of the lot. Written entirely in Java, Type 4 drivers
understand database-specific networking protocols and can access the database directly
without any additional software.

10. How can you create JDBC statements? (NOV/DEC 2007)


The simplest way to execute a query is to use the java.sql.Statement class. Statement
objects are never instantiated directly; instead, a program calls the createStatement() method of
Connection to obtain a new Statement object:
Statement stmt = con.createStatement();

11. Define Servlet Cookies. (APR/MAY 2008)


Using cookies is probably the best and the neatest of all the methods to maintain sessions.
Cookies are basically small text files that are stored on the user's computers. This has
information pertaining to that user. Once the cookie is created on the user's computer then for
every further request made by that user in that session, the cookie is sent along with the
request. The value of every cookie is unique (for users browsing a particular website), so the
server side program can differentiate between various users.

The method to program cookies is different for different languages. Most of the
language provide some class that covers all the details of cookie creation and maintenance.
For example in Java you have a javax.servlet.http.Cookie class that is used to work with
cookies.

12. Write and explain any one method of servlet interface(May/June 2009)
Servlet interface methods (package javax.servlet).

Method Description
void init( ServletConfig The servlet container calls this method once during a servlet’s
config ) execution cycle to initialize the servlet. The ServletConfig
argument is supplied by the servlet container that executes the
servlet
ServletConfig This method returns a reference to an object that implements
getServletConfig() interface ServletConfig. This object provides access to the
servlet’s configuration information such as servlet initialization
parameters and the servlet’s ServletContext, which provides the
servlet with access to its environment
(i.e., the servlet container in which the servlet executes).
String getServletInfo() This method is defined by a servlet programmer to return a string
. containing servlet information such as the servlet’s author and
version
void The servlet container calls this method to respond to a client
service( ServletRequest request to the servlet
request,
ServletResponse
response )

Downloaded by Anitha A ([email protected])


lOMoARcPSD|50370378

void destroy() This “cleanup” method is called when a servlet is terminated by


its servlet container. Resources used by the servlet, such as an
open file or an open database connection, should be deallocated
here.

13. Write the directory structure of a typical web server(May/June 2009)

Downloaded by Anitha A ([email protected])

You might also like