🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: JDBC: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. Which JDBC object holds the rows returned by a SELECT?
  2. Q2. Why is PreparedStatement safer than building SQL with string concatenation?
  3. Q3. Which method should you call for an UPDATE statement?
  4. Q4. In TransferDemo, why are both balances unchanged after the failed transfer?
  5. Q5. What is the first column index in a JDBC ResultSet?
  6. Q6. Why should a Connection be opened in try-with-resources?
  7. Q7. What does executeUpdate() return for an UPDATE statement?
  8. Q8. Which pair of calls makes several statements all-or-nothing?
  9. Q9. What is the main reason real apps use a connection pool such as HikariCP?
  10. Q10. A user types ' OR '1'='1 into an email box. With a PreparedStatement using ?, what happens?