Questions: Database Security

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

An application builds login queries by concatenating user input into SQL strings. A developer proposes fixing a SQL injection vulnerability by adding code that strips single quotes from all user inputs before concatenation. Is this an adequate fix?

AYes — removing single quotes makes it impossible to inject SQL syntax
BNo — string sanitization is fragile and error-prone; parameterized queries are the correct defense
CYes — if combined with input length limits and quote stripping, sanitization is sufficient
DNo — the real fix is to encrypt all user input before storing it in the database
Question 2 Multiple Choice

In which scenario does encryption at rest correctly provide protection?

APreventing a SQL injection attack that reads user passwords directly from the database via the application interface
BProtecting database contents if an attacker gains physical access to the server's storage media
CPreventing an attacker from intercepting query results traveling over the network
DRestricting which application users can read sensitive columns like salaries
Question 3 True / False

A database user who has been granted only SELECT permission on specific tables cannot issue DELETE statements on those tables, even if they are authenticated and connected to the database.

TTrue
FFalse
Question 4 True / False

Parameterized queries prevent SQL injection by sanitizing user input — detecting and escaping dangerous characters before they are inserted into the query string.

TTrue
FFalse
Question 5 Short Answer

Explain why parameterized queries solve SQL injection at a more fundamental level than string escaping, and why the distinction matters for security.

Think about your answer, then reveal below.