mediummultiple choiceObjective-mapped

During testing, entering ' OR '1'='1 into a login field returns all user records instead of rejecting the input. What is the best fix to address this flaw?

Question 1mediummultiple choice
Full question →

During testing, entering ' OR '1'='1 into a login field returns all user records instead of rejecting the input. What is the best fix to address this flaw?

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

Add client-side JavaScript validation to block quote characters

Client-side checks are easy to bypass and do not stop malicious input reaching the server.

B

Best answer

Use parameterized queries or prepared statements for database access

Parameterized queries separate code from data, which prevents SQL injection even when attackers supply special characters.

C

Distractor review

Store passwords in a stronger hash format

Better password storage is good practice, but it does not fix query construction that allows injection.

D

Distractor review

Change the login page to HTTPS

TLS protects data in transit, but it does not prevent the application from building unsafe SQL statements.

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 for database access — Parameterized queries or prepared statements are the best fix because they separate SQL logic from user-supplied input. In this scenario, the application is treating input as executable query content, which allows an attacker to alter the database query. Proper query parameterization removes that ambiguity and directly addresses the injection weakness instead of trying to filter individual characters. Why others are wrong: Client-side validation is bypassable and cannot be trusted as the primary defense. Stronger password hashing helps protect stored credentials, but it does not stop query manipulation. HTTPS is important for confidentiality, but the flaw occurs inside the application after the request is received.

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.