25 January, 2014

CS506 Current Midterm Paper Fall 2013 File 13



1              whats the start do in applet cycle and when we use it
ans :
To start the applet's execution
• For example, when the applet's loaded or when the user revisits a page that contains the
applet
• start( ) is also called whenever the browser is maximized

2              .Write the syntax to load the oracle driver
ans:
Class.forName(“oracle.jdbc.driver.OracleDriver”);

3              what dose codes do

 ResultSet rs=TYPING_SCROLL_INSENSITIVE
ResultSet.TYPE_SCROLL_INSENSITIVE,

The following code fragment, illustrates how to make a ResultSet object that is scrollable and
updatable.
String sql = “SELECT * FROM Person”;
PreparedStatement pStmt = con.prepareStatement(sql,
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = pStmt.executeQuery( );
Two constants have been used of ResultSet class for producing a ResultSet rs that is
scrollable, will not show changes made by others and will be updatable

 4.            What DO MaxRows (int)    &  setMaxRows(int)   methods
• Used for determines the number of rows a ResultSet may contain
• By default, the number of rows are unlimited (return value is 0), or by using
setMaxRows(int), the number of rows can be specified.

5               write any five GUI based component
                1. BUTTON
                2. Label
                3. Text filed
                4.Text area

 6               define paint( ) in applet life cycle

• paint( ) is called for the first time when the applet becomes visible
• Whenever applet needs to be repainted, paint( ) is called again
• Do all your painting in paint( ), or in a method that is called from paint( )

 7.            what is and why we use : JDBC - ODBC Bridge

• Translates all JDBC calls into ODBC (Open Database Connectivity) calls and
send them to the ODBC Driver
• Generally used for Microsoft database.
• Performance is degraded

 8.            What is the difference b/w socket and server socket, also give a java syntax of socket and
Server socket. 5 mr

A socket is one endpoint of a two-way communication link between two programs
running generally on a network.

• A socket is a bi-directional communication channel between hosts. A computer on a
network often termed as host.
 
                The server listens through a special kind of socket, which is named as server socket.
• The sole purpose of the server socket is to listen for incoming request; it is not used
for communication

Syntex for socket
Socket s = new Socket(“serverName”, serverPort) ;

serverName: Name or address of the server you wanted to connect such as
http://www.google.com or 172.2.4.98 etc. For testing if you are running client and server
on the same machine then you can specify “localhost” as the name of server

• serverPort : Port number you want to connect to

Syntex for server socket

Create a Server Socket

In order to create a server socket, you will need to specify port no eventually on which server will listen for client requests.

ServerSocket ss = new ServerSocket(serverPort) ;

• serverPort: port local to the server i.e. a free port on the server machine. This is the same
port number that is given in the client socket constructor

 9              what is disadvantage of interfaces          

One disadvantage of interfaces is that one you publish them to other coders outside your own control, they represent a public commitment which can be difficult to change later. You don't know who else is using the interface and you don't know how, so you can't just add a new method to the interface without risking breaking the code of existing clients (if/when they upgrade). In comparison, if you'd used an abstract or concrete class, you could just add a new concrete method with no problems (usually).

It's possible to work around this b

No comments:

Post a Comment