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

Explanation

JDBC stands for Java Database Connectivity.

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.

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 - The JDBC-ODBC Bridge support multiple concurrent open statements per connection.

A - true

B - false

Answer : B

Explanation

No. You can open only one Statement object per connection when you are using the JDBC-ODBC Bridge.

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

The JDBC driver converts the Java data type to the appropriate JDBC type before sending it to the database. It uses a default mapping for most data types. For example, a Java int is converted to an SQL INTEGER.

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

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

Explanation

In typical database transactions, say one transaction reads and changes the value while the second transaction reads the value before committing or rolling back by the first transaction. This reading process is called as 'dirty read'. Because there is always a chance that the first transaction might rollback the change which causes the second transaction reads an invalid value.

Q 10 - The JDBC API provides the abstraction and the JDBC drivers provide the implementation.

A - true

B - false

Answer : A

Explanation

The JDBC API provides the abstraction and the JDBC drivers provide the implementation.


jdbc_questions_answers.htm

Advertisements