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 encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed?

A - DriverManager

B - JDBC driver

C - Connection

D - Statement

Answer : D

Explanation

Statement encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.

Answer : B

Explanation

Native-API, partly Java driver, is also called Type2 JDBC driver.

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

PreparedStatement allows mapping different requests with same prepared statement but different arguments to execute the same execution plan. Prepared statements are more secure because they use bind variables, which can prevent SQL injection attack.

Answer : C

Explanation

A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method.

Answer : C

Explanation

The ResultSet concurrency determines whether the ResultSet can be updated, or only read.

Answer : C

Explanation

setMaxRows(int) method of the ResultSet specifies how many rows a ResultSet can contain at a time. setMaxRows(int) affects the client side JDBC object.

Answer : D

Explanation

All of the above methods can be used to create a connection object.

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