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 : C

Explanation

Statement encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.

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.

Q 3 - Which of the following type of JDBC driver should be used when you are accessing one type of database, such as Oracle, Sybase, or IBM?

A - Type 1

B - Type 2

C - Type 3

D - Type 4

Answer : D

Explanation

If you are accessing one type of database, such as Oracle, Sybase, or IBM, the preferred driver type is 4.

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.

Answer : C

Explanation

This method is used to register the database driver. This static method is used in case you are using a non-JDK compliant JVM, such as the one provided by Microsoft.

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

A - boolean execute()

B - ResultSet executeQuery()

C - int executeUpdate()

D - None of the above.

Answer : C

Explanation

int executeUpdate(): This is generally used for altering the databases. Generally DROP TABLE or DATABASE, INSERT into TABLE, UPDATE TABLE, DELETE from TABLE statements will be used in this. The output will be in the form of int which denotes the number of rows affected by the query.

Answer : C

Explanation

Database vendor's help multiple clients to share a cached set of connection objects that provides access to a database. Clients need not create a new connection everytime to interact with the database.

Answer : D

Explanation

A disconnected RowSet object is ad-hoc in nature. Whenever it requires retrieving data from the database, it establishes the connection and closes it upon finishing the required task. The data that is modified during disconnected state is updated after the connection is re-established.

Answer : C

Explanation

In typical database transactions, say one transaction reads and changes the value while the second transaction reads the value before committing or rolling back by the first transaction. This reading process is called as 'dirty read'. Because there is always a chance that the first transaction might rollback the change which causes the second transaction reads an invalid value.

Q 10 - Which of the following is a Metadata interfaces of JDBC?

A - DatabaseMetaData

B - ResultSetMetaData

C - Both of the above.

D - None of the above.

Answer : C

Explanation

JDBC API has two Metadata interfaces : DatabaseMetaData & ResultSetMetaData.

jdbc_questions_answers.htm
Advertisements