Monday 6 May 2013

INTERNET PROGRAMMING QUESTION BANK



UNIT – I 
PART-A

Define  XHTML.
       XHTML(Extensible Hybertext Markup Language) is a Markup language that specifies the format of the text that is displayed in a web browser such that microsoft’s Internet Explorer or Netscape.It is cross between HTML and XML.

What is key issue of XHTML? 
       A key issue when using XHTML is the separation of the presentation of a document from the structure of the information in the document.

What are the important elements of an XHTML document?
      Important elements of an XHTML document are the html element ,the head element and the body element.   

Difference between  HTML and XHTML?
      In HTML,it is to specify the document’s content, structure and formatting.Formatting might specify where the browser placed  an element in a webpage or the fonts and colors used to display an element.
     In XHTML, allows only a document’s content and structure to appear in a valid XHTML document, and not  its formatting.Normally ,such formatting is specified with cascading style sheets.

Rules for writing XHTML document.
    1. Elements and Attributes  should be written in lowercase.
    2. All elements should be closed.
    3. All documents should  have Doctype.
    4. All elements should be properly nested.

Define Headers in XHTML.
     XHTML provides six headers(h1 through h6) for specifying the relative importance of information.Header element  h1 is considered the most significant header and is rendered in a larger font than the other five  headers. Each successive header element(h2..h6)is rendered in a progressively smaller font.

Usage of Header Elements.
     Placing a header at the top of every XHTML page helps viewers understand the purpose of each page.

What is the use of Linking element in XHTML?
One of the most important XHTML features is the hyperlink(Linking element) which references(or links) to other resources, such as XHTML documents,web pages, a file or an email address.
Links are created using the a(anchor element).The most important attribute for the a element is href which specifies the resource being linked.
Ex:
<a  href=” http://www.yahoo.com”>yahoo</a>


Explain the use of img element.
An img element is used to insert an image in the document .The image file’s location is specified with the img element’s src attribute.
Optional  attributes width and height specify the image’s width and height.
Ex:
<img src=”flower.jpg” height=”200” width=”250” alt=”flower picture” />

What is the use of alt attribute in img element?
The alt attribute in img element makes webpages more accessible to users with  disabilities, especially those with vision impairments who use text based browser.
The speech synthesizer software application “speaks” the alt attribute’s value so that the user knows  what the browser is displaying.

What is the difference between unordered list element and ordered list element?
The undered list element ul creates a list in which each item in the list begins   with a bullet symbol(called disc).Each entry in an undered list is a li(list item)element.
The ol (ordered list element) creates a list in which each item begins with a number.

Define table element in XHTML.
The table element defines an XHTML table.Attribute border specifies the table’s border width in pixels.Tables without border set this attribute to “0”.
Here the element summary summarizes the table’s contents and is used by speech devices to make the table more accessible to users with visual impairments.
Ex:
<table border=”1” width=”20%” summary=”table for book price”>
</table>

What are the three sections in XHTML table?
A  table has three distinct sections- head, body and foot.
The head section is defined with a thead element which contains header information such as column names.
The foot section is defined with tfoot element.
The body section or table body contains the table’s primary data.

Define Forms in XHTML.
XHTML provides forms for collecting information from users.Forms contain visual components such as buttons that users click.
Forms may also contain non-visual components called hidden inputs which are used to store any data such as e-mail addressesand XHTML document file names used for linking.
A form begins with the form element.Attribute method specifies how the form’s data is sent to the server.
Ex:<form method=”get(or)post” action=”URL of script on web server”>
       </form>

Define Imagemap:-
        Image maps are defined with map elements.Attribute id identifies the image map.Hotspots are defined with the area element.Attribute href specifies the link’s target.Attributes shape and co-ords specify the hotspot’s shape and co-ordinates and alt provides alternative text.
  Ex: <map id=”picture”>

Define Frames in XHTML:
Frames allow the browser to display more than one XHTML document  simultaneously.
The frameset element informs the browser that the page contains frames.
XHTML provides the no frames element to specify alternative content for browsers that do not support frames.
Frame set element is used to create more complex layouts in a web page by nesting framesets.

What is the use of Summary and Caption element in table element?
Element summary summarizes the table’s contents and is used by speech devices  to make the table more accessible to users with visual impairments.
Element caption describes the table’s content. The text inside the <caption> tag is rendered above the table in most browsers.

What is the use of Internal Hyperlink?
Internal  Linking is a mechanism that enables the user to jump between locations in the same document.
Internal linking is useful for long documents  that contain many sections.
Clinking an internal link enables users to find a section without scrolling through  entire document.

Define CSS:-
CSS is Cascading Style Sheets that allow document authors to specify the  presentation of elements on a webpage separately from the structure of the document.
This separation of structure from presentation simplifies maintaining and modifying a document’s layout.

Define :Inline Style Sheet and Embedded Style Sheet.
Inline Style Sheet:-Inline Styles that declare an individual element’s format using the XHTML attribute Style.
Embedded Style Sheet:-Embedded style sheets enable a web-page author to embed  an entire css document in an XHTML document’s head section.

What is the use of External linking of style sheets?
      External linking of style sheets can create a uniform look for a website.Separate  pages can all use the same styles.Modifying a single style sheet file makes changes to styles across an entire website.

What is  the difference between Absolute positioning and Relative positioning in CSS?
    Absolute positioning:-Which gives authors greater control over how document elements are displayed. Specifying an element’s position as absolute removes the element from the normal flow  of elements on the page, instead positioning it according to the distance from the top, left, right or bottom.
   Relative positioning:- In which elements  are positioned relative to other elements.Relative positioning keeps elements in the general flow of elements on the page,so positioning is relative to other elements in the flow.

What is the use of Z-index  in position  property of CSS?
       The  Z-index property allows a developer to layer overlapping elements .Elements  that have higher Z-index value are displayed in front of elements with lower z-index values.

Define Margin and Padding in CSS.
  Margin:-The Margin property determines the distance between the element’s  edge and any outside text.Margins for individual sides of an element can be specified by using margin-top,margin-right,margin-left,margin-bottom.
 Padding:- The padding property determines the distance between the content inside  an element and the edge of the  element.Padding also can be set for each side of the box using padding-top,padding-right,padding-left,padding-bottom.

What is the use of class attribute in CSS?
      The class attribute allows more than one class to be assigned to an XHTML element by separating each class name from the next with a space.


PART-B
  1. Create an XHTML document that contains links to your favourite web sites.
  2. Create an XHTML document containing two ordered lists:-color and shape.Each ordered list should contain a nested unordered list of your favourite color.
  3. Write an XHTML document that produces the table as output.
  4. Create an XHTML document that use an image as an e-mail link .Use attribute alt to provide a description of the image and link.
  5. Write the XHTML markup to create a frame with a table of contents on the left side of the window and have each entry in the table of contents use internal linking to scroll down the document frame to the appropriate subsection.
  6. Write a program to create an application form using all components in XHTML.
  7. Explain about image map with example program.
  8. Explain about meta-element with example program.
  9. Explain about Nested frameset with example program.
  10. Explain the given XHTML elements with syntax.
  11. a) img b) a  c) strong d)li e)tfoot f)label g)textarea  h)select i)area j)meta k)frame l)option.
  12. Write a CSS rule that gives all h1 and h2  elements a padding of 0.5ems , a grooved border style and a margin of 0.5 ems.


UNIT – II
PART-A

Define Object Model in DHTML.
        The Dynamic HTML Object Model gives Web authors great control over the presentation of their pages by giving them access to all the elements on their Web page.The whole Web page elements,forms,frames tables ,etc is presentated in an object hierarchy.Using scripting , an author is able to retrieve and modify any properties or attributes of the webpage dynamically.

How to refer an element in DHTML?
       The simplest way to reference an element is by id attribute.The element is replaced as an object  and its various XHTML attributes become properties that can be manipulated by scripting.
Ex: <p id=”ptext”>
In script:<script type=”text/javascript” for=”ptext”>

Define Collections in DHTML

       Collections are basically arrays of related objects on a page .There are several special  collections in the object model.
Ex: all and children collection.

What is the difference between innerText and innerHTML property?
      innerText:- The innerText property of the object refers to the text contained  in the element.
      innerHTML:-The innerHTML property is similar to innerText,but it  can include XHTML formatting.

