🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: JDBC: all 10 questions

Quiz: JDBC · Question 2 of 10

Why is PreparedStatement safer than building SQL with string concatenation?

Why is PreparedStatement safer than building SQL with string concatenation?

  1. A.It encrypts the database
  2. B.Values are sent separately from the SQL, so input cannot change the query (no SQL injection)
  3. C.It runs without a connection
  4. D.It removes the need for indexes
Answer & explanation

Correct answer: Values are sent separately from the SQL, so input cannot change the query (no SQL injection)

Placeholders keep data and SQL apart.

Can you get the rest right without peeking?

Take the timed Quiz: JDBC quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →