JDBC Online Quiz


Advertisements


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.

Questions and Answers

Answer : C

Explanation

Statement encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed.

Q 2 - Which of the following holds data retrieved from a database after you execute an SQL query using Statement objects?

A - ResultSet

B - JDBC driver

C - Connection

D - Statement

Answer : A

Explanation

ResultSet holds data retrieved from a database after you execute an SQL query using Statement objects.

Answer : B

Explanation

Native-API, partly Java driver, is also called Type2 JDBC driver.

Q 4 - Which of the following is not a valid type of statement in JDBC?

A - Statement

B - PreparedStatement

C - CallableStatement

D - QueryStatement

Answer : D

Explanation

QueryStatement is not a valid type of statement in JDBC.

Q 5 - Which of the following is used generally for reading the content of the database?

A - boolean execute()

B - ResultSet executeQuery()

C - int executeUpdate()

D - None of the above.

Answer : B

Explanation

ResultSet executeQuery(): This is used generally for reading the content of the database. The output will be in the form of ResultSet. Generally SELECT statement is used.

Answer : C

Explanation

A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method.

Q 7 - When you say Class.forName() loads the driver class, does it mean it imports the driver class using import statement?

A - true

B - false

Answer : B

Explanation

No, it doesn't. An import statement tells the compiler which class to look for. Class.forName() instructs the Classclass to find a class-loader and load that particular Class object into the memory used by the JVM.

Answer : C

Explanation

setMaxRows(int) method of the ResultSet specifies how many rows a ResultSet can contain at a time. setMaxRows(int) affects the client side JDBC object.

Answer : D

Explanation

All of the above methods can be used to create a connection object.

Q 10 - The JDBC API provides the abstraction and the JDBC drivers provide the implementation.

A - true

B - false

Answer : A

Explanation

The JDBC API provides the abstraction and the JDBC drivers provide the implementation.


jdbc_questions_answers.htm

Advertisements