A process allows you to group multiple SQL statements. Commit or Rollback can be performed on the group together. This process is known as:
Binding 0.0%
Synchronization 0.0%
Registry 16.0%
Transaction 83.0%
Late binding 0.0%
A user leaves an online shopping cart without checking out. Which of following interfaces will notify to Rollback the transaction?
HttpSession 0.0%
HttpSessionBindingListener 100.0%
HttpServlet 0.0%
SingleThreadModel 0.0%
FtpSession 0.0%
A warning can be thrown by a Connection object, a Statement object or a ResultSet object. Which method is used to retrieve the warning:
getWarnings() 100.0%
getWarned() 0.0%
getWarning() 0.0%
getError() 0.0%
getErrorsWarning() 0.0%
After executing the following code, resultvar contains false. What should the next step be? boolean resultvar=stmt.execute(sql);
stmt.getResultSet(); 0.0%
stmt.getUpdateCount(); 80.0%
stmt.executeUpdate(); 20.0%
stmt.executeQuery(); 0.0%
stmt.executeUpdateQuery(); 0.0%
Consider the following statement: PreparedStatement ps=con.prepareStatement("INSERT INTO ORDER (CUSTOMER_ID ,PRICE) VALUES(?,?)"); Which of the following should come after this statement?
ps.clearParameters(); ps.setInt(1,3); ps.setDouble(2,790.50); ps.executeUpdate(sql); 40.0%
ps.clearParameters(); ps.setInt(1,3); ps.setDouble(2,790.50); ps.executeUpdate(); 60.0%
ps.clear(); ps.setInt(1,3); ps.setDouble(2,790.50); ps.executeUpdate(sql); 0.0%
ps.clearParameters(); ps.setInt(1,3.09); ps.setDouble(2,790.50); ps.execute(sql); 0.0%
ps.clearParameters(); ps.setDouble(2,790.50); ps.execute(sql); 0.0%
How do you register a JDBC driver?
Class.forName("driver"); 80.0%
Class.newInstance("driver"); 20.0%
Class.driver("driver"); 0.0%
Class.getDriver("driver"); 0.0%
Class.postDriver("driver"); 0.0%
How will you create a new instance of a JDBC driver explicitly?
Class.forName("driver"); 20.0%
Class.newInstance("driver"); 0.0%
Class.driver("driver"); 0.0%
Class.getDriver("driver"); 0.0%
Class.forName("driver").newInstance(); 80.0%
Java Database Connectivity (JDBC) is a:
Database-dependent API 0.0%
Database-independent API 100.0%
Machine-dependent API 0.0%
Network-dependent database API 0.0%
JDBC is based on:
X/Open CLI (Call Level Interface) 100.0%
JDBC/Open CLI 0.0%
Java/Open CLI 0.0%
V/OPEN CLI 0.0%
X/Close CLI 0.0%
Name the interface you will use to retrieve the underlying structure of the query result:
ResultSet 0.0%
ResultSetMetaData 80.0%
ResultStructure 20.0%
Result 0.0%
ResultMetaData 0.0%
Open Database Connectivity is:
Platform independent 100.0%
Platform dependent 0.0%
Architecture neutral 0.0%
Network independent 0.0%
Machine independent 0.0%
Please select all the correct options. JDBC Driver Manager is:
Able to activate registered drivers 42.0%
Able to activate unregistered drivers 28.0%
Not required for activation of drivers with DataSource 14.0%
Required for activation of drivers with DataSource 14.0%
ResultSet objects follow index patterns of:
Array standard 50.0%
Java standard 25.0%
RDBMS standard 25.0%
C++ standard 0.0%
PL/SQL standard 0.0%
Servlet developers should avoid using JDBC-ODBC bridge driver because:
Drivers are bundled with JDK 0.0%
The driver's native code can crash the entire server 0.0%
The driver is not secure 0.0%
The driver is of Type-1 100.0%
The driver is of Type-2 0.0%
SQLException has a method, which provides the feature of chaining or encapsulation of additional Exception objects. Identify the method from the following:
getEncapsulatedException() 25.0%
getEncapException() 0.0%
getMessage() 0.0%
getNextException() 75.0%
getException() 0.0%
SQLWarning object deals with database access warnings. It is a subclass of:
SQLWarn 0.0%
SQLException 100.0%
SQLError 0.0%
SQLWarning 0.0%
SQLErrorsWarning 0.0%
The code segment below defines a query: String qry="SELECT CUS_NAME, PRICE FROM CUSTOMER"; Which of the following code snippets will create a scrollable ResultSet?
Statement st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet srs=st.executeQuery(qry); 100.0%
Statement st=con.createStatement(qry,ResultSet.CONCUR_READ_ONLY,ResultSet.TYPE_SCROLL_SENSITIVE); ResultSet srs=st.executeQuery(); 0.0%
Statement st=con.createStatement(qry,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet srs=st.executeQuery(); 0.0%
Statement st=con.createStatement(ResultSet.CONCUR_READ_ONLY,ResultSet.TYPE_SCROLL_SENSITIVE); ResultSet srs=st.executeQuery(qry); 0.0%
Transactions have a property called atomicity, which means:
Everything takes place one by one 0.0%
Everything takes place once 100.0%
Everything takes place randomly 0.0%
Everything takes place twice 0.0%
Everything takes place thrice 0.0%
Under which category does the following driver fall: WebLogic's Tengah "all Java Type-3 driver"
JDBC-ODBC Bridge Driver 0.0%
Native-API Partly-Java Driver 0.0%
Net-Protocol All-Java Driver 100.0%
Native-Protocol All-Java Driver 0.0%
Native-Protocol Part-Java Driver 0.0%
What should the syntax be to establish a connection with a Database?
Connection con = DriverManager.getConnection(url,"myLogin", "myPassword"); 100.0%
Connection con = DriverManager.getConnection("myLogin", "myPassword",url); 0.0%
Connection con = DriverManager.getConnection("myLogin", "myPassword"); 0.0%
Connection con = DriverManager.setConnection(url,"myLogin", "myPassword"); 0.0%
Connection con = DriverManager.createConnection(url,"myLogin", "myPassword"); 0.0%
When you are handling user-submitted SQL, you may retrieve a ResultSet or a count. Which of the following methods is handy in this situation?
executeQuery() 20.0%
exceuteUpdate() 0.0%
execute() 60.0%
executeQueryUpdate() 0.0%
update() 20.0%
Which exception will be thrown in your code, if the specified driver could not be loaded?
ActivationException 0.0%
ClassNotFoundException 100.0%
ClassNotAvailableException 0.0%
ClassUnavailableException 0.0%
InstantiationException 0.0%
Which JDBC driver is considered best in terms of performance and efficiency?
Type-1 Driver 50.0%
Type-2 Driver 0.0%
Type-3 Driver 0.0%
Type-4 Driver 50.0%
Which of the following is not true for a ResultSet?
JDBC 2.0 API supports Scrollable ResultSets 0.0%
ResultSet cursors are moved forward using next() method 0.0%
ResultSet cursors are moved backwards using previous() method 0.0%
Methods next() and previous() return -1 beyond the ResultSet 100.0%
Which of the following is not true?
CallableStatement is a subclass of PreparedStatement 0.0%
CallableStatement can take PreparedStatement as an input parameter 0.0%
CallableStatement can use executeUpdate() method 0.0%
CallableStatement can use execute() method 0.0%
CallableStatement cannot take INOUT parameters 100.0%
Which of the following is the syntax for creating a CallableStatement?
CallableStatement cs=con.prepareCall("{call SHOW_ORDER}") 100.0%
CallableStatement cs=con.prepareCall('{call SHOW_ORDER}') 0.0%
CallableStatement cs=con.prepareCall("(call SHOW_ORDER)") 0.0%
CallableStatement cs=con.prepareCall("call SHOW_ORDER") 0.0%
CallableStatement cs=prepareCall("call SHOW_ORDER") 0.0%
Which of the following JDBC methods is used for retrieving large binary objects?
getBinaryStream 100.0%
getText 0.0%
getAsciiStream 0.0%
getString 0.0%
getObjectStream 0.0%
Which of the following JDBC methods is used for retrieving large text strings?
getBinaryStream 0.0%
getText 0.0%
getAsciiStream 66.0%
getString 0.0%
getObjectStream 33.0%
Which of the following methods eliminates the need to call wasNull() method to handle null database fields?
getObject(); 50.0%
getInt(); 50.0%
getString(); 0.0%
getFloat(); 0.0%
getNull(); 0.0%
Which of the following methods will you use to execute INSERT, UPDATE and DELETE SQL statements?
executeQuery(); 0.0%
executeUpdate(); 100.0%
executeQueryUpdate(); 0.0%
update(); 0.0%
query(); 0.0%
Which type of statement object will you use to execute a stored procedure?
Statement 0.0%
PreparedStatement 0.0%
CallableStatement 100.0%
StoredStatement 0.0%
Stat 0.0%
Will the below script execute properly? 1.CREATE TABLE CUSTOMER 2.( 3.CUS_NAME VARCHAR(32), SUP_ID INTEGER, PRICE FLOAT, SALES INTEGER 4.)
Yes. The table will be created successfully. 100.0%
No. Line 3 should be modified to: VARCHAR(32) CUS_NAME,INTEGER SUP_ID ,FLOAT PRICE , INTEGER SALES 0.0%
No. Line 3 should be modified to: 'CUS_NAME VARCHAR(32)','SUP_ID INTEGER',' PRICE FLOAT', 'SALES INTEGER' 0.0%
No. Line 3 should be modified to: 'CUS_NAME' VARCHAR(32),'SUP_ID' INTEGER,'PRICE' FLOAT, 'SALES' INTEGER 0.0%
You are developing a shopping cart for your client. Where would you like to put your business logic?
Inside the database 0.0%
Inside the client application 0.0%
In middleware servlets 100.0%
In COM / DCOM components 0.0%
Inside the code for the cart 0.0%
You are trying to connect to a database through JDBC. There is a problem with one of the methods immediately after the driver has been loaded. Which exception will be thrown?
ClassNotFoundException 0.0%
SQLException 100.0%
SQLNotFoundException 0.0%
ActivationException 0.0%
JDBCException 0.0%
You executed a query to retrieve 40 products from the database and obtained a scrollable ResultSet named 'scrollrs'. You started scrolling the ResultSet as follows: scrollrs.next(); scrollrs.absol...
16 0.0%
24 100.0%
26 0.0%
17 0.0%
6 0.0%
You have obtained a ResultSet object named 'rs' after executing the following query: SELECT * FROM CUSTOMER Which loop can you use to return all the records in the ResultSet?
while(rs.next()) 100.0%
while(rs.hasNext()) 0.0%
while(true) 0.0%
while(rs.nextElement()) 0.0%
You have obtained a scrollable ResultSet named 'srs' by executing a query. Which of the following methods will you use to verify the position of the cursor?
srs.relative(-4) 0.0%
srs.relative() 0.0%
srs.absolute(-4) 0.0%
srs.getRow() 100.0%
srs.postRow() 0.0%
You have to handle an erroneous situation in a transaction. Which method comes handy in this case?
con.commit(false); 0.0%
con.commit(); 0.0%
con.rollback(); 100.0%
con.revertback(); 0.0%
con.rollback(true); 0.0%
You need to use a third party driver for establishing a connection with the database. The subprotocol is "webx" and the DSN is "webdsn". What is the syntax of the URL?
jdbc:odbc:webx:webdsn 0.0%
odbc:jdbc:webx:webdsn 0.0%
jdbc:webx:webdsn 50.0%
thin:jdbc:odbc:dsn:webdsn 0.0%
thick:jdbc:odbc:dsn:webdsn 0.0%
None of the above 50.0%
You want to execute a CallableStatement named 'cs'. It is expected to return multiples results. Which of the following methods will you choose?
ResultSet rs=cs.execute() 50.0%
ResultSet rs=cs.executeQuery() 50.0%
ResultSet rs=cs.executeUpdate() 0.0%
ResultSet rs=cs.executeQuery(sql) 0.0%
ResultSet rs=execute() 0.0%
You want to execute the following query string, using the connection named "con": String query = "SELECT * FROM CUSTOMER"; What should the syntax be?
Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); 100.0%
Statement stmt=new Statement(); ResultSet rs=stmt.executeQuery(query); 0.0%
Statement stmt=con.createStatement(); ResultSet rs=stmt.execute(query); 0.0%
Statement stmt=con.getStatement(); ResultSet rs=stmt.executeQuery(query); 0.0%
Statement stmt=con.getStatement(); ResultSet rs=con.executeQuery(query); 0.0%
You want to start a transaction for bank account processing. Which of the following methods will you execute on the Connection object to begin it?
con.setAutoCommit(false); 100.0%
con.setCommit(false); 0.0%
con.setAutoCommit(); 0.0%
con.setAutoCommit(true); 0.0%
con.autoCommit(); 0.0%
Your project leader has asked you to improve the performance of JDBC connectivity by reusing objects in your Servlet's code. Which of the following is an appropriate solution?
Reuse the database connection and reuse PreparedStatement objects 0.0%
Reuse the database connection and use PreparedStatement objects with synchronized blocks 100.0%
Reuse the database connection only 0.0%
Reuse the PreparedStatement objects only 0.0%
Reuse the GetPreparedStatement objects only 0.0%
Your project leader has given you a new task. You have to work on a module in which the transaction has to be extended across multiple page requests and multiple servlets. How will you implement this?
By synchronizing the doPost() method 0.0%
By creating a new connection for each transaction 0.0%
By session tracking and using HttpSession to hold a connection for each user 100.0%
By creating a single connection in the init() method and implementing SingleThreadModel 0.0%
By synchronizing doGet () 0.0%