Written Response 1: Program design, function and purpose
Recipe scaler: users and design
- Units 1 and 3
- 1 point
- About 15 minutes
One prompt about the program as a whole: for example, who the program is for and how its design meets that user's needs, what its inputs and outputs are, or what documentation would help another programmer understand a code segment. On the exam: Question 1 of 2 (1 point). Section II has 2 written-response questions (4 prompts) in 60 minutes, taken in Bluebook at the end-of-course exam; no calculator. On the real exam the questions are about your own Create performance task program, and you can see your Personalized Project Reference (screenshots of your procedure and list code). The Create task is 30% of the AP score, scored on 6 one-point rows: video, program requirements, WR1, WR2(a), WR2(b) and WR2(c). On this site you answer the same kinds of prompts about a short sample program given with the question.
The question and its sources
This written-response prompt is about the sample program below. On the exam you answer this kind of prompt about your own Create task program; here, answer about this program and refer to its code. Write in complete sentences.
About the program
This program scales a spice-rub recipe. The original recipe makes 4 servings and uses 2 teaspoons of paprika, 1 teaspoon of garlic powder, 0.25 teaspoon of cumin and 0.125 teaspoon of cayenne pepper, stored in that order in the list amounts.
The user enters the number of servings they want. The procedure scaleRecipe returns a new list of amounts. Any amount smaller than 0.125 teaspoon (1/8 teaspoon) is replaced by the text "a pinch", because amounts that small are hard to measure with a spoon.
Example: entering 2 displays 1 0.5 0.125 a pinch.
Source: Sample program written for this practice question (hypothetical)
The procedure
PROCEDURE scaleRecipe(amounts, servingsWanted, servingsInRecipe)
{
scaled ← []
FOR EACH a IN amounts
{
newAmount ← a * servingsWanted / servingsInRecipe
IF(newAmount < 0.125)
{
APPEND(scaled, "a pinch")
}
ELSE
{
APPEND(scaled, newAmount)
}
}
RETURN(scaled)
}Source: Sample program written for this practice question (hypothetical)
The main program
amounts ← [2, 1, 0.25, 0.125]
wanted ← INPUT()
newAmounts ← scaleRecipe(amounts, wanted, 4)
FOR EACH x IN newAmounts
{
DISPLAY(x)
}Source: Sample program written for this practice question (hypothetical)
Suggested time: 15 minutes
Your answers are saved in this browser as you type.
Part (a)
1 pointIdentify a group of people this program is meant to serve. Describe one specific feature of the program's design that meets a need of that group, and connect the feature to the program code.
0 / 2,500 characters
Checking scoring…
Scoring it yourself shows you the rubric, examples and a model answer. Try writing your answer first.