Refer to the exhibit. The code fetches the latest order from the purchases table for a specific user. An engineer needs to pass query parameters to the execute function to prevent an SQL injection attack. Which code snippet must be placed in the blank in the code to meet this requirement?

QuestionsCategory: 350-901Refer to the exhibit. The code fetches the latest order from the purchases table for a specific user. An engineer needs to pass query parameters to the execute function to prevent an SQL injection attack. Which code snippet must be placed in the blank in the code to meet this requirement?
Admin Staff asked 4 months ago
Image
Refer to the exhibit. The code fetches the latest order from the purchases table for a specific user. An engineer needs to pass query parameters to the execute function to prevent an SQL injection attack. Which code snippet must be placed in the blank in the code to meet this requirement?

A. cursor.execute("SELECT orders FROM purchases WHEREusername = '{}'".format (username))

B. cursor.execute("SELECT orders FROM purchases WHEREusername = %(username)s", {'username': username})

C. cursor.execute("SELECT orders FROM purchases WHEREusername = '$s' % username".replace("'", "''"))

D. cursor.execute (f"SELECT orders FROM purchases WHEREusername = '{username}'")








 

Suggested Answer: B



This question is in 350-901 DEVCOR exam 
For getting DevNet Professional Certificate


Disclaimers:
The website is not related to, affiliated with, endorsed or authorized by Cisco.
Trademarks, certification & product names are used for reference only and belong to Cisco.

Recommended

Welcome Back!

Login to your account below

Create New Account!

Fill the forms below to register

Retrieve your password

Please enter your username or email address to reset your password.