iGET

Java Programming - MCQ Practice Questions

Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

958 questions | 100% Free

Q.61Easy

What exception is thrown when a database connection fails in JDBC?

Q.62Easy

In JDBC, what does the executeQuery() method return?

Q.63Medium

What is the purpose of Connection.commit() in JDBC?

Q.64Medium

Which JDBC method executes UPDATE, INSERT, or DELETE statements?

Q.65Medium

What is the benefit of using PreparedStatement over Statement for repeated queries?

Q.66Medium

What does ResultSetMetaData.getColumnCount() return?

Q.67Medium

In JDBC, which class is used to retrieve database metadata information?

Q.68Medium

What is the difference between execute() and executeUpdate() methods?

Q.69Medium

Which statement should be used when you need to retrieve column information without executing multiple queries?

Q.70Medium

What happens if you call next() on a ResultSet after the last row?

Q.71Hard

Consider a scenario: A developer uses Statement with user input directly in SQL queries. What is the primary risk?

Q.72Hard

In a JDBC application, when using transactions with setAutoCommit(false), what happens to intermediate savepoints if rollback() is called?

Q.73Hard

Which JDBC feature should be used for executing multiple SQL statements in a batch for optimal performance?

Q.74Hard

In JDBC, what is the significance of setting FetchSize on a Statement when dealing with large ResultSets?

Q.75Hard

When using JDBC with Spring Framework in 2024-25, which approach is recommended for resource management?

Q.76Easy

Which interface in JDBC is used to execute parameterized queries and prevent SQL injection attacks?

Q.77Easy

What is the correct sequence to establish a JDBC connection in Java?

Q.78Easy

Which method of Connection interface is used to start a transaction in JDBC?

Q.79Easy

In JDBC, what does the BatchUpdate feature allow developers to do?

Q.80Medium

Which JDBC driver type is considered the most portable across different databases?

Java Programming MCQs – Free Practice Test | iGET | iGET