easymultiple choiceObjective-mapped

During testing, a login form returns all user records when the tester enters ' OR '1'='1 in a username field. What is the best fix for this issue?

Question 1easymultiple choice
Full question →

During testing, a login form returns all user records when the tester enters ' OR '1'='1 in a username field. What is the best fix for this issue?

Answer choices

Why each option matters

Good practice is not just finding the correct option. The wrong answers often show the exact trap the exam wants you to fall into.

A

Distractor review

Hide database error messages from the login page only

Suppressing errors may reduce information leakage, but it does not stop the injection flaw itself.

B

Best answer

Use parameterized queries or prepared statements

Parameterized queries separate user input from SQL commands, which prevents the database from treating input as executable code.

C

Distractor review

Require users to change passwords more often

Password changes do not address the underlying input validation and query construction problem.

D

Distractor review

Move the login page to a different URL

Changing the page location does not fix the vulnerable query logic behind the form.

Common exam trap

Common exam trap: answer the scenario, not the keyword

Many certification questions include familiar terms but test a specific constraint. Read the exact wording before choosing an answer that is generally true but wrong for this case.

Technical deep dive

How to think about this question

This question should be treated as a scenario, not a definition check. Identify the problem, the constraint and the best action. Then compare each option against those facts.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.
  • Use explanations to understand the rule behind the answer.

TExam Day Tips

  • Underline the problem statement mentally.
  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Related practice questions

Related SY0-701 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

More questions from this exam

Keep practising from the same exam bank, or move into a focused topic page if this question exposed a weak area.

FAQ

Questions learners often ask

What does this SY0-701 question test?

Read the scenario before looking for a memorised answer.

What is the correct answer to this question?

The correct answer is: Use parameterized queries or prepared statements — Parameterized queries or prepared statements are the correct fix because they ensure user input is handled as data, not as part of an SQL command. In the example, the injected condition changes the meaning of the query. Proper query parameterization prevents that behavior and is one of the most effective controls against SQL injection and similar input-handling flaws. Why others are wrong: Hiding error messages may reduce clues for attackers but does not close the vulnerability. Password policy changes do not affect query construction. Moving the page does nothing to the server-side logic, so the attacker could still exploit the same flaw through the new address.

What should I do if I get this SY0-701 question wrong?

Then try more questions from the same exam bank and focus on understanding why the wrong options are tempting.

Discussion

Loading comments…

Sign in to join the discussion.