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.661Easy

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

Q.662Easy

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

Q.663Medium

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

Q.664Medium

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

Q.665Medium

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

Q.666Medium

What does ResultSetMetaData.getColumnCount() return?

Q.667Medium

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

Q.668Medium

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

Q.669Medium

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

Q.670Medium

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

Q.671Hard

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

Q.672Hard

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

Q.673Hard

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

Q.674Hard

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

Q.675Hard

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

Q.676Easy

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

Q.677Easy

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

Q.678Easy

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

Q.679Easy

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

Q.680Medium

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