Define all and children  collections in DHTML:-
       The all collection  contains  all the XHTML elements in a document.
The children collection of an element contains only the element’s direct child elements.Ex. An HTML element has only two children :the head element and the body element.

Define outerHTML property.
       The outerHTML property is similar to the innerHTML property, but it includes the enclosing XHTML  tags as well as the content  inside them.

What is dynamic content?
       Changing the text displayed on screen is a Dynamic HTML ability called dynamic content.

What is the use of  tagName and  className property in DHTML?
       The tagName property contains the name  of the tags we encounter while looping through the document , to place them in the string element.
       The className property of an element is used to change the element’s style class.

 What is dynamic positioning?
        In Dynamic positioning ,XHTML elements can be positioned with scripting.This is done by declaring an element’s CSS position property to be either absolute or relative and  then  moving the element by manipulating any of the top,right or bottom CSS properties.

What is the use of navigator object?
         The navigator object contains information about the web browser that is viewing the page. This allows Web authors to determine which browser the user has.The navigator.appName property contains the name of the application.
Ex for IE,this property is “Microsoft Internet Explorer” for Netscape, it is “Netscape”.

What is DOM?
         DOM is Document Object Model.
     List of Objects are:-window, document object, body , history , navigator , location ,event ,screen. List of Collections are:-all,anchors,  applets embeds, forms, frames,images,links,plugins,scripts,stylesheets
What is the use of Event model in DHTML?
      The event model allows scripts to respond to user actions and change a page accordingly. This makes web applications responsive and user friendly and can  greatly lessen server load but cause compatibility problems.

List out the Event models in DHTML.
      onClick,  onload, onerror, onmousemove, onmouseover, onmouseout, onfocus, onblur  , onsubmit   and onreset. 

What is the use of offsetX  and  offsetY   properties of an event object?
       The event object contains information about the triggered event.The offsetX
and offsetY properties of an event object give the location of the mouse cursor relative to the top-left corner of the object on which the event was triggered.

Define:- onmousemove,onmouseover,onmouseout  events.
  • Event onmousemove fires constantly whenever the mouse is in motion.
  • Event onmouseover fires whenever the mouse cursor moves over an element.
  • Once the mouse cursor leaves the element ,an onmouseout  event is fired.


Define :-onload  and onclick events.
  • Onclick event  fires  when the user clicks the mouse.
  • The onload event fires whenever an element finishes loading successfully and is often used in the body element to initiate scripts as soon as the page has  been loaded into the  page.


Define :-onfocus and onblur event
     Events onfocus and onblur fire when an element gains or loses focus.

Define :-onsubmit and onreset
     The event  onsubmit  fire when a form is submitted and onreset fire  when a form is reset.

What is the use of onerror   event  in DHTML?
        The onerror event is used to write error handling code.The syntax window.onerror=functionName specifies that functionName runs if the onerror is triggered in the window object. Error handlers can accept three parameters from the onerror event.

What are the three parameters passed by onerror event?
        The  Error handlers can accept three parameters from the onerror event.The  onerror event passes the type of error that occurred, the URL of the file that had the error and the line number on which the error occurred.

Define :-Event bubbling
      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,then to the parent’s event handler.Cancel Bubble property of the event object  is used to cancel Bubbling of the event in the child element’s event –handling code .

What is the difference between filters and transitions ?
     Filters and Transitions are specified with the CSS filter property. Filters and Transitions do not add content to your pages-rather, they present existing content in an engaging manner to cpture the user’s attention.
     Filters:-Applying filters to text and images  causes changes that are persistent.
    Transitions:-Applying a transition allow to transfer from one page to another with a pleasant visual effect, such as a random dissolve.
  
Where we can apply Filters and Transitions  property?
     Filters and Transitions can be applied to all block-level elements such as div or  p.They can be applied to an inline-level element such as strong or em, however ,only if the element has its height or width CSS property set.

What is the use of flipv and fliph flip filters?
      The flipv and fliph filters mirror text or images vertically and horizontally.
      Fliph:- Which flips the affected object horizontally.
      Flipv:-  Which flips the affected object vertically.

