Aptitude Reasoning English GK Computer Knowledge Programming Skill Banking Software Testing



Question - 1

What is the correct sequence to create a database connection?

i. Import JDBC packages.

ii. Open a connection to the database.

iii. Load and register the JDBC driver.

iv. Execute the statement object and return a query resultset.

v. Create a statement object to perform a query.

vi. Close the resultset and statement objects.

vii. Process the resultset.

viii. Close the 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
Solutions
Question - 2

Parameterized queries can be executed by?

  • CallableStatement and Parameterized Statement
  • ParameterizedStatement
  • PreparedStatement
  • All kinds of Statements
Solutions
Question - 3

What is JDBC Savepoint?

  • An intermediate or checkpoint in a transaction
  • A point where we can store queries
  • A point where the JDBC application starts execution
  • A memory where we can store transaction
Solutions
Question - 4

Which of the following is the correct to register a JdbcOdbcDriver?

  • jdbc.odbc.JdbcOdbcDriver obj = new sun.jdbc.odbc.JdbcOdbcDriver();
  • odbc.JdbcOdbcDriver obj = new sun.odbc.JdbcOdbcDriver();
  • jdbc.JdbcOdbcDriver obj = new sun.jdbc.JdbcOdbcDriver();
  • jdbc.odbc.JdbcOdbc obj = new sun.jdbc.odbc.JdbcOdbc();
Solutions
Question - 5

Which statement is correct if we want to connect the Oracle database using the thin driver provided by Oracle Corp.?

  • getConnection("jdbc::thin@localhost:1521:oracle", "scott", "tiger");
  • getConnection("jdbc:thin@localhost:1521:oracle", "scott", "tiger");
  • getConnection("jdbc::thin@localhost:1522:oracle", "scott", "tiger");
  • getConnection("jdbc::oracle@localhost:1521:thin", "scott", "tiger");
Solutions
Question - 6

Which data type is used to store files in the database table?

  • BLOB
  • CLOB
  • File
  • Both a and b
Solutions
Question - 7

DatabaseMetaData interface is used to get?

  • Comprehensive information about the database as a whole.
  • Comprehensive information about the table as a whole.
  • Comprehensive information about the column as a whole.
  • Both b and c
Solutions
Question - 8

Are ResultSets updateable?

  • Yes, but only if we call the method openCursor() on the ResultSet and if the driver and database support this option.
  • Yes, but only if we indicate a concurrency strategy when executing the statement, and if the driver and database support this option.
  • Yes, but only if the ResultSet is an object of class UpdateableResultSet and if the driver and database support this option.
  • No, ResultSets are never updateable. We must explicitly execute a DML statement to change the data in the underlying database.
Solutions
Question - 9

Identify the DSN in the following statement:

  1. DriverManager.getConnection("jdbc:odbc:oradsn", "scott", "tiger")

  • jdbc
  • odbc
  • scott
  • oradsn
Solutions
Question - 10

How many ways to register a driver?

  • 2
  • 3
  • 4
  • 5
Solutions
Question - 11

Which of the following is the advantage of using PreparedStatement in Java?

  • Slow performance
  • Encourages SQL injection
  • Prevents SQL injection
  • More memory usage
Solutions
Question - 12

Which of the following is the advantage of using the JDBC connection pool?

  • Slow performance
  • Using more memory
  • Using less memory
  • Better performance
Solutions
Question - 13

Which one of the following contains date information?

  • java.sql.TimeStamp
  • java.sql.Time
  • java.io.Time
  • java.io.TimeStamp
Solutions
Question - 14

Which of the following is a method of the JDBC batch process?

  • setBatch()
  • deleteBatch()
  • removeBatch()
  • addBatch()
Solutions
Question - 15

Which JDBC type represents a "single-precision" floating-point number that supports seven digits of mantissa?

  • REAL
  • DOUBLE
  • FLOAT
  • INTEGER
Solutions
Question - 16

Which method is used for retrieving streams of both ASCII and Unicode characters is new in the JDBC 2.0 core API?

  • getCharacterStream
  • getBinaryStream
  • getAsciiStream
  • getUnicodeStream
Solutions
Question - 17

Which method Drops all changes made since the previous commit/rollback?

  • public void rollback()
  • public void commit()
  • public void close()
  • public Statement createStatement()
Solutions
Question - 18

Which Indicates a result set that cannot be updated programmatically in concurrency?

  • CONCUR_UPDATABLE
  • CONCUR_READ_ONLY
  • All of the above
  • None of the above
Solutions
Question - 19

Which driver Network connection is indirect that a JDBC client makes to a middleware process that acts as a bridge to the DBMS server?

  • JDBC-Net
  • Native protocol as basis
  • JDBC-ODBC bridge
  • Native API as basis
Solutions
Question - 20

Which interfaces provide methods for batch processing in JDBC?

  • java.sql.Statement
  • java.sql.PreparedStatement
  • All the above
  • None of these
Solutions
Tags:
60+ Best JDBC Interview Questions, JDBC MCQ questions for placement,JDBC interview questions, Previously asked JDBC Questions, Frequently asked JDBC Questions,JDBC Questions for TCS, JDBC Interview Questions for Freshers, JDBC Interview Questions for Experience, Accenture JDBC Interview Questions, JDBC Objective Questions for Interview


Practice More sets Questions