Java JDBC MCQs with answers Page - 3

Here, you will find a collection of MCQ questions on Java JDBC. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

S

Satya • 3.38K Points
Extraordinary

Q. Which method is used to close a JDBC connection?

  • (A) end()
  • (B) close()
  • (C) disconnect()
  • (D) terminate()

S

Satya • 3.38K Points
Extraordinary

Q. Which interface allows executing parameterized queries safely?

  • (A) Statement
  • (B) PreparedStatement
  • (C) CallableStatement
  • (D) ResultSet

S

Satya • 3.38K Points
Extraordinary

Q. Which method is used to set parameters in PreparedStatement?

  • (A) setValue()
  • (B) setData()
  • (C) setString() / setInt()
  • (D) setParameterValue()

S

Satya • 3.38K Points
Extraordinary

Q. What symbol is used as a placeholder in PreparedStatement?

  • (A) :
  • (B) ?
  • (C) #
  • (D) $

S

Satya • 3.38K Points
Extraordinary

Q. Which method executes any kind of SQL statement?

  • (A) execute()
  • (B) executeQuery()
  • (C) executeUpdate()
  • (D) runSQL()

S

Satya • 3.38K Points
Extraordinary

Q. Which object is used to retrieve metadata about the database?

  • (A) ResultSetMetaData
  • (B) DatabaseMetaData
  • (C) ConnectionMetaData
  • (D) DriverMetaData

S

Satya • 3.38K Points
Extraordinary

Q. Which object provides metadata about query result columns?

  • (A) DatabaseMetaData
  • (B) ResultSetMetaData
  • (C) StatementMetaData
  • (D) QueryMetaData

S

Satya • 3.38K Points
Extraordinary

Q. Which method returns the number of columns in a ResultSet?

  • (A) getColumnSize()
  • (B) getColumnCount()
  • (C) columnNumber()
  • (D) size()

S

Satya • 3.38K Points
Extraordinary

Q. Which method retrieves column name from ResultSetMetaData?

  • (A) getName()
  • (B) getColumnName()
  • (C) fetchName()
  • (D) readColumn()

S

Satya • 3.38K Points
Extraordinary

Q. Which JDBC component handles transaction management?

  • (A) Statement
  • (B) Connection
  • (C) ResultSet
  • (D) Driver

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