CS/IT MCQs

JDBC Interview Questions with Answers set-2

Google+ Pinterest LinkedIn Tumblr
Here is the collection of JDBC interview questions which include multiple-choice questions on the fundamentals of JDBC in Java. It includes interview questions on JDBC and ODBC driver, java.sql package, execute(), and executeQuery() method along with their answers.

1. A Java program cannot directly communicate with an ODBC driver because …….
A) ODBC has written in C language
B) ODBC has written in C# language
C) ODBC has written in C++ language
D) ODBC has 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()

Read Also: Solved MCQ of JDBC and JSP set-1

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()

Read Also: MCQ on Core Java with Answers set-1

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()

 Read Next: Solved MCQ of Java Beans set-1

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Write A Comment