exam questions

Exam DP-420 All Questions

View all questions & answers for the DP-420 exam

Exam DP-420 topic 5 question 14 discussion

Actual exam question from Microsoft's DP-420
Question #: 14
Topic #: 5
[All DP-420 Questions]

You have a database in an Azure Cosmos DB Core (SQL) API account.
You need to create an Azure function that will access the database to retrieve records based on a variable named accountnumber. The solution must protect against SQL injection attacks.
How should you define the command statement in the function?

  • A. cmd = "SELECT * FROM Persons p WHERE p.accountnumber = 'accountnumber'"
  • B. cmd = "SELECT * FROM Persons p WHERE p.accountnumber = LIKE @accountnumber"
  • C. cmd = "SELECT * FROM Persons p WHERE p.accountnumber = @accountnumber"
  • D. cmd = "SELECT * FROM Persons p WHERE p.accountnumber = '" + accountnumber + "'"
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
azuredemo2022three
11 months, 2 weeks ago
Selected Answer: C
Selected Answer: C
upvoted 3 times
...
azuredemo2022three
11 months, 2 weeks ago
Answer C. cmd = "SELECT * FROM Persons p WHERE p.accountnumber = @accountnumber"
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...