Skip to main content

Written Response 1: Program design, function and purpose

Water tracker: documentation

  • 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

A family uses this program to track water use. Each evening for a week, they enter how many gallons the household used that day. The program reports how many days were over the household's goal of 80 gallons and gives a tip when more than 3 days were over.

Example: entering 70, 95, 82, 60, 88, 79 and 91 displays Days over your goal: 4 Tip: try a shorter shower tomorrow.

Source: Sample program written for this practice question (hypothetical)

The procedure

Pseudocode
PROCEDURE daysOverGoal(dailyGallons, goal)
{
    count ← 0
    FOR EACH g IN dailyGallons
    {
        IF(g > goal)
        {
            count ← count + 1
        }
    }
    RETURN(count)
}

Source: Sample program written for this practice question (hypothetical)

The main program

Pseudocode
dailyGallons ← []
REPEAT 7 TIMES
{
    APPEND(dailyGallons, INPUT())
}
over ← daysOverGoal(dailyGallons, 80)
DISPLAY("Days over your goal:")
DISPLAY(over)
IF(over > 3)
{
    DISPLAY("Tip: try a shorter shower tomorrow")
}

Source: Sample program written for this practice question (hypothetical)

Suggested time: 15 minutes

Your answers are saved in this browser as you type.

Something wrong with this question?

What's wrong?

Please don't include personal details.

Part (a)

1 point

A new teammate will take over this program next month. Propose one piece of documentation (for example a comment, a short written description or a diagram) to include with or in the program, and explain how the teammate would use it to understand what a particular code segment does or how it works.

0 / 2,500 characters

Checking scoring…

Scoring it yourself shows you the rubric, examples and a model answer. Try writing your answer first.