← 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?
- A.It encrypts the database
- B.Values are sent separately from the SQL, so input cannot change the query (no SQL injection)
- C.It runs without a connection
- 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 →