JDBC MCQs
JDBC MCQs
JDBC MCQs
2.In which of the following type of ResultSet, the cursor can only move forward in
the result set?
A - ResultSet.TYPE_FORWARD_ONLY
B - ResultSet.TYPE_SCROLL_INSENSITIVE
C - ResultSet.TYPE_SCROLL_SENSITIVE
D - None of the above.
Ans A
11. How can you execute DML statements (i.e. insert, delete, update) in the database?
a. By making use of the InsertStatement, DeleteStatement or UpdateStatement classes
b. By invoking the execute(…) or executeUpdate(…) method of a normal Statement object
or a sub-interface object thereof
c. By invoking the executeInsert(…), executeDelete(…) or executeUpdate(…) methods of the
DataModificationStatement object
d. By making use of the execute(…) statement of the DataModificationStatement object
Ans: b
13. What statements are correct about JDBC transactions (2 correct answers)?
a. A transaction is a set of successfully executed statements in the database
b. A transaction is finished when commit() or rollback() is called on the Connection object,
c. A transaction is finished when commit() or rollback() is called on the Transaction object
d. A transaction is finished when close() is called on the Connection object.
Ans: d
14. The JDBC-ODBC Bridge supports multiple concurrent open statements per connection?
a. True
b. False
Ans: a
15. Which of the following statements is false as far as different type of statements is
concern in JDBC?
a. Regular Statement
b. Prepared Statement
c. Collable Statement
d. Interim Statement
Ans: d
16. Which of the following methods are needed for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B
d. getConnection()
Ans: c
17. Which statement is static and synchronized in JDBC API?
a. executeQuery()
b. executeUpdate()
c. getConnection()
d. prepareCall()
Ans: c
20. Which of the following methods finds the maximum number of connections that a
specific driver can obtain?
a. Database.getMaxConnections
b. Connection.getMaxConnections
c. DatabaseMetaData.getMaxConnections
d. ResultSetMetaData.getMaxConnections
Ans: c
25. ________ is an open source DBMS product that runs on UNIX, Linux and Windows.
A. MySQL
B. JSP/SQL
C. JDBC/SQL
D. Sun ACCESS
Ans: A
26.