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

Q 1 - Which of the following is not a component/class of JDBC API?

A - Statement

B - ResultSet

C - SQLException

D - ConnectionPool

Answer : D

Explanation

ConnectionPool is not a class of JDBC API. JDBC API consists of following interfaces and classes: DriverManager, Driver, Connection, Statement, ResultSet, SQLException.

Q 2 - Which of the following consists of methods for contacting a database?

A - DriverManager

B - JDBC driver

C - Connection

D - Statement

Answer : C

Explanation

Connection consists of methods for contacting a database.

Answer : A

Explanation

JDBC-ODBC Bridge plus ODBC driver, is also called Type 1 JDBC driver.

Q 4 - Which of the following represents a regular SQL statement in JDBC?

A - Statement

B - PreparedStatement

C - CallableStatement

D - None of the above.

Answer : A

Explanation

Statement represents a regular SQL statement in 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.

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.

Q 7 - 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

Answer : A

Explanation

ResultSet.CONCUR_READ_ONLY :means that the ResultSet can only be read.

Answer : C

Explanation

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

Q 9 - Which isolation level prevents dirty read in JDBC, connection class?

A - TRANSACTION_READ_COMMITTED

B - TRANSACTION_NONE

C - TRANSACTION_READ_UNCOMMITTED

D - TRANSACTION_REPEATABLE_READ

Answer : A

Explanation

TRANSACTION_READ_COMMITTED prevents dirty read in JDBC, connection class.

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