Skip to content
Sharp

SQL for Java Devs · interview question

Why should you avoid concatenating user input directly into SQL queries?

Multiple choiceMediumchapter-8-curatedpremiumsql-for-java-devspreparedstatements
Choose one answer
Answer and explanation

Correct answer

D. It opens the application to SQL injection attacks.

Why

Concatenating user input directly into SQL queries makes the application vulnerable to SQL injection attacks, where malicious users can manipulate the query logic or access unauthorized data.

Test yourself on SQL for Java Devs

A free test with instant, explained results. No account needed.

Start free test
All SQL for Java Devs questions →