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

General JDBC Architecture consists of two layers: JDBC API (This provides the application-to-JDBC Manager connection) and JDBC Driver API (This supports the JDBC Manager-to-Driver Connection).

Q 2 - In which of the following type of ResultSet, the cursor can scroll forwards and backwards, and the result set is not sensitive to changes made by others to the database that occur after the result set was created.?

A - ResultSet.TYPE_FORWARD_ONLY

B - ResultSet.TYPE_SCROLL_INSENSITIVE

C - ResultSet.TYPE_SCROLL_SENSITIVE

D - None of the above.

Answer : B

Explanation

ResultSet.TYPE_SCROLL_INSENSITIVE: The cursor can scroll forwards and backwards, and the result set is not sensitive to changes made by others to the database that occur after the result set was created.

Q 3 - Which of the following type of JDBC driver, talks with the server-side middleware that then talks to database?

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

Explanation

JDBC-Net, pure Java driver, partly Java driver talks with the server-side middleware that then talks to database.

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.

Q 5 - Which of the following is efficient than statement due to pre-compilation of SQL?

A - Statement

B - PreparedStatement

C - CallableStatement

D - None of the above.

Answer : B

Explanation

PreparedStatement is efficient than statement due to pre-compilation of SQL.

Answer : D

Explanation

A transaction is a logical unit of work. To complete a logical unit of work, several actions may need to be taken against a database. Transactions are used to provide data integrity, correct application semantics, and a consistent view of data during concurrent access.

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

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

Answer : B

Explanation

Every vendor of Database provides implementation of ResultSet & other interfaces, through the Driver.

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