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 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 when you are accessing one type of database, such as Oracle, Sybase, or IBM?

A - Type 1

B - Type 2

C - Type 3

D - Type 4

Answer : D

Explanation

If you are accessing one type of database, such as Oracle, Sybase, or IBM, the preferred driver type is 4.

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

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.

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

Answer : D

Explanation

The Java Naming and Directory Interface (JNDI) is an API to access different naming and directory services. You use it to access something stored in a directory or naming service without haveing to code specifically to that naming or directory service.


jdbc_questions_answers.htm

Advertisements