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.
Q 1 - Which of the following is not a component/class of JDBC API?
Transaction is not a class of JDBC API. JDBC API consists of following interfaces and classes: DriverManager, Driver, Connection, Statement, ResultSet, SQLException.
Q 2 - Which of the following holds data retrieved from a database after you execute an SQL query using Statement objects?
ResultSet holds data retrieved from a database after you execute an SQL query using Statement objects.
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?
If you are accessing one type of database, such as Oracle, Sybase, or IBM, the preferred driver type is 4.
Q 4 - Which of the following is not the standard isolation levels defined by JDBC?
TRANSACTION_REPEATABLE_WRITE is not a standard isolation levels defined by JDBC.
Q 5 - Which of the following is correct about PreparedStatement?
Prepared statements offer better performance, as they are pre-compiled. Prepared statements reuse the same execution plan for different arguments rather than creating a new execution plan every time. Prepared statements use bind arguments, which are sent to the database engine.
Q 6 - Which of the following is used generally used for altering the databases?
int executeUpdate(): This is generally used for altering the databases. Generally DROP TABLE or DATABASE, INSERT into TABLE, UPDATE TABLE, DELETE from TABLE statements will be used in this. The output will be in the form of int which denotes the number of rows affected by the query.
Q 7 - Which of the following is correct about connection pooling?
Database vendor's help multiple clients to share a cached set of connection objects that provides access to a database. Clients need not create a new connection everytime to interact with the database.
Q 8 - Which of the following is correct about Disconnected RowSet?
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. The data that is modified during disconnected state is updated after the connection is re-established.
Q 9 - Which isolation level prevents dirty read in JDBC, connection class?
TRANSACTION_READ_COMMITTED prevents dirty read in JDBC, connection class.
Q 10 - What does the Class.forName("MyClass") do?
Class.forName("MyClass") first loads the class MyClass then executes any static block code of MyClass and returns an instance of MyClass.