JDBC MCQ Interview Questions with Answers set-2


1. A Java program cannot directly communicate with an ODBC driver because .......
JDBC MCQ Interview Questions with Answers
ODBC Administrator (Photo credit: Wikipedia)

A) ODBC written in C language

B) ODBC written in C# language

C) ODBC written in C++ language

D) ODBC written in Basic language



2.The JDBC-ODBC Bridge driver translates the JDBC API to the ODBC API and used with .......


A) JDBC drivers

B) ODBC drivers

C) Both A and B

D) None of the above



3. The ............................. package contains classes that help in connecting to a database, sending SQL statements to the database, and processing the query results.

A) connection.sql

B) db.sql

C) pkg.sql

D) java.sql



4. The ................................ method executes a simple query and returns a single Result Set object.

A) executeUpdate()

B) executeQuery()

C) execute()

D) noexecute()



5. The ......................... method executes an SQL statement that may return multiple results.

A) executeUpdate()

B) executeQuery()

C) execute()

D) noexecute()




6. The ........................ object allows you to execute parametrized queries.

A) ResultSet

B) Parametrized

C) PreparedStatement

D) Condition



7. The .................. object provides you with methods to access data from the table.

A) ResultSet

B) Parametrized

C) TableStatement

D) Condition



8. The parameters of the PreparedStatement object are ...................... when the user clicks on the Query button.

A) initialized

B) started

C) paused

D) stopped



9. The ...................... method sets the query parameters of the PreparedStatement Object.

A) putString()

B) insertString()

C) setString()

D) setToString()



10. Connection object can be initialized using the ............................ method of the Driver Manager class.

A) putConnection()

B) setConnection()

C) Connection()

D) getConnetion()





Answers:



1. A Java program cannot directly communicate with an ODBC driver because .......

A) ODBC written in C language

2.The JDBC-ODBC Bridge driver translates the JDBC API to the ODBC API and used with .......

B) ODBC drivers

3. The ............................. package contains classes that help in connecting to a database, sending SQL statements to the database, and processing the query results.

D) java.sql

4. The ................................ method executes a simple query and returns a single Result Set object.

B) executeQuery()

5. The ......................... method executes an SQL statement that may return multiple results.

C) execute()

6. The ........................ object allows you to execute parametrized queries.

C) PreparedStatement

7. The .................. object provides you with methods to access data from the table.

A) ResultSet

8. The parameters of the PreparedStatement object are ...................... when the user clicks on the Query button.

A) initialized

9. The ...................... method sets the query parameters of the PreparedStatement Object.

C) setString()

10. Connection object can be initialized using the ............................ method of the Driver Manager class.

D) getConnetion()