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

Connection interface consists of methods for contacting a database. The connection object represents communication context.

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.

Q 3 - Which of the following type of JDBC driver should be used if your Java application is accessing multiple types of databases at the same time?

A - Type 1

B - Type 2

C - Type 3

D - Type 4

Answer : C

Explanation

If your Java application is accessing multiple types of databases at the same time, type 3 is the preferred 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.

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 7 - Out of String or a java.sql.Clob, which has best performance when used to manipulate data from database?

A - String

B - java.sql.Clob

Answer : B

Explanation

java.sql.Clob has better performance as it does not extract any data from the database until you explicitly ask it to.

Answer : C

Explanation

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

Answer : D

Explanation

Clean up the environment by closing all database resources relying on the JVM's garbage collection.

Answer : D

Explanation

Class.forName("MyClass") first loads the class MyClass then executes any static block code of MyClass and returns an instance of MyClass.


jdbc_questions_answers.htm

Advertisements