dhanalakshmi college of engineering chennai … · browser what to do. this javascript statement...
TRANSCRIPT
1
CSE CS6501 INTERNET PROGRAMMING
DHANALAKSHMI COLLEGE OF ENGINEERING
CHENNAI
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS6501 INTERNET PROGRAMMING
ACADEMIC YEAR 2015-2016
2 MARKS QUESTIONS WITH ANSWERS
PREPARED BY,
K.REVATHY, AP/CSE
2
CSE CS6501 INTERNET PROGRAMMING
UNIT-I
JAVA PROGRAMMING
1. What are the OOP principles? [2 Marks]
The OOP principles are:
Objects
Classes
Data abstraction and encapsulation
Inheritance
Polymorphism
Dynamic binding
Message passing
2. List out the features of java language? [2 Marks]
The features of java language are:
Platform Independence
Object Oriented
Compiler/Interpreter Combo
Robust
Automatic Memory Management
Security
Dynamic Binding
3. Define – Class and Object (N/D -10) [2 Marks] Class is defined as a template for a set of objects that share a common structure and a common
behaviour. Object is an instance of a class. It has state, behaviour and identity. It is also called as an instance
of a class.
4. What is meant by instance? (M/J -12) [2 Marks] An instance has state, behaviour and identity. The structure and behaviour of similar classes are
defined in their common class. An instance is also called as an object.
5. Define − Inheritance (M/J -12) [2 Marks] Inheritance is defined as a relationship among classes, wherein one class shares the structure or
behaviour defined in another class. This is called Single Inheritance. If a class shares the structure or
behaviour from multiple classes, then it is called Multiple Inheritance. Inheritance defines “is-a” hierarchy
among classes in which one subclass inherits from one or more generalised super classes.
6. Define – Polymorphism Polymorphism literally means taking more than one form. Polymorphism is defined as characteristic
of being able to assign a different behaviour or value in a subclass, to something that was declared in a
parent class.
3
CSE CS6501 INTERNET PROGRAMMING
7. What is meant by interface? (N/D-10) (N/D- 11) (N/D-12) [2 Marks] Interface is similar to a class which may contain methods signature only but not bodies and it is a
formal set of method and constant declarations that must be defined by the class that implements it.
8. What are the different states of a thread? (N/D -10) [2 Marks]
The different states of a thread are
New
Runnable
Waiting
TimedWaiting
Terminated
9. List out the motivation needed in generic programming. (N/D- 11) [2 Marks] The motivation needed in generic programming are :
To motivate generic methods, that contains three overloaded print Array methods
This methods print the string representations of the elements of an integer array, double array and
character array
Choose to use arrays of type Integer, double and character to setup our generic methods
10. What are the uses are of assert keyword? (M/J- 11) (N/D- 11) [2 Marks] Java assertion feature allows developer to put assert statements in Java source code to help unit testing and
debugging. Assert keyword validates certain expressions. It replaces the if block effectively and throws an
Assertion Error on failure.
11. What is meant by adapter class?
Adapter class is one which contains null body definition for the methods which are inheriting from
appropriate listener.
An adapter class provides the default implementation of all methods in an event listener interface.
Adapter classes are very useful when you want to process only few of the events that are handled by a
particular event listener interface. Define a new class by extending one of the adapter classes and implement
only those events relevant.
12. What is meant by synchronization and why is it important? (N/D -10) [2 Marks]
Synchronization is the capability to control the access of multiple threads to share resources without
synchronization, it is possible for one thread to modify a share, the object while another thread is in the
process of using of updating that object value this often leads to significant errors.
13. How is throw exception created in exception handling? (N/D- 11) [2 Marks] Throw method is used to throw an exception manually. It has to declare the exceptions thrown in the
method signature and then include a throw statement in the method
throw new ExceptionName (“Value”);
4
CSE CS6501 INTERNET PROGRAMMING
14. Define − Reflection (M/J -12) [2 Marks]
Reflection is defined as
Reflection is defined as the ability of the software to analyze itself at runtime.
Reflection is provided by the java.lang.reflect package and elements in class.
This mechanism is helpful to tool builders, not application programmers.
15. What are the purposes of the finally clause of a try−catch−finally statement?
The finally clause of the try-catch-finally statements is always executed unless the thread of execution
terminates or an exception occurs within the execution of the finally clause.
16. Define – Exception (M/J- 12) [2 Marks]
Exception is defined an event, which occurs during the execution of a program that disrupts
the normal flow of the program instructions.
17.What is meant by checked and unchecked exception? [2 Marks] All predefined exceptions in java are either checked exception or an unchecked exception checked
exception must be caught using try() and catch() block.
18. What is meant by runtime exception? [2 Marks]
Runtime exception are all grouped together under a single base class called Runtime Exception .It
establishes a family of types that have some characteristics and behaviors in common.
19. Differentiate error from exception. [2 Marks]
An Error indicates that a non-recoverable condition has occurred that should not be caught .Error is a
subclass of throwable is intended for drastic problem, such as OutOfMemoryError,an exception is an event,
which occurs during the execution of a program ,that disrupts the normal flow of the program.
20. What are the classes of exceptions caught by a catch clause? [2 Marks] A Throwble class is a super class .It includes all the classes whatever is covered from catch class.
21. How is custom exception created? [2 Marks]
By extending the exception class or one of its subclasses
Example
Class MyException extends Exception
{
Public MyException(){super();}
Public MyException(String s){super(s);}
}
22. What are the different ways to handle exceptions? [2 Marks]
There are two ways to handle Exceptions
Wrapping the desire code in a try block followed by a catch block to catch the exception
List the desired exception in the throws clause of the method and let the caller of the method handle
those exceptions.
5
CSE CS6501 INTERNET PROGRAMMING
23. What is meant by multithreading? (M/J- 12) [2 Marks] Multithreading extends the idea of multitasking into applications where you can subdivide specific
operations within a single application into individual threads. Each of the threads can run in parallel. The OS
divides processing time not only among different applications, but also among each thread within an
application.
24. What is meant by daemon thread? Which method is used to create the daemon thread? [2 Marks] A daemon thread is a thread that does not prevent the JVM from exiting when the program finishes
but the thread is still running. An example for a daemon thread is the garbage collection.You can use the
setDaemon() method to change the Thread daemon properties.
25. What method must be implemented by all threads? [2 Marks] All tasks must implement the run() method, whether they are a subclass of thread or implement the
runnable interface.
26. What is the algorithm used in thread scheduling? [2 Marks] Execution of multiple threads on a single CPU in some order is called scheduling. The Java runtime
environment supports a very simple, deterministic scheduling algorithm called fixed-priority scheduling.
This algorithm schedules threads on the basis of their priority relative to other Runnable threads.
27. What are the different identifier states of a thread? [2 Marks] The different identifiers of a thread are: R - Running or runnable thread S - Suspended threads CW -
Thread waiting on a condition variable MW - Thread waiting on a monitor lock MS - Thread suspended
waiting on a monitor lock
UNIT II
WEBSITES BASICS, HTML 5, CSS 3, WEB 2.0 8 Web 2.0
1. What are Style Sheets? [2 Marks]
A style sheet provides a great deal of control over the presentation of a document.
2. Mention the need for cascading style sheets. [A/M-11] [2 Marks]
Need for CSS
-Allow the information in the document to be presented without change in a variety of ways
-Relatively easy to give all of the elements on a page consistent appearance
-Both the document author and the person viewing the document can specify aspect of the
document style as it is displayed by the browser
3. What are external style sheets? [2 Marks]
The style sheets which has been stored in separate files and included in an HTML documents
through the use of a link element are known as external style sheets.
6
CSE CS6501 INTERNET PROGRAMMING
4. What are embedded style sheets? [2 Marks]
A style sheet that is included in the content of a style element is known as an embedded style sheet.
5. What are the two methods of implementing style sheets? [2 Marks]
The two methods of implementing styles to HTML elements are
1] Rule Cascading
2] Inheritance
6. What is the syntax of CSS rule? [A/M-12][N/D-11] [2 Marks]
A CSS rule has two main parts: a selector, and one or more declarations: The selector is
normally the HTML element you want to style. Each declaration consists of a property and a value.
The property is the style attribute you want to change. Each property has a value.
TEXT PROPERTIES:
1. Explain Normal Flow Box Layout. [2 Marks]
It is a browser’s standard rendering model [normal flow processing], where every HTML element
rendered by the browser has a corresponding regular box that contains the rendered content of the
element.
2. What is the use of list style property? [2 Marks]
The list-style-type property can be used to vary the default styles used for bulleted and numbered
list items. It can be applied to the li, ol, ul element types
3. Write the expansion for the following? i] ECMA ii] CSS iii] XHTML iv]XML [2 Marks]
ECMA- European Computer Manufacturers Association
CSS- Cascading Style Sheets
XHTML- Extended Hyper Text Markup Language
XML- Extensible Markup Language
4. What are the types of positioning? [2 Marks]
The types of positioning are:
Normal flow positioning
Relative positioning
Absolute positioning
Float positioning
7
CSE CS6501 INTERNET PROGRAMMING
5. Define - Font family? [2 Marks]
Font family is a collection of related fonts, and a font is a mapping from a character [Unicode
Standard code point] to a visual representation of the character [a glyph].
CLIENT-SIDE PROGRAMMING:
1. What are Interpreted languages? [2 Marks]
Programming languages that does not need to be compiled before execution are known as interpreted
languages.
2. What are native objects? [2 Marks]
A built-in object is a native object that is automatically constructed during scripting engine
initialization rather than being constructed during program execution. E.g. window
3. What is a Javascript statement? Give an example. [NOV/DEC2011] [2 Marks]
A JavaScript statement is a command to a browser. The purpose of the command is to tell the
browser what to do. This JavaScript statement tells the browser to write "Hello Dolly" to the web page:
document.write["Hello Dolly"];
It is normal to add a semicolon at the end of each executable statement. Most people think this is a
good programming practice, and most often you will see this in JavaScript examples on the web.
4. What do you mean by global object? [2 Marks]
Global object is named window as global variables declared by your program are actually stored as
properties of this object. All built-in and host objects are also stored as properties of global object
5. List out some of the built-in objects of JavaScript? [2 Marks]
Built-in objects of JavaScript are STRING, NUMBER, BOOLEAN, DATE,MATH, REGEXP.
6. What are the six JavaScript data types? [2 Marks]
The JavaScript data types are:
Number
String
Boolean
Null
Object
Undefined
7. What are the three types of statements in JavaScript?
8
CSE CS6501 INTERNET PROGRAMMING
Expression statement: that consists entirely of an expression Block statement: that consists of set of
statements enclosed in braces { }
Keyword statement: that begin with keywords such as var, if, for etc
8. What are Servlets? [2 Marks]
A small program that runs on a server, the term usually refers to a Java applet that runs within a Web
server environment. This is analogous to a Java applet that runs within a Web browser environment.
Java servlets are becoming increasingly popular as an alternative to CGI programs. The biggest
difference between the two is that a Java applet is persistent. This means that once it is started, it stays in
memory and can fulfill multiple requests. In contrast, a CGI program disappears once it has fulfilled a
request. The persistence of Java applets makes them faster because there’s no wasted time in setting up and
tearing down the process.
9. What is API -Application Program Interface? [2 Marks]
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.
UNIT III
CLIENT SIDE AND SERVER SIDE PROGRAMMING 11 Java Script
1. What is Event listener in DOM? [N/D-12][2 marks]
An event listener is a function that takes a single argument that is an instance of Event. A call to the
addEventListener [] method on a node object associates an event listener with a type of event occurring on
that node.
2. What is DOM? [2 marks]
DOM [Document Object Model] is an API that defines how JavaScript programs can access and
manipulate the HTML document currently displayed by a browser. It includes the definition of the
properties of document object, many of which are themselves objects with their own properties.
9
CSE CS6501 INTERNET PROGRAMMING
3. List out some properties of the document object. [2 marks]
The properties of document object are
DOCTYPE, TITLE, BODY, COOKIE, URL, DOMAIN, REFERRER,
CREATEELEMENT[STRING], CREATETEXTNODE[STRING],
GETELEMENTBYID[STRING], GETELEMENTBYTAGNAME[STRING]
4. What is Node object? [2 marks]
Every element in a document tree refers to a Node object. Some nodes of the tree are
JavaScript objects corresponding to HTML elements such html or body.
5. List out the properties of a Node object. [2 marks]
Properties of a Node object are
nodeType
nodeName
parentNode
childNodes
previousSibling
nextSibling
attributes
6. What do you mean by document node? [2 marks]
The document object itself is considered to be DOM tree node with node type 9 and symbolic
constant DOCUMENT_NODE and it has its own properties and methods
7. What are the 2 traditional ways of assigning event handlers in DOM [2 marks]
Via HTML, using attributes
Via scripting
8. How to change an HTML Element with the help of DOM. [2 marks]
The following example changes the background colour of the <body> element:
<html>
<body>
10
CSE CS6501 INTERNET PROGRAMMING
<script type="text/javascript">
document.body.bgColor="lavender";
</script>
</body>
</html>
9. What are the types of nodes in DOM Tree? [2 marks]
Element nodes, as we've seen, correspond to individual tags or tag pairs in the HTML code. They
can have child nodes, which may be other elements or text nodes.
Text nodes represent content, or character data. They will have a parent node and possibly sibling
nodes, but they cannot have child nodes.
Attribute nodes are a special case. They are not considered a part of the document tree - they do not
have a parent, children or siblings. Instead, they are used to allow access to an element node's
attributes.
10. What is Window Object in DOM [2 marks]
The window object represents an open window in a browser.If a document contain frames
[<frame> or <iframe> tags], the browser creates one window object for the HTML document, and
one additional window object for each frame.some of the window object properties are:
closed
document
frames
history
EVENT HANDLING
1. List out some of the HTML intrinsic event attributes. [A/M -11] [2 marks]
onload, onclick, ondblclick, onmousedown, onmouseup, onmousemove, onfocus, onblur,
onkeypress, onkeydown, onselect, onchange, onsubmit, onreset etc.
11
CSE CS6501 INTERNET PROGRAMMING
2. What is Event Listener? [2 marks]
An Event Listener is simply a function that takes a single argument that is an instance of an
Event. A call to the addEventListener[] method on a node object associates an event listener with a
type of event occurring on that node.
3. What are the types of Events? [2 marks]
HTML intrinsic events
HTML Events
UI Events
Mutation Events
4. What do you mean by bubbling listener? [2 marks]
Bubbling listener is a listener associated with an ancestor of the target node and that was
created with a call to addEventListener[] and had its third argument set to false
e.g.ancestor.addEventListener.
SERVER SIDE PROGRAMMING
1. Define − Servlet [2 marks]
A servlet is a java class that a web server instantiates when the server is started. A particular
method is called in this instance when the server receives certain HTTP requests.
2. What are servlet life cycle methods? [2 marks]
The methods of servlet life cycle are
INIT[], SERVICE[] AND DESTROY[]
3. What are servlet listener classes? [2 marks]
Listener classes is used to initialize a web application consisting of multiple servlets rather
than a single servlet and can be created and registered with the server so that they will be called
when certain event occurs, including life-cycle events.
4. What are the functions of doGet[] and doPost[] methods? [2 marks]
doGet[]-Browser will append the query string it constructs to the form’s action URL and
performs an HTTP GET using the resulting URL.
DOPOST[] – Same query string will be constructed , but it will be passed to the server via
the body of the HTTP request rather than as part of the URL.
12
CSE CS6501 INTERNET PROGRAMMING
5. What is the important feature of dynamic positioning? [A/M- 08] [2 marks]
Dynamic positioning allows you to tell the browser exactly where to put a block of content
without using tables.
6. List the possible opacity attributes of dynamic positioning. [A/M -08] [2 marks] HTML: The basic building block.
Document Object Model: The objects that make up the contents of any Web page.
JavaScript: A scripting language that can manipulate the within the document
7. Define ─ Session [2 marks]
Collection of HTTP requests, all associated with a single session ID, is known as a session.
Sessions are maintained by communication between clients and servers.
8. How the session is terminated? [2 marks]
By default the time interval for a session is 20 minutes.
The session can also be forced to terminate by calling invalidate[] method.
The time interval for the session can be set using setMaxInactiveInterval[] method.
9. Define ─ Cookie [2 marks]
A cookie is a name-value pair that a web server sends to a client machine as part of an HTTP
response, specifically through the Set-cookie header field.
10. Write the code to return the full URL of a document. [N/D-11] [2 marks] <html>
<head>
<title>Javascript get url</title>
</head>
<body>
<script>
document.write[document.location.href]
</script>
</body>
</html>
11. How is session tracking achieved by URL rewriting? [N/D-11] [2 marks]
In URL rewriting the server passes a session ID by adding it to every servlet URL appearing
in any page sent to the client. It involves rewriting every URL referencing the servlet in the href
attribute of any anchor and the action attribute of any form output by the servlet.
12. List out the methods of HTTP. [2 marks]
13
CSE CS6501 INTERNET PROGRAMMING
doGet[]
doPost[]
doOptions[]
doPut[]
doTrace[]
doDelete[]
doHead[]
UNIT IV
PHP and XML 8 An introduction to PHP
XML
1. How is XML parsing done with SAX? [N/D-11][2 Marks]
A SAX parser is a mechanism for transforming an XML text document into stream of events
corresponding to the markup and character data contained in the original document.
2. What is the purpose of XSLT? [N/D-11][2 Marks]
The XSLT stands for XSL Transformations and XSL stands for eXtensible Stylesheet Language.
The XSLT is used for defining the XML document transformation and presentations.
3. Define ─XML namespace [A/M-11][N/D-12][2 Marks]
An XML namespace is a collection of element and attribute names. Each namespace has a unique
name that provides a means for document authors to unambiguously refer to elements with the same
name in order to prevent collisions.
4. What does XSLT mean? [2 Marks]
XSLT stands for extensible style sheet language for transformation. The Cascading Style Sheets
[CSS], a mechanism used to define various properties of markup elements. The original document is not
changed, rather a new document is created based on the content of an existing one.
5. What is an XPATH? [N/D-12][2 Marks]
XPath, the XML Path Language, is a query language for selecting nodes from anXML document. In
addition, XPath may be used to compute values [e.g., strings, numbers, or Boolean values] from the
content of an XML document. XPath was defined by the World Wide Web Consortium [W3C].
14
CSE CS6501 INTERNET PROGRAMMING
6. What is well-formed document? [2 Marks]
An HTML or XML document is said to be well formed when it contains elements with proper
tagging and no syntactic errors.XML is a tool used to generate markup languages in general rather than a
specific markup language. Thus, rather than pre-defining a set of tags, XML defines a methodology for
tag creation. Once defined, tags are mixed with plain text in order to form an XML document.
7. What is DTD? [2 Marks]
A Document Type Declaration enables an XML parser to verify whether an XML document is valid,
i.e. its elements contain the proper attributes in the proper sequence. A DTD defines the document
structure with a list of legal elements and attributes. A document type definition [DTD] is a set
of markup declarations that define a document type for an SGML-family markup
language [SGML, XML, HTML].
8. What is the use of XML declaration? [2 Marks]
XML declaration is a special tag used to specify the version of XML used to write the document and
optionally some additional meta-information about the document such as the character set/encoding
used. For e.g the syntax of XML declaration is
<? XML VERSION=”1.0”?>
9. What is RSS? [2 Marks]
RSS stands for RDF [Resource Description Framework] Site Summary and is also known as Rich
Site Summary and Really Simple Syndication. RSS is popular and simple XML format designed to share
headlines and web content between Web sites.
10. What are the types of XML Parsers? [2 Marks]
There are two types
Validating Parsers
Non-Validating Parsers
11. What are the components of XSL? [2 Marks]
XSLT-XSL Transformations which defines the semantics of the various elements and attributes
of the XSL namespace.
XPATH – XML Path Language which defines the syntax and semantics of many of the attribute
values used in XSL elements for accessing positions of the input XML document
XSL-FO – XSL Formatting Objects is a separate vocabulary for defining style properties of an
XML document.
12. Define ─ XML schema [2 Marks] XML Schemas are part of the XML vocabulary and its addresses the standard for XML document
validation by including a definition of a collection of standard data types which are used to describe data
structures.
15
CSE CS6501 INTERNET PROGRAMMING
13. What are XML Parsers? [2 Marks]
XML Parsers are used to check whether the document is well formed and valid. Software that reads
an XML document, identifies all the XML tags and passes the data to the application. An XML Parser is
a parser that is designed to read XML and create a way for programs to use XML.
14. Write the expansion for the following. i] XSL ii] JAXP III] CGI iv] JSP [2 Marks]
1. JAXP – Sun Java SPI for XML Processing
2. XSL - Extensible Style Sheet Language
3. CGI – Common Gateway Interface
4. JSP – Java Server Pages
15. Define ─Deployment Descriptor [2 Marks]
Deployment descriptor which is stored in a file called web.xml. The deployment descriptor specifies
various configuration parameters such as the name used to invoke the servlet [i.e. its alias], a description
of the servlet, the servlets fully qualified class name and a servlet mapping [i.e., the path or paths that
cause the servlet container to invoke the servlet].
JSP TECHNOLOGY
1. Give the advantages of using JSP for server side programming. [M/J-12][2 Marks]
The advantages of using JSP for server side programming are
1. JSP are translated and compiled into JAVA servlets but are easier to develop than JAVA servlets.
2. JSP have all advantages of Java i.e write once run anywhere.
3. JSP uses simplified scripting language based syntax for embedding HTML into JSP.
4. JSP containers provide easy way for accessing standard objects and actions.
5. JSP use HTTP as default request /response communication paradigm and thus make JSP ideal as
Web Enabling Technology.
2. Define ─ JSP [2 Marks]
JSP is defined as an extension of servlet technology simplifies the delivery of dynamic web
content. They enable web application programmers to create dynamic content by reusing predefined
components and by interacting with components using server side scripting. JSP programmers can
reuse JavaBeans and create custom tag libraries that encapsulate complex, dynamic functionality.
3. Write some commonly used video file formats. [A/M-08] [2 Marks]
1. .wmv
2. .mov
3. .mpg
4. .avi
16
CSE CS6501 INTERNET PROGRAMMING
5. MPEG2
4. What is WAR file? [ 2 Marks]
A Web application has a well-known directory structure in which all the files are part of the
application reside. This directory structure can be created by the server administrator in the webapps
directory, or the entire directory structure can be archived in a Web Application Archive file. Such
an archive is known as a WAR file and ends with the .war file extension. If a WAR file is placed in
the webapps directory, then when the Tomcat server begins execution, it extracts the contents of the
WAR file into the appropriate webapps subdirectory structure.
5. Explain in brief about Javascriplet [2 Marks]
JSP Scriptlets or scripting elements, enable programmers to insert Java code that interacts
with components in a JSP and possible other Web application components to perform request
processing.
6. What are the types of directives in JSP. [A/M-08] [2 Marks] There are two types of directives in JSP
1. page: Multiple page attributes can be included in a single page directive using the
standard XML syntax of separating attribute specification with white space
2. include: It imports text from another file into the JSP document at the point at which the
directive appears.
7. What are JSP Standard Actions? [2 Marks]
JSP standard actions provide JSP implementers with access to several of the most common
tasks performed in a JSP, such as including content from other resources, forwarding requests to
other resources and interacting with JavaBeans. JSP containers process actions at request time.
Actions are delimited by <jsp:action> and </jsp:action>, where action is the standard action name.
8. What are directives? [2 Marks]
Directives are messages to the JSP container that enable the programmer to specify page
settings, to include content from other resources and to specify custom tag libraries for use in a JSP.
Directives delimited by <%@ and %> are processed at translation time. Thus directives do not
produce any immediate output, because they are produced before the JSP accepts any requests. There
are two directive types namely page directive and include directive.
9. What is page Directive? [2 Marks]
The page Directive specifies global settings for the JSP in the JSP container. There can be
many page directives, provided that there is only one occurrence of each attribute. The only
17
CSE CS6501 INTERNET PROGRAMMING
exception to this is the import attribute, which can be used repeatedly to import Java packages used
in the JSP.
10. What is the use of <jsp: useBean> Action? [2 Marks]
Action <jsp: useBean> enables a JSP to manipulate a Java object. This action creates a Java
object or locates an existing object for use in the JSP. If attributes class and beanName are not
specified, the JSP container attempts to locate an existing object of the type specified in attribute
type.
11. What is include Directive? [2 Marks]
The include directive includes the content of another resource once, at JSP translation time.
The include directive has only one attribute, file–that specifies the URL of the resource to include.
The difference between directive include and action <jsp: include> is noticeable only if the included
content changes.
12. Define ─ JavaBeans Technology [2 Marks]
Java beans technology is defined as a simple mechanism to call java methods from within a
JSP document.JSP provides such a mechanism through its support for JavaBeans classes. If a java
class is written so as to conform with certain aspects of the JavaBeans Specification, the certain
methods of this class can be called from a JSP document.
13. What are the components of Model View Controller Paradigm? [2 Marks]
1. Model: These are software components that represent the persistent data of the
application and server-side processing performed on this data.
2. View: This component generally obtain data from the request and/or model components
and then generate an HTTP response that presents a formatted view of this data.
3. Controller: This component receives all incoming HTTP requests and provides a single
point of entry to the application and does application-wide tasks such as initialization,
logging, and controlling access to the application.
CASE STUDY
1. What is JSTL? [2 Marks]
JavaServer Pages [JSP] technology provides a simplified, fast way to create dynamic web
content. JSP technology enables rapid development of web-based applications that are server- and
platform-independent.
18
CSE CS6501 INTERNET PROGRAMMING
2. List out the core tag in JSTL. [2 Marks]
1. set-Assign a value to a scoped variable
2. remove-Destroy a Scoped variable
3. url-Create a URL with query string
4. forEach-Iterate over a collection of items
3. Define ─ PHP: Hypertext Preprocessor [2 Marks]
PHP is a Perl-like scripting language that can be embedded in HTML documents much as
Java Scriplets can be embedded in JSP pages or scripting code in ASP. The syntax<?php…?> can be
used to embed PHP code which means that an XML parser will interpret the tags as XML processing
instructions with target php.
4. Define ─ Cold Fusion [2 Marks]
Cold Fusion is defined as the technology for embedding program logic in HTML documents.
All program logic is embedded as XML elements, so a Cold Fusion document is XML compatible. A
ColdFusion document may also contain expressions enclosed in # characters, which are evaluated
when a ColdFusion document is requested and replaced with the values obtained.
UNIT V
INTRODUCTION TO AJAX and WEB SERVICES 9 AJAX
SOAP
1. What is SOAP? [Simple Object Access Protocol] [2 marks]
i. SOAP is an XML based protocol that allows applications to easily over the internet using XML
documents called AOAP message.
ii. A SOAP message contains an envelope, which is a structure that describes a method call.
iii. A SOAP message‘s body contains either a request or a response.
iv. A request message‘s body contains a Remote Procedure Call [RPC], which is a request for
anothermachine to perform task.
v. The RPC specifies the method to be invoked and any parameters the method takes.
vi. The application sends the SOAP message via an HTTP POST. A SOAP response message is an
HTTP response document that contains the results from the methods call [e.g. return values, error
messages.]
19
CSE CS6501 INTERNET PROGRAMMING
2. What is the use of Web Services? [2 marks]
i. Web services encompass a set of related standards that can enable two computer
ii. The data is passed back and forth using standard protocols such as HTTP, the same protocol used to
transfer ordinary web pages.
iii. Web services operate using open, text-based standards that enable components written in different
languages and on different platforms to communicate.
iv. They are ready to use pieces of software on the Internet. XML, SOAP, Web Services Description
Language [WSDL] and Universal Description, Discovery and Integration [UDDI] are the standards
on which web services rely.
v. UDDI is another XML based format that enables developers and business to publish and locate Web
services on a network.
3. What do you meant by JDBC? [2 marks]
JDBC Part of the Java Development Kit which defines an application-programming interface for
Java for standard SQL access to databases from Java programs.
4. Define – ODBC [2 marks]
ODBC is a standard for accessing different database systems. There are interfaces for Visual Basic,
Visual C++, SQL and the ODBC driver pack contains drivers for the Access, Paradox, dBase, Text,
Excel and Retrieve databases.
5. What is XML? [2 marks]
Extensible markup language offer a standard, flexible and inherently extensible data format, XML
significantly reduces the burden of deploying the many technologies needed to ensure the success of
Web services.
6. What is SOAP? [2 marks]
Service Oriented Architecture Protocol provides a standard, extensible, composable framework for
packaging and exchanging XML messages. In the context of this architecture, SOAP also provides a
convenient mechanism for referencing capabilities [typically by use of headers].
20
CSE CS6501 INTERNET PROGRAMMING
7. Explain DTD for XML Schemas [2 marks]
i. XML documents are processed by applications
ii. Applications have assumptions about XML documents
iii. DTDs allow to formalize some of these constraints
iv. Part of the constraint checking must still be programmed.
WEB SERVICES
8. Define - Web Service [2 marks]
A web service is a server application that uses HTTP to accept and return SOAP documents, where
the content of the documents is specified by a WSDL document that uses embedded XML Schema
markup to define data types.
9. Describe the implementation of Web Service. [2 marks]
A web service servlet accepts HTTP requests from clients and provides an HTTP response for each
request received. It expects that each HTTP request it receives will contain a SOAP XML document in
the body of the request. This SOAP document specifies an operation to be performed by the web service
and supplies input data for that operation.
10. Define - WSDL [2 marks]
A Web service definition language document for a web service identifies the operations provided by
the web service, what the input data to each operation is, and what output data is produced by the
operation.
11. What is known as the Service Endpoint Interface? [2 marks]
The starting point for writing a web service using the JWSDP 1.3 tools is writing a Java interface
that specifies the operations that will be provided by the service [essentially an API for the service].This
is known as the service endpoint interface.
12. Write the basic rules for service endpoint interface. [2 marks]
i. The interface must extend the java.rmi.Remote interface
ii. Every method in the interface must throw java.rmi.RemoteException
21
CSE CS6501 INTERNET PROGRAMMING
iii. Every method parameter and every return value must conform to certain restrictions on the
allowed data types
iv. The interface must not contain any public static final declarations.
XML SCHEMA
13. Define - XML Schema [2 marks]
XML schema defines the structure of XML documents. A key contribution of XML schema is its
definition of a collection of standard data types. Each data type definition includes a specification of the
range of values that can be represented by the data type and details on how to represent those values as
strings.
14. Define - Simple Object Access Protocol [2 marks]
SOAP is an XML vocabulary that can be used to communicate data and was originally designed for
communicating structured data that might be found in object-oriented programs.
15. What is RPC Representation? [2 marks]
RPC is the generic term for the type of communication used for web service operations.The client
makes a call to a method or procedure that resides on another machine.This concept has been
implemented in many ways by many programming languages and operating systems.
16. Define – Struct [2 marks]
A struct can be thought of as an instance of a class that consists entirely of public instance variables.
It is simply a container in which data can be stored in named variables.
17. What is literal-encoding? [2 marks]
An encoding conforming with the XML schema contained in the web service’s WSDL over SOAP
1.1 encoding of data.A literal encoding is indicated within a WSDL by specifying literal for the use
attribute of a soap:body element.
18. Name the two operations defined by WSDL 1.1. [2 marks]
i. RPC
22
CSE CS6501 INTERNET PROGRAMMING
ii. Document
19. Define – Serialization [2 marks]
The flexibility in converting from an internal form of data to a SOAP representation is known as
serialization and it comes at the price of forcing the software that deserializes a SOAP representation to
be prepared to accept SOAP documents in a variety of forms.
20. Describe - Java support for SOAP [2 marks]
Java provides support for creating and manipulating SOAP documents through SAAJ, the SOAP
with Attachments API for Java technology. This API is included with JWSDP1.3.
21. What are Serializable objects? [2 marks]
When an object is serialized, the data contained within the object is transformed into a stream of
bytes representing the data. This object data stream can then be stored in a file, transmitted over a
communications network, or treated like any other stream of data.
22. Name the methods of HttpServletRequest interface? [2 marks]
String getParameter[string name], string[] getParameterValues[String name],cookie[] getCookies[],
HttpSession getSession[boolen, create]
23. What are directives? [2 marks]
Directives are messages to the jsp container that enables the programmer to specify page settings, to
include content from other resources and to specify custom-tag libraries for use in
JSP.
24. Name the Header Child Element Attributes in SOAP? [2 marks]
i. must understand
ii. encoding style
iii. role
iv. relay
23
CSE CS6501 INTERNET PROGRAMMING
25. What is the use of JSP? [2 marks]
JSP enable web application programmers to create dynamic content by reusing predefined
components and by interacting with components using server side scripting.
26. Differentiate a Simple type with a Complex type. [2 marks]
A simple type is a data type whose values are represented in XML documents by character data,
while a complex type is represented using markup.
27. Define – CDATA [2 marks]
Character data[CDATA] is a text in a document that should not be parsed by the XML parser. Any
entities included in the CDATA block will not be replaced by their value and markup [such as HTML
tags] will not be treated as markup.
28. Describe the structure of SOAP element? [2 marks]
It consists of the following:
i. The SOAP envelope element
ii. The SOAP header element
iii. The SOAP body element
iv. The SOAP fault element
29. Define - JAX-RPC [2 marks]
JAX-RPC [Java API for XML-Based RPC] is an application program interface [API] in the Java
Web Services Developer Pack [WSDP] that enables Java developers to include remote procedure calls
[RPCs] with Web services or other Web-based applications. JAXRPC is aimed at making it easier for
applications or Web services to call other applications or Web services.
30. Define - SOAP Fault element? [2 marks]
The SOAP fault mechanism returns specific information about the error, including a predefined
code, a description, the address of the SOAP processor that generated
A SOAP Message can carry only one fault block
Fault element is an optional part of SOAP Message
24
CSE CS6501 INTERNET PROGRAMMING
SOAP fault is linked to the 500 to 599 range of status codes.
AJAX
31. What is Ajax?
Ajax is abbreviated as Asynchronous Javascript and XML. It is new technique used to create better, faster
and more interactive web systems or applications. Ajax uses asynchronous data transfer between the
Browser and the web server.
This technique is used to make internet faster and user friendly. It is not a programming language.
32.What are all the controls of Ajax?
Following are the controls of Ajax:
ScriptManager
ScriptManagerProxy
UpdatePanel
UpdateProgress
Timer
33. What is the name of the DLL that contains Ajax control tool kit?
Ajaxcontroltoolkit.dll is the DLL used for Ajax control tool kit and it can be downloaded from the internet.
It can be added in the tool box or copied directly in the bin folder.
34. What are the advantages of Ajax?
Following are the advantages of Ajax:
Bandwidth utilization – It saves memory when the data is fetched from the same page.
More interactive
Speeder retrieval of data
35. What are the disadvantages of Ajax?
Following are the disadvantages of Ajax:
1. AJAX is dependent on Javascript. If there is some Javascript problem with the browser or in the OS,
Ajax will not support
2. Ajax can be problematic in Search engines as it uses Javascript for most of its parts.
3. Source code written in AJAX is easily human readable. There will be some security issues in Ajax.
4. Debugging is difficult
25
CSE CS6501 INTERNET PROGRAMMING
5. Increases size of the requests
6. Slow and unreliable network connection.
7. Problem with browser back button when using AJAX enabled pages.