Sie sind auf Seite 1von 9

APRIL/MAY-2009

Ans:1 (A)
1. (c)
2. (b)
3. ()
4. (c)
Ans: 1(B)
Q- What is JDBC ?
JDBC is a technology that enables the java program to manipulate data stored into the database.

JDBC is Java application programming interface that allows the Java programmers to access
database management system from Java code. It was developed by Java Soft. It provides
interface between relational database and java programming. JDBC is part of java standard
edition J2SE,

JDBC is set of classes and interface, which are in java.sql package.

Q- What is difference between Applet and Servlet ?


Applet Servlet
1. The applet is client side programming. 1. Servlet is server side programming.

2. In case of applet the program is run 2. In case of Servlet the program will run
over the browser and result is sent to over the server & result will sent back
client. to client this will take less time to
execute a program.

3. Servlet does not have GUI interface


3. Applet has GUI interface.
4. Servlet is server .

5. With the help of server only we can run


4. Applet is browser embedded.
the Servlet program.

5. For Applet we need not any server.


6. Servlet is a part of Advance Java.

6. Applet is a part of Core JAVA.


7. Servlets do not require anything
specific at client side, as they require
java enabled web/application Server.
7. Applets can run under any web browser
their execution is dependent on Client
as they require JRE

Q-What is Cookies?
Cookies are small text files that are stored by an application server in the client browser to keep
track of all the users.

A cookie has values in the form of name/value pairs.

The client saves the cookies in the local hard disk and sends them along with the HTTP request
headers to the server.

Cookies can only be read by the application server that had written them in the client browser.

Cookies can be used by the server to find out the computer name, IP address or any other details
of the client computer by retrieving the remote host address of the client where the cookies are
stored.

Q-2
Ques-1: Differentiate between JSP and Servlet.

Servlet JSP
1. Servlets are pure java programs. 1-But in JSP we can use HTML and Java
code .
2- in jsp client side validation is not
possible.

3- bcoz while running JSP programs it


2. In Servlet client side validation is will be converted into Servlets and then
Possible executed, so it takes more time.
3. Servlets are faster than JSP 4- implicit object and action
elements available in jsp .
4. Implicit object and action elements are
not available in Servlet. 5- Jsp mainly used for the presentation
only. It support only Http.
5. Servlet support FTP, Http etc
Ques-2: Explain MVC (Model View Controller) Architecture.

Model–View–Controller (MVC) is an architectural pattern used in software engineering.

The MVC paradigm is a way of breaking an application, or even just a piece of an application's
interface, into three parts: the model, the view, and the controller

An MVC application may be a collection of model/view/controller triplets, each responsible for a


different UI element.

MVC is often seen in web applications where the view is the HTML or XHTML generated by
the app. The controller receives GET or POST input and decides what to do with it

Model: The model is used to manage information and notify observers when that information
changes. It contains only data and functionality that are related by a common purpose

View: The view or viewport is responsible for mapping graphics onto a device. A viewport
attaches to a model and renders its contents to the display surface.
Controller: Receives input and initiates a response by making calls on model objects.
A controller is the means by which the user interacts with the application. A controller accepts
input from the user and instructs the model and viewport to perform actions based on that input.

Q.3
Ques-1: Explain implicit objects in JSP.

There are several objects that are automatically available in JSP is called implicit object.

These are:

request

response

out

session

pagecontent

application

config

page

exception

Ques-2: What is difference between JDBC and ODBC?

JDBC ODBC
1. JDBC is java data base connectivity. 1. ODBC is open data base connectivity.

2. JDBC is for java application. 2. ODBC is for Microsoft.

3. JDBC drivers are written in java and JDBC 3. ODBC requires manual installation of the
code is automatically installable, secure, ODBC driver manager and driver on all
and portable on all platforms. client machines.
4. JDBC is Object-Oriented. 4. ODBC is procedural-oriented.

5. JDBC is used to provide connection 5. ODBC is used to provide connection


