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 | |
|---|---|---|
| 1# Write a function that returns the average of a list | ATrusting AI-generated code without checking or testing it. It can contain logic errors, bugs or out-of-date methods. | |
| 2Tab key to accept a suggestion | BA natural-language prompt written as a comment, which an editor assistant can turn into a suggested function | |
| 3Chat-based code generation: describe the task in plain English and the chatbot replies with program code | CAccepting the code that an editor's AI code completion tool has proposed as you type | |
| 4AI is good at repetitive boilerplate code, but the programmer must still test the result | Dassert average([2, 4, 6]) == 4 | |
| 5# AI wrote this, so it must be correct. Submit it without running it. | EThe prompt is vague. AI tools generate better code from clear, specific prompts that state the language, inputs and expected output. | |
| 6Prompt: Make my app better | FPrompt: Write a Python function that checks if a number is prime |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
AI code generation — Using AI tools, like editor assistants and chatbots, to turn plain-English prompts into program code. It saves time, but the code must still be checked and tested by the programmer.# Prompt: add two numbers
def add(a, b):
return a + b# Generated by an AI assistant
def area(w, h):
return w * hprompt = input("Ask: ")
reply = chatbot(prompt)
print(reply)def double(n):
return n * 2
assert double(4) == 8result = average([2, 4, 6])
if result == 4:
print("Test passed")