Skip to content
Sharp

Engineering Interviews · interview question

Which of the following approaches is most secure when dynamically building SQL queries from user inputs?

Multiple choiceEasychapter-20-curatedpremiumengineering-interviewscode-review-spotting-bugs
Choose one answer
Answer and explanation

Correct answer

B. Using PreparedStatement with parameterized queries

Why

Using PreparedStatement with parameterized queries prevents SQL injection by separating SQL logic from data. This makes it difficult for attackers to manipulate the structure of the query.

Test yourself on Engineering Interviews

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

Start free test
All Engineering Interviews questions →