between JAVA and between front-end and back-end (weak
database(oracle,sybase,DB2). database like MS-ACCESS) .

Q-4
Ques-1: Differentiate between RMI Registry and OSAgent.
RMI Registry OSAgent

1. RMI Registry is a remote object 1. The OSAgent is a process that allows


registry started on the specified port CORBA servers to register their objects
default 1099 .It is a bootstrap naming and assists client applications in the
servise used by RMI servers on the location of objects.
same host to bind remote objects to
names.

Ques-2: State the techniques for Session Handling in Servlet.


Techniques for session Handling in Servlet are:
1: Cookies:
Cookies are small text files that are stored by an application server in the client browser to keep
track of all the users.
A cookie has values in the form of name/value pairs.
They are created by the server and are sent to the client with the HTTP response headers.
Cookies can only be read by the application server that had written them in the client browser.
Cookies can be used by the server to find out the computer name , IP address or any other
details of the client computer by retrieving the remote host address of the client where the
cookies are stored

2: URL rewriting:

URL rewriting is a session management techniques that manages user session by modifying a
URL.
Usually, this technique is used when information that is to be transferred is not very critical
because the URL can be intercepted easily during transfer.
For example, in an online shopping portal, servlet can modify a URL to include user information,
such as a username.

3: Hidden form fields:

Hidden form fields are used to maintain the session information of a user while the user interacts
with the web application.
A hidden form field is embedded in an HTML page and is not visible when viewed in a browser.

4: Servlet Session API:

You can use the classes and interfaces defined in the Servlet Session API to create and manage
user sessions.
Various interfaces provided by the Servlet Session API to create and manage user session are ,
javax.servlet.http.httpSession
javax.servlet.http.HttpSessionListener , and
javax.servlet.http.HttpSessionBindingListener
Q-5
Ques-1: Explain Design pattern.
Ques-2: Write difference between doGet and doPost.
doGet doPost
1. doGet() method is used to get 1. doPost( ) method is used for posting
information, information.

2. by doget() method client can send 2. but in case of dopost() method client
limited amount of data. can send unlimited data.

3. It allows bookmarks. 3. It disallows bookmarks.

4. In doGet() u submit the request by 4. in doPost() request is submitted via


appending the URL. form.

5. doGet(..) is used when the users tries to 5. doPost(..) method is generally used for
request for any Read Only data. Insertion /updation / deletion of data

Q-6
Ques: Explain Life cycle of Servlet.
The javax.servlet.Servlet interface defines the life cycle methods of the servlet such as

1. init()
2. service()
3. destroy().

Init():
1. The Web container invokes the init() method of the servlet instance during initialization
of the Servlet. The init() method is invoked only once in the servlet life cycle .

2. The init() method throws a ServletException if the Web container cannot initialize the
Servlet resources .

Service():
1. The Web container invokes the service() method to allow a servlet to process a client
request.

2. The service() method is invoked only after the initialization of the servlet is complete.

3. The service() method processes the request and returns the response back to the Web
container.

Destroy():
1. The Web container calls the destroy() method before removing the servlet instance from
the service.

2. The destroy() method is also invoked only once in the a servlet life cycle.

3. The destroy() method marks the end of the life cycle of a servlet.

Ques (or): Write difference between MVC1 and MVC2.


Features of MVC1:
1. Html or jsp files are used to code the presentation. To retrieve the data JavaBean can be
used.
2. In mvc1 archictecture all the view, control elements are implemented using Servlets or
Jsp.
3. In MVC1 there is tight coupling between page and model as data access is usually done
using Custom tag or through java bean call.
Features of MVC2:
1. The MVC2 architecture removes the page centric property of MVC1 architecture by
separating Presentation, control logic and the application state.
2. In MVC2 architecture there is only one controller which receives all the request for the
application and is responsible for taking appropriate action in response to each request.

Das könnte Ihnen auch gefallen