JDBC MCQ

Below JDBC quiz are Multiple Choice Questions (MCQs) type Quiz. These JDBC MCQ Questions helps you to refresh your JDBC, you can see the correct option by clicking on it. .
  • 1. When the message "No Suitable Driver" occurs?

    • When the driver is not registered by Class.forname() method
    • When the JDBC database URL passed is not constructed properly
    • When the type 4 driver is used
    • When the user name, password and the database does not match
  • 2. Which type of Statement can execute parameterized queries?

    • PreparedStatement
    • ParameterizedStatement
    • ParameterizedStatement and CallableStatement
    • All kinds of Statements (i.e. which implement a sub interface of Statement)
  • 3. What must be the first characters of a database URL?

    • db,
    • db:
    • jdbc,
    • jdbc:
  • 4. Which of the following is efficient than a statement due to the pre-compilation of SQL?

    • Statement
    • PreparedStatement
    • CallableStatement
    • None of the above
  • 5. What is the correct order to close database resources?

    • Connection then Statement then ResultSet
    • ResultSet then Statement then Connection
    • Statement then Connection then ResultSet
    • Statement then ResultSet then Connection
  • 6. What is the correct sequence to create a database connection?

    • i, ii, iii, v, iv, vii, viii, vi
    • i, iii, ii, v, iv, vii, vi, viii
    • ii, i, iii, iv, viii, vii, v, vi
    • i, iii, ii, iv, v, vi, vii, viii
  • 7. Which of these obtains a Connection?

    • Connection.getConnection(url)
    • Driver.getConnection(url)
    • DriverManager.getConnection(url)
    • new Connection(url)
  • 8. Parameterized queries can be executed by?

    • ParameterizedStatement
    • PreparedStatement
    • CallableStatement and Parameterized Statement
    • All kinds of Statements
  • 9. Which of the following is not a valid statement in JDBC?

    • Statement
    • PreparedStatement
    • QueryStatement
    • CallableStatement
  • 10. Stored procedure can be called by using the ????..?

    • CallableStatement
    • Statement
    • CalledStatement
    • PreparedStatement
  • 11. How can you retrieve information from a ResultSet?

    • By invoking the method get(…, String type) on the ResultSet, where type is the database type
    • By invoking the method get(…, Type type) on the ResultSet, where Type is an object which represents a database type
    • By invoking the method getValue(…), and cast the result to the desired Java type.
    • By invoking the special getter methods on the ResultSet: getString(…), getInt (…), getDouble(…),…
  • 12. The ……………… object provides you with methods to access data from the table.

    • ResultSet
    • Parametrized
    • TableStatement
    • Condition
  • 13. In type-1 driver database is _______ and platform is _______.

    • dependent, dependent
    • independent, dependent
    • dependent, independent
    • independent, independent
  • 14. JDBC API supports____________ and __________ architecture model for accessing the database.

    • Two-tier
    • Three-tier
    • Both a and b
    • Only b