What is the use of Chroma filter?
       The chroma  filter applies transparency effects dynamically, without using a graphics editor to hard-code transparency into the image.

Define Imagemask.
       Applying the mask filter to an image allows to create an effect in which an element’s background is a solid color and its foreground is transparent,so the image or color behind it shows through.This is known as an image mask.

Define :-invert,gray and xray filters
      Invert filter:- The invert filter applies a negative image effect-dark areas become light and light areas become dark.
Gray filter:-The gray filter applies a grayscale image effect , in which all color is stripped from the image and all that remains is brightness data.
Xray filter:-The xray filter applies an x-ray effect, which basically is an inversion of the grayscale effect.

What is the use of shadow and glow filter and alpha filters?
   Shadow filter:-A simple filter that adds depth to your text is the shadow filter.This filter creates a shadowing effect that gives your text a three –dimensional appearance.
   Glow filter:- The glow filter adds an aura of color around text.The color and strength can  both be specified in glow filter.
   Alpha filter:-The alpha filter is also used for transparency effects not achievable with the chroma filter.

Define :-blur,dropShadow and light filters,wavefilter.
   Blur filter:-The blur filter creates an illusion of motion by blurring text or  images in a certain direction.
   The two filters that apply advanced image processing effects are the dropshadow and light filters.
 dropShadow filter:- It creates a blacked-out version of the image, and places it behind the image, offset by specified number of pixels.
 Light filter:-The light filter is the most powerful and advanced filter in IE.It allows to simulate the effect of a light source shining on your page.
 Wave filter:-The wave filter allows to apply sine-wave distortions to text or images on your Web pages.

Define:- blendTrans transition and revealTrans transition
      blendTrans transition  which creates a smooth fade-in/fade-out effect.
      RevealTrans transition   which allows to create professional-style transitions, from boxout to random dissolve.

PART-B
1 Write DHTML program to change a text  or image vertically and horizontally.
2 Create a Web page that applies the invert filter to  an image if the user moves the mouse over it.
3. Write a program in which apply transparency effect and masking effect to an image.
4 Create a Web page that applies the glow filter to a hyperlink if the user moves the mouse over the link.
5. Write a program to add showdows to the text.
6 Write a program using blendTrans transition  .
7 Write a program using RevealTrans transition   
8. Write a script that changes the attributes of an alpha filter every 20 seconds.Change both the color and the style of the alpha filter every time.
UNIT – III
PART-A

What is the use of Data binding?
With data binding, data need no longer reside exclusively  on the server.Data can be maintained on the client in a manner that distinguishes it from the XHTML code on the page.
Once the data is available on the client,the web application designer can provide various functionality,especially the ability to sort and filter the data in various ways.


What is TDC?
TDC is an Tabular Data Control. It is an ActiveX control that can be added to the page with an object tag.
When the web page is loaded with data-bound elements,the client retrieves the data from the data source specified by the TDC. The data is then formatted for display on the Web page and remains accessible on the client.

What is ActiveX control?
ActiveX control is basically an object which  can be placed on the web page in order to increase the user’s interaction.
The ActiveX control is basically a set of rules which can be applied to create the interactive objects.

What is the use of Object tag?
        An object tag  inserts  an ActiveX  Tabular  Data control .The classid attribute  specifies the ActiveX control identifier.

What is the use of param tag?
       The param tag specifies parameters for the object in the object tag.The name  attribute is the parameter name and the value attribute is the value.The DataURL parameter  is the  URL of the data source .The Use Header parameter  specifies that the first line of the data file  is to have  a header row  when set to true.The TextQualifier parameter sets the text qualifier of the data.The FieldDelim parameter sets  the field delimiter of the data.

What is use of datasrc and  datafld attributes?
     The datasrc attribute refers to the id of the TDC object,and the datafld attribute specifies the name of the field  to which it is bound.

List out the different  Multimedia-ActiveX objects.
Sequence control
Path control
Media player
Sprite control
Structured Graphics Control

List out the XHTML elements that allow data binding.
                         
Element
Bindable property
a
Href
div
Contained text
img
Src
Input type=”button”
Value
param
Value
select
Selected option
span
Contained text
       
