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

JDBC driver is an interface enabling a Java application to interact with a database. To connect with individual databases, JDBC requires drivers for each database. The JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database.

Q 2 - Which of the following gives out the connection to the database and implements the protocol for transferring the query and result between client and database?

A - DriverManager

B - JDBC driver

C - Connection

D - Statement

Answer : B

Explanation

JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database.

Q 3 - Which of the following type of JDBC driver should be used where a type 3 or type 4 driver is not available yet for your database?

A - Type 1

B - Type 2

C - Type 3

D - Type 4

Answer : B

Explanation

Type 2 drivers are useful in situations where a type 3 or type 4 driver is not available yet for your database.

Q 4 - Which of the following is not a valid type of statement in JDBC?

A - Statement

B - PreparedStatement

C - CallableStatement

D - QueryStatement

Answer : D

Explanation

QueryStatement is not a valid type of statement in JDBC.

Q 5 - Which of the following is used to call stored procedures on the database?

A - Statement

B - PreparedStatement

C - CallableStatement

D - None of the above.

Answer : C

Explanation

CallableStatement is used to call stored procedures on the database.

Answer : C

Explanation

Batch Processing allows you to group related SQL statements into a batch and submit them with one call to the database.

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

CallableStatement is used when you want to access the database stored procedures. The CallableStatement interface accepts input parameters at runtime.

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

A - true

B - false

Answer : A

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.

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