JJDDBBCC MMOOCCKK TTEESSTT http://www.tutorialspoint.com Copyright © tutorialspoint.com

This section presents you various set of Mock Tests related to JDBC Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

JJDDBBCC MMOOCCKK TTEESSTT IIIIII

Q 1 - Which of the following is used generally used for altering the ?

A - boolean execute

B - ResultSet executeQuery

C - int executeUpdate

D - None of the above.

Q 2 - How does JDBC handle the data types of Java and ?

A - The JDBC driver converts the Java data type to the appropriate JDBC type before sending it to the database.

B - It uses a default mapping for most data types.

C - Both of the above.

D - None of the above.

Q 3 - Which of the following can cause 'No suitable driver' error?

A - Due to failing to load the appropriate JDBC drivers before calling the DriverManager.getConnection method.

B - It can be specifying an invalid JDBC URL, one that is not recognized by JDBC driver.

C - This error can occur if one or more the shared libraries needed by the bridge cannot be loaded.

D - All of the above.

Q 4 - Why will you set auto mode to false? A - To increase performance.

B - To maintain the integrity of business processes.

C - To use distributed transactions

D - All of the above.

Q 5 - Which of the following is correct about ?

A - A savepoint marks a point that the current transaction can roll back to.

B - Instead of rolling all of the changes back, a savepoint can be choosen to roll back only some of them.

C - Both of the above.

D - None of the above.

Q 6 - Which of the following is correct about SQL Warning?

A - SQLWarning objects are a subclass of SQLException that deal with database access warnings.

B - Warnings do not stop the execution of an application, as exceptions do.

C - Both of the above.

D - None of the above.

Q 7 - Which of the following is correct about SQL Warning?

A - A warning can be reported on a Connection object, a Statement object includingPreparedStatementandCallableStatementobjects, or a ResultSet object.

B - Connection, Statement and ResultSet has a getWarnings method.

C - Both of the above.

D - None of the above.

Q 8 - Which of the following is correct about batch process?

A - Batch Processing allows you to group related SQL statements into a batch.

B - Batch Processing allows you to submit batch of SQL statements with one call to the database.

C - Both of the above.

D - None of the above.

Q 9 - Which of the following is correct about stored procedures?

A - A is a group of SQL statements that form a logical unit and perform a particular task.

B - Stored procedures can be called using CallableStatement class in JDBC API.

C - Both of the above. D - None of the above.

Q 10 - Which of the following is correct about transactions in JDBC?

A - A transaction is a logical unit of work.

B - To complete a logical unit of work, several actions may need to be taken against a database.

C - Transactions are used to provide , correct application semantics, and a consistent of data during concurrent access.

D - All of the above.

Q 11 - Which of the following required to be closed to close database operations?

A - ResultSet

B - Statement

C - Connection

D - All of the above.

Q 12 - Which of the following is correct about connection pooling?

A - Connection Pooling is a technique used for reuse of physical connections and reduced overhead for your application.

B - Connection pooling functionality minimizes expensive operations in the creation and closing of sessions.

C - Both of the above.

D - None of the above.

Q 13 - Which of the following is correct about connection pooling?

A - Database vendor's help multiple clients to share a cached set of connection objects that provides access to a database.

B - Clients need not create a new connection everytime to interact with the database.

C - Both of the above.

D - None of the above.

Q 14 - Which of the following is correct about connection pooling?

A - Database vendor's help multiple clients to share a cached set of connection objects that provides access to a database.

B - Clients need not create a new connection everytime to interact with the database.

C - Both of the above.

D - None of the above. Q 15 - Which of the following is correct about connection pooling?

A - Application server like WebLogic, WebSphere, jBoss and Tomcat provides the facilities to configure connection pooling.

B - components like Apache Commons DBCP Component can be used to configure connection pooling.

C - Both of the above.

D - None of the above.

Q 16 - Out of byte[] or a java..Blob, which has best performance when used to manipulate data from database?

A - byte[]

B - java.sql.Blob

Q 17 - Out of String or a java.sql.Clob, which has best performance when used to manipulate data from database?

A - String

B - java.sql.Clob

Q 18 - When you say Class.forName loads the driver class, does it mean it imports the driver class using import statement?

A - true

B - false

Q 19 - Which of the following is true about attribute Concurrency in ResultSet?

A - The ResultSet concurrency determines whether the ResultSet can be updated.

B - The ResultSet concurrency determines whether the ResultSet can be read only.

C - Both of the above.

D - None of the above.

Q 20 - Which of the following means that the ResultSet can only be read?

A - ResultSet.CONCUR_READ_ONLY

B - ResultSet.CONCUR_UPDATABLE

C - ResultSet.READ_ONLY

D - ResultSet.UPDATABLE

Q 21 - Which of the following means that the ResultSet can be both read and updated?

A - ResultSet.CONCUR_READ_ONLY B - ResultSet.CONCUR_UPDATABLE

C - ResultSet.READ_ONLY

D - ResultSet.UPDATABLE

Q 22 - Which of the following is correct about setMaxRowsint?

A - setMaxRowsint method of the ResultSet specifies how many rows a ResultSet can contain at a time.

B - setMaxRowsint affects the client side JDBC object.

C - Both of the above.

D - None of the above.

Q 23 - Which of the following is correct about setFetchSizeint?

A - setFetchSizeint defines the number of rows that will be read from the database when the ResultSet needs more rows.

B - setFetchSizeint affects how the database returns the ResultSet data.

C - Both of the above.

D - None of the above.

Q 24 - Which of the following is correct about RowSet?

A - A JDBC RowSet object holds tabular data in a way that makes it more flexible and easier to use than a result set.

B - A RowSet objects are JavaBeans components.

C - Both of the above.

D - None of the above.

Q 25 - Which of the following is correct about Connected RowSet?

A - A connected RowSet Object is permanent in nature.

B - A connected RowSet doesn't terminate until the application is terminated.

C - Both of the above.

D - None of the above.

AANNSSWWEERR SSHHEEEETT

Question Number Answer Key

1 C

2 C

3 D 4 D

5 C

6 C

7 C

8 C

9 C

10 D

11 D

12 C

13 C

14 C

15 C

16 B

17 B

18 B

19 C

20 A

21 B

22 C

23 C

24 C

25 C

Loading [MathJax]/jax/output/HTML-CSS/jax.js