JDBC Online Quiz


Advertisements


Following quiz provides Multiple Choice Questions (MCQs) related to JDBC Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Answer : D

Explanation

ResultSet objects hold data retrieved from a database after you execute an SQL query using Statement objects. It acts as an iterator to allow you to move through its data. The java.sql.ResultSet interface represents the result set of a database query.

Q 2 - Which of the following manages a list of database drivers in JDBC?

A - DriverManager

B - JDBC driver

C - Connection

D - Statement

Answer : A

Explanation

DriverManager class manages a list of database drivers in JDBC.

Answer : B

Explanation

Native-API, partly Java driver, is also called Type2 JDBC driver.

Q 4 - Which of the following is not the standard isolation levels defined by JDBC?

A - TRANSACTION_NONE

B - TRANSACTION_REPEATABLE_READ

C - TRANSACTION_SERIALIZABLE

D - TRANSACTION_REPEATABLE_WRITE

Answer : C

Explanation

TRANSACTION_REPEATABLE_WRITE is not a standard isolation levels defined by JDBC.

Q 5 - Which of the following executes the any kind of SQL statement?

A - boolean execute()

B - ResultSet executeQuery()

C - int executeUpdate()

D - None of the above.

Answer : A

Explanation

boolean execute(): Executes the any kind of SQL statement.

Answer : C

Explanation

SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do. They simply alert the user that something did not happen as planned.

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

A - ResultSet

B - Statement

C - Connection

D - All of the above.

Answer : D

Explanation

You need to close the resultset, the statement and the connection. If the connection has come from a pool, closing it actually sends it back to the pool for reuse. We can do this in the finally{} block, such that if an exception is thrown, you still get the chance to close this.

Answer : C

Explanation

A connected RowSet Object is permanent in nature. It doesn't terminate until the application is terminated.

Answer : B

Explanation

Every vendor of Database provides implementation of ResultSet & other interfaces, through the Driver.

Q 10 - The JDBC API provides the abstraction and the JDBC drivers provide the implementation.

A - true

B - false

Answer : A

Explanation

The JDBC API provides the abstraction and the JDBC drivers provide the implementation.


jdbc_questions_answers.htm

Advertisements