Write the syntax for various objects used in SGC.
1) Rect(x,y,width,height,rotation)
2) Oval(x,y,width,height,rotation)
3) RoundRect(x,y,width,height,arc_width,arc_height,rotation)
4) Arc(x,y,width,height,starting_angle,arc_angle,rotation)
5) Polygon(number_of _points,x1,y1,….xn,yn,rotation)
6) Pie(x,y,width,height,starting_angle,arc_angle,rotation)

What are the two functions used for displaying the text using ActiveX control?
SetFont(font_name,font_size,boldness,if_italic,if_underlined,if_strickthrough)
Text(String, x,y,rotation)

What is the need of client-side  scripting?
     Following are the issues that get handled using client side scripting.
1) Simple scripting language like HTML or XML represents the data on the web page in simple manner.
2) The scripting languages like Javascript and DHTML are useful for enhancing the interactivity of the user with the web browser.
3) Mathematical evaluation is also possible using the client side scripting.
4) Using client side scripting languages the web page which gets designed for the user provides a graphical user interface using which the user can input his data in an elegant manner.This data can then be submitted to database or any server side scripting language in order to process it further.
5) The input validation can  also be possible using client side scripting language like Javascript.

What is the difference between Java and JavaScript?
Sno
Java
Javascript
1
Java is a Object oriented programming language
Javascript is a scripting language
2
Compiled language
Interrupted language
3
Java need extra plug-in
Browser is enough to run javascript
4
Complex
simple

List out the uses of Java script. 
Javascript can get embedded in XHTML
Javascript can be used to create cookies
Javascript are used to validate the data on the web page before submitting it to the server
Java script can be used to detect the visitor’s browsers and can load the page accordingly.

What is the advantage of indirectly embedding of javascript?
Script can be hidden from the browser user
The layout and presentation of web document can be separated out from the user interaction through the Javascript.

What is the disadvantage of indirectly embedding of Javascript?
If small amount of Javascript code has to be embedded in XHTML document  then making a separate Javascript file is meaning less
If the Javascript code has to be embedded at several places in XHTML document then it is complicated to make separate Javascript file and each time invoking the code for it from the XHTML documents.

Listout the Global functions in Javascript.
Escape
Eval
isFinite
isNan
parseFloat
parseInt
unescape
Define Pseudocode
         Pseudocode is an artificial and informal language that helps programmers develop algorithms. 

What are three forms of control statements available in Javascript?
Sequence  statement
Selection    statement       
                 If statement
                 If …else statement
                 Switch statement     
Repetition   statement
                     While statement
                     Do.. while
                     For   statement
                     For in statement 

Write the name of objects available in Javascript.
Math object
String object
Date object
Boolean and Number object
Document object
Window object
Write the methods available in document object.
Write(string)
Writeln(string)
Document.cookie
Document.lastModified

Write the methods available in window object.
Open(url,name,options)
Prompt(prompt,default)
Close()
Focus()
Blur()
Window.document
Window.closed
Window.opener

What are the methods available in Date object?
getDate()
getUTCDate()
getHours()
getUTCHours()
setTime()
getTime()

What is the use of Array object in Javascript?
An array in Javascript is an Arrayobject Operator new is used to dynamically allocate the number of elements required by an array.Operator new creates an object as the program executes,by  obtaining enough memory to store an object of the type specified to the right of new.

Write the methods available in String object.
Split(string)
Slice(start,end)
Substr(start,length)
Substring(start,end)
toLowercase()
toUpperCase()

PART-B
1 Explain TDC with example program.
2 Explain about ActiveX control with example program
3. Explain about SGC.
4. Explain about path ,sequence control activeX objects.
5. How to include audio and video files in html document ?Explain with example.
6 Write a script that asks the user to enter two numbers ,obtains the two numbers from the user and outputs text that displays the sum, product, difference and quotient of the two numbers.
7 Write a script program to find factorials  1 to 10 and display result in table format.
8 Write a script that inputs text from an XHTML form and outputs it in Uppercase and lowercase letters.
9 Write a script that uses a function circlearea to prompt the user for the radius of a circle and to calculate and print the area of the circle
10 Explain the objects available in javascript with methods.

UNIT – IV
PART-A

What are the types of scripting languages?
Client-side scripting  
Server –side scripting

Define Client side scripting.
Client-side scripting  refers to the class of computer programs on the web that are executed client side , by the user's web browser, instead of server –side.
Occurring on the client  side of a client-server system. For example, on the World Wide Web, JavaScript scripts are client-side because they are executed by your browser (the client). 
Client-side scripts are often embedded within an HTML or XHTML document (hence known as an "embedded script"), but they may also be contained in a separate file.
Client-side scripts have greater access to the information and functions available on the user's browser
Example:-JavaScript and VB Script.

Define Server side scripting.

Server Side Scripting are the programming language which runs on Web Servers to generate dynamic web pages. Nobody can view the programming code of server side scripting.
Some Server-side scripting languages are 
PHP, ASP, JSP, Perl, Ruby.
PHP :PHP originally stood for "Personal Home Page", it is now said to stand for "PHP: Hypertext Preprocessor
ASP : Active Server Pages
JSP:- Java Server Pages (JSP)
Perl:-Practical Extraction and Reporting Language
Ruby:-more powerful than  Perl, and more object oriented than Python. 

Define Servlet.
    Servlets  are simple Java programs that run on the servers.Hence is the name servlets.Servlewts are most commonly used with HTTP .Hence sometimes servlets are also called as HTTP Servlet .Servlets make use of the Java standard extension classes in the packages javax.servlet and javax.servlet.http.The main purpose of servlets is to add up the functionality to a web server.

Write the usage of servlet.
Servlets can process and store the data submitted by an HTML form.
Servlets are useful for providing the dynamic contents. For example retrieving and updating the databases.
Servlets can be used in the cookies and session tracking.Cookies are small programs which can make use of the information submitted on  currently accessed web pages.Similarly session tracking are the useful programs that keeps track of all previously accessed the web pages.

What is the difference between Applets and Servlets?
Applets
Servlets
1)Applets are the programs at the client side
1) Servlets are the programs
at the server side
2)Applets can make request to servlets
2)The servlets are intended
to response the applets or
HTML program
3)Applets may have graphical user interface(GUI)
3)Servlets have no graphical
 user interface.
4)Applets are extend the web browser
4)Servlets are extend the web server.

 Define CGI
The main purpose  of CGI is to add up the functionality to a web server.
CGI(Comman Gateway Interface) is a language independent interface that allows a server to start an external process.
These external processes further get information about the request using the command line arguments and its standard input stream.
The response can then be given using standard output stream.
Each request is answered  in a separate process by a separate instance of the CGI program.
The CGI programs can be written in perl or c language. 

What are the advantages of Servlet over CGI?
There is no need to generate a separate process for serving each request in case of servlets.
A CGI program needs to be loaded and started on each CGI request.On the other hand, servlets stay in the memory while serving the request.
Servlet creates a single instance to process all the requests .This processing can be done concurrently by this instance.This in turn saves the memory as well as an efficient request processing can be done.Hence performance of servlets is surely better than CGI
Servlets can be run by the servlet engines hence secure use of untrusted servlets can be done.Thus servlets prove to be more secure than CGI
Full functionality of java class libraries is available to the servlets.Servlets can communicate with applets ,HTML programs,databases or even with some RMI programs.

What are the softwares  needed to run servlet programs?
JDK: As servlets are basically Java files.so JDK should be installed.
Tomcat:Tomcat is servlet container using which servlet can be executed.

What are the three important methods available in servlet life cycle?
Init()
Service()
Destroy()

What is the use of init() method in servlet  life cycle?
The client enters the URL in the web browser and makes a request .The browser then generates the HTTP request and sends it to the Web server.
Web server maps this request  to the corresponding servlet.
The server basically invokes the init() METHOD OF SERVLET.This method is called only when the servlet is loaded in the memory for the first time.Using this method initialization parameters can also be passed to the servlet in order to configure itself.

What is the function of service() method in servlet?
       Server can invoke the service for particular HTTP request using service()method.The servlets can thenread the data provided by the HTTP request with the help of service() method.

What is the function of destroy() method in servlet?
       Finally server unloads the servlet from the memory using the destroy() method.

What are the two packages used to implement the servlet?
Javax.servlet
Javax.servlet.http

 What is the use of javax .servlet pakage?
        This package is used to implement the servlet.The most important interface in this package is Servlet.All the servlet must implement this interface.

What are the interfaces available in javax.servlet package?
sno
Interface
Description
1
Servlet
This interface defines all the life cycle methods.
2
ServletConfig
This interface obtains the initialization parameters
3
ServletContext
Using this interface the events can be logged
4
ServletRequest
This interface is useful for reading the data from the client request.
5
ServletResponse
This interface is useful in writing the data to the client response.

What are the classes available in javax.servlet pakage?

sno
class
Description
1
GenericServlet
This class implements the Servlet and ServletConfig interfaces

2
servletInputStream
This class provides the input stream for reading the client’
3
servletOutputStream
This class provides the output stream for writing the client’s response.
4
servletException
This class is used to raise the exception when an error occurs.

What are the two important application of servlet?
     Two important application of servlets are session tracking and Cookies.
Cookies are the small programs that which can make use of the information submitted on currently accessed web page.
Session tracking are useful programs that keeps track of all previously accessed web pages.

What are the interfaces available in javax.servlet.http package?
sno
Interface
Description
1
HttpSession
The session data can be read or written using this interface
2
HttpServletRequest
The servlet can read the information from the http request using this interface
3
HttpServletResponse
The servlet can write the data to HTTP response using this interface
4
HttpSessionBindingListener
This interface tells the object about its binding with the particular session.

What are the classes provided in the javax.servlet.http package?
sno
class
Description
1
Cookie
This class is used to write the cookies
2
HttpServlet
It is used when developing servlets that receive and process HTTP requests.

3
HttpSessionEvent
This class is used to handle the session events
4
HttpSessionBindingEvent
When a listener is bound to a value.

PART-B
1 Explain the Architecture of servlet with example program.
2 Explain about  life cycle of servlet with example program.
3. Explain servlet API
4 How to handle Http get request in servlet?Explain with example.
5. How to handle Http post request in servlet?Explain with example.
6 a)What is the difference between CGI and servlet
        b) What is the difference between servlet and JSP?
7 How to handle cookies with servlet?Explain with example.
8 How to handle session tracking with servlet?Explain with example.
9 What is JDBC ? Explain the JDBC architecture.
10 What is multi-tier application?Develop a multi-tier application for library management system.
UNIT – V
PART-A

Draw the diagram for TCP/IP stack.
Application layer
(http,ftp,telnet)
Transport layer
(TCP,UDP)
Network layer
(IP)

Data link layer
(Device driver,Ethernet)

Define Internet protocol(IP):
Internet protocol is a major protocol in the TCP/IP suit.
It is a connectionless ,unreliable protocol which supports the transfer of data in the form of packets.
The addressing scheme used in IP is by means of IP  addresses.An IP address is a 32 bit unique number.IP addressesare generally written as four numbers,between 0 and 255,separated by period.Using the IP address defined in IP packet header ,the IP packets can be routed to its destination.

Why Internet protocol is called as connectionless protocol?
                 Internet protocol(IP)  is called connectionless  protocol because it does not exchange any control  information before transmitting any data.The data is just sent to the destination with a hope that it will reach at appropriate place.


Why Internet protocol is called as unreliable protocol?
       IP is known as an unreliable protocol because it does not have the provision of retransmitting the lost packets or detect the corrupted data.

Define TCP
TCP is a Transmission control protocol.
It is a connection-oriented,reliable protocol which supports the transfer of data in continuous streams.
The addressing scheme used in TCP is by means of ports.On separate ports the communication can be established concurrently by the system.During this communication, the server waits for the client to get connected to a specific port for establishing communication.This type of communication is called as socket programming.

Define Socket programming:
           The addressing scheme used in TCP is by means of ports.On separate ports the communication can be established concurrently by the system.During this communication, the server waits for the client to get connected to a specific port for establishing communication.This type of communication is called as socket programming.

 What is reserved port?
             There are some ports which are reserved for specific service.These ports are called as reserved ports.Various port numbers specifying their services are given in the following table:

Port number
Service
21
FTP
23
Telnet
25
SMTP
80
HTTP
110
POP3

Why TCP is called as connection-oriented  protocol?
            TCP is called as connection-oriented protocol because control information is sent before transmitting any data.This process is sometimes called as handshaking.

Why  TCP is called as reliable protocol?
            TCP is a reliable protocol because any data which when gets lost or corrupted,the TCP has a provision to retransmit it.Because of these characteristics,TCP is used by most internet applications.However,TCP requires a lot of overhead while coding it.

What is the difference between IP and TCP?

sno
IP
TCP
1
It is a connectionless protocol
It is a connection-oriented protocol
2
It is a unreliable protocol
It is a reliable  protocol.
3
It transfers the data in the form of packets.
It  transfers the data in the form of Continuous stream
4
The addressing scheme
Used in IP is by means of IP addresses
The addressing scheme used in TCP is by means of ports
Define UDP
UDP is a User Datagram Protocol
The User Datagram  Protocol is a low-overhead protocol which can be used as an alternative to TCP protocol.
The UDP is a connectionless,unreliable protocol in which the data is passed in the form of datagrams.
The addressing scheme used in UDP is by means of ports.On separate ports the communication can be established concurrently by the system.UDP ports are distinct from the TCP port.

Why UDP  is called as connectionless  protocol?
This is called connectionless protocol because it does not exchange any control information before transmitting any data.The data is just sent to the destination with a hope that it  will reach at appropriate place.

Why UDP is called as unreliable protocol?
             UDP is known as an unreliable protocol because it does not have the provision of retransmitting the lost datagram or detect the corrupted data.

What is the difference between UDP and TCP?

SNO
TCP
UDP
1
TCP stands for Transmission
Control Protocol
UDP stands for User
Datagram Protocol
2
It is a connection-oriented protocol with acknowledgement.When a file or message send it will get delivered unless connections fails.If connection lost,the server will request the lost part.Hence it is called reliable protocol.
It is a connectionless protocol without any acknowledgement.When  you send a data or message,you don’t know if it’ll get there, it could get lost on the way.hence it is called unreliable protocol.
3
The message will get transferred in an orderly manner.
The message transfer have no order.
4
It is slower than UDP
It is faster protocol
5
When the low level parts of the TCP stream arrive in the wrong order respond requests have to be sent and all the out of sequence parts have to be put back together ,so this  protocol is called heavyweight protocol
No ordering of messages no tracking connections.Hence UDP is called lightweight protocol.
6
Examples: Email,FTP Secure Shell protoccolmakes use of TCP.
Exmple:Streaming media applications such as movies,Voice Over IP(VOIP),online multiplayer games makes use of UDP.

Define Socket:-
A socket is basically an endpoint of a two-way communication link between two programs running on the network.
Typically these programs are server program and client program.
Thus socket is OS-Controlled interface into which the applications can send or receive messages to  and fro from another application.
A socket is bound to a port number so that the TCP/UDP from transport layer  can identify the corresponding application at destination.

Name the two types of sockets:-

TCP sockets:- Which are denoted by streams
UDP sockets which are denoted by datagrams.

What are the protocols used by Java mail API ?

SMTP(Simple Mail Transfer Protocol)
POP3(post office Protocol)
IMAP(Internet Message Access Protocol)
MIME
Define Protocol handler
        Protocol handler can be defined as a collection of classes which know how to handle protocols.

What are the issues handled by protocol handler?
Generating client request to the server in the correct format
When we obtain some data from the server then along with the data header part comes-which should interpreted in correct manner.
On recipient of data acknowledging that the data has been received.

Define content handler
The content handler in java are simply the .class files
The items which get displayed by your browser are referred as contents.
Each time when browser wants to handle different contents corresponding plug-ins are used.These plug-ins that are required to handle various contents on web browser are called content-handlers.

PART-B
1 Compare and contrast the TCP and UDP
2 What do you mean by sockets?What are the basic types of sockets used for the communication between client and the server?
3. Discuss in brief the client-server communication.
4 Write short note on E-mail client.
5. Implement the SMTP program using JavaMail API
6 Implement the POP3 program using JavaMail API
7 What is protocol handler?Explain various issues that are to be handled by the protocol handler.
8 Explain the working of protocol handler.
9 What is content handler? How to obtain content handler in Java?