Advanced Java Programming (3160707) MCQs

MCQs of JDBC Programming

Showing 11 to 20 out of 45 Questions
11.
__________ Interface provides the programmatic approach to set the values in database.
(a) java.sql.Statement
(b) java.sql.PreparedStatement
(c) java.sql.CallableStatement
(d) java.sql.DbStatement
Answer:

Option (b)

12.
What happens if you call deleteRow() on a ResultSet object?
(a) The row you are positioned on is deleted from the ResultSet and from the database.
(b) The row you are positioned on is deleted from the ResultSet, but not from the database.
(c) The result depends on whether the property synchronised With DataSource is set to true or false
(d) You will get a compile error: the method does not exist because you cannot delete rows from a ResultSet
Answer:

Option (a)

13.
Which interface prevents SQL injection?
(a) Statement
(b) PreparedStatement
(c) CallableStatement
(d) All of these
Answer:

Option (b)

14.
What does setAutoCommit(false) do?
(a) commits transaction after each query
(b) explicitly commits transaction
(c) does not commit transaction automatically after each query
(d) never commits transaction
Answer:

Option (c)

15.
Which interface is used to call stored procedure?
(a) Statement
(b) PreparedStatement
(c) CallableStatement
(d) CallabledStatement
Answer:

Option (c)

16.
______ is method of JDBC batch process.
(a) removeBatch()
(b) addBatch()
(c) setBatch()
(d) deleteBatch()
Answer:

Option (b)

17.
Which of the following is not a JDBC connection isolation levels?
(a) TRANSACTION_NONE
(b) TRANSACTION_READ_COMMITTED
(c) TRANSACTION_REPEATABLE_READ
(d) TRANSACTION_NONREPEATABLE_READ
Answer:

Option (d)

18.
Which type of JDBC driver is the fastest one?
(a) Type-1
(b) Type-2
(c) Type-3
(d) Type-4
Answer:

Option (d)

19.
______ method dynamically loads the driver's class file into memory, which automatically registers it.
(a) Class.forName()
(b) DriverManager.registerDriver()
(c) Both A&B
(d) None of these
Answer:

Option (c)

20.
What causes "No suitable driver" error?
(a) Due to failing to load the appropriate JDBC drivers before calling the getConnection().
(b) it can be specifying an invalid JDBC URL, one that is not recognized by JDBC driver.
(c) This error can occur if one or more the shared libraries needed by the bridge cannot be loaded.
(d) All of these
Answer:

Option (d)

Showing 11 to 20 out of 45 Questions