NEW
Font size
WorksheetsJDBC
Total questions: 20
Worksheet time: 15mins
Which driver is efficient and always preferable for using JDBC applications?
Type-4
Type-3
Type-2
Type-1
Which JDBC driver Type(s) is(are) the JDBC-ODBC bridge?
Type 1
Type 2
Type 3
Type 4
Which packages contain the JDBC classes?
java.jdbc and javax.jdbc
java.jdbc and java.jdbc.sql
java.sql and javax.sql
java.rdb and javax.rdb
Which type of Statement can execute parameterized queries?
PreparedStatement
ParameterizedStatement
ParameterizedStatement and CallableStatement
All kinds of Statements (i.e. which implement a sub interface of Statement)
How can you retrieve information from a ResultSet?
By invoking the method get(…, String type) on the ResultSet, where type is the database type
By invoking the method get(…, Type type) on the ResultSet, where Type is an object which represents a database type
By invoking the method getValue(…), and cast the result to the desired Java type.
By invoking the special getter methods on the ResultSet: getString(…), getInt (…), getDouble(…),…
How can you execute a stored procedure in the database?
Call method execute() on a CallableStatement object
Call method executeProcedure() on a Statement object
Call method execute() on a StoredProcedure object
Call method run() on a ProcedureCommand object
Which method is used to perform DML statements in JDBC?
execute()
executeQuery()
executeUpdate()
executeResult()
Which of the following is correct about PreparedStatement?
Prepared statements offer better performance, as they are pre-compiled.
Prepared statements reuse the same execution plan for different arguments rather than creating a new execution plan every time.
Prepared statements use bind arguments, which are sent to the database engine.
All of the above.
In order to transfer data between a database and an application written in the Java programming language, the JDBC API provides which of these methods?
Methods on the ResultSet class for retrieving SQL SELECT results as Java types.
Methods on the PreparedStatement class for sending Java types as SQL statement parameters.
Methods on the CallableStatement class for retrieving SQL OUT parameters as Java types.
All mentioned above
The performance of the application will be faster if you use PreparedStatement interface because query is compiled only once.
True
False
Which method is used to establish the connection with the specified url in a Driver Manager class?
public static void registerDriver(Driver driver)
public static void deregisterDriver(Driver driver)
public static Connection getConnection(String url)
public static Connection getConnection(String url,String userName,String password)
Which driver Network connection is indirect that a JDBC client makes to a middleware process that acts as a bridge to the DBMS server?
JDBC-Net
JDBC-ODBC bridge
Native API as basis
Native protocol as basis
Which is used to call the stored procedures and functions?
CallableStatement Interface
PreparedStatement Interface
All the above
None of the above
What is used to execute parameterized query?
Statement interface
PreparedStatement interface
ResultSet interface
None of the above
ODBC stands for?
Open database connection
Open database concept
Open database communications
None of the above
Which models do the JDBC API support for the database access?
Two-tier models
Three-tier models
Both A & B
None of the above
Which of the following is used to rollback a JDBC transaction?
rollback()
rollforward()
deleteTransaction()
RemoveTransaction()
The method on the result set that tests whether or not there remains at least one unfetched tuple in the result set, is said to be
Fetch method
Current method
Next method
Access method
Which method is used to perform DML statements in JDBC?
execute()
executeQuery()
executeUpdate()
executeResult()
Which of the following describes the correct sequence of the steps involved in making a connection with a database.
1. Loading the driver
2. Process the results.
3. Making the connection with the database.
4. Executing the SQL statements.
1 ,3,4,2
1,2,3,4
1,4,3,2
1,2,4,3
