Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1cursor.execute("SELECT * FROM users") | AServer-side code reading form data sent from the client | |
| 2name = request.form["name"] | BDatabase queries are put in browser code, but the browser should never access the database directly; the server-side code must run the query. | |
| 3Server-side code builds the response that is sent back to the client | CServer-side code querying the database for stored data | |
| 4Server-side code handles a request that arrives from the browser | Dreturn "<h1>Hello " + name + "</h1>" | |
| 5<script>db.query("SELECT * FROM users")</script> | EThe function never returns anything, so the server has no response to send back to the client. | |
| 6def login(): name = request.form["name"] | F@app.route("/login", methods=["POST"]) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
server-side code — Code that runs on the web server, not the browser. It handles a request, processes form data, queries the database and builds the response sent back to the client.def login():
name = request.form["name"]def users():
cur = db.cursor()
cur.execute("SELECT * FROM users")def welcome():
return render_template("home.html")@app.route("/login", methods=["POST"])
def login():def login():
if request.method == "POST":
name = request.form["name"]