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

B - Driver

C - Connection

D - Transaction

Answer : D

Explanation

Transaction 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 type of JDBC driver, calls native code of the locally available ODBC driver?

A - JDBC-ODBC Bridge plus ODBC driver

B - Native-API, partly Java driver

C - JDBC-Net, pure Java driver

D - Native-protocol, pure Java driver

Answer : A

Explanation

JDBC-ODBC Bridge plus ODBC driver calls native code of the locally available ODBC driver.

Q 3 - Which of the following type of JDBC driver, calls database vendor native library on a client side. This code then talks to database over network?

A - JDBC-ODBC Bridge plus ODBC driver

B - Native-API, partly Java driver

C - JDBC-Net, pure Java driver

D - Native-protocol, pure Java driver

Answer : B

Explanation

Native-API, partly Java driver calls database vendor native library on a client side. This code then talks to database over network.

Q 4 - Which of the following type of JDBC driver is the fastest one?

A - Type 1

B - Type 2

C - Type 3

D - Type 4

Answer : D

Explanation

JDBC Net pure Java driver(Type 4) is the fastest driver because it converts the JDBC calls into vendor specific protocol calls and it directly interacts with the database.

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.

Answer : C

Explanation

A savepoint marks a point that the current transaction can roll back to. Instead of rolling all of its changes back, it can choose to roll back only some of them.

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

A - true

B - false

Answer : B

Explanation

No, it doesn't. An import statement tells the compiler which class to look for. Class.forName() instructs the Classclass to find a class-loader and load that particular Class object into the memory used by the JVM.

Answer : C

Explanation

PreparedStatement is used when you plan to use the SQL statements many times. The PreparedStatement interface accepts input parameters at runtime.

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

A - true

B - false

Answer : A

Explanation

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

Q 10 - New drivers can be plugged-in to the JDBC API without changing the client code.

A - true

B - false

Answer : A

Explanation

New drivers can be plugged-in to the JDBC API without changing the client code.


jdbc_questions_answers.htm

Advertisements