CS FundamentalsHardProduct-company security interview

How many of these defend against SQL injection in a login query: (1) parameterised queries / prepared statements, (2) escaping quotes by hand with string replace, (3) least-privilege database accounts, (4) hiding the database error messages from users, (5) allow-list validation of input such as a numeric id?

  1. A. 1
  2. B. 2
  3. C. 4
  4. D. 3

Correct answer: D. 3

Parameterisation is the primary defence; least privilege limits the damage; allow-list validation narrows the input. Hand-escaping is fragile and bypassable, and hiding errors only slows an attacker down without fixing the hole.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic