Skip to main content

Written Response 1: Program design, function and purpose

Study timer: crediting borrowed code

  • Units 1, 3 and 5
  • 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 student wrote this program to total their study time for a week. A study timer gives the length of each session in seconds, and the program reads four sessions. A session of 0 means the timer was started by mistake.

The procedure formatTime was not written by the student. It comes from a free, open-source time library, and it turns a number of seconds into text in minutes:seconds form, such as 70:00 for 4200 seconds.

Example: entering 1500, 900, 0 and 1800 displays Total this week: 70:00.

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

The procedure written by the student

Pseudocode
PROCEDURE totalStudy(sessions)
{
    total ← 0
    FOR EACH s IN sessions
    {
        IF(s > 0)
        {
            total ← total + s
        }
    }
    RETURN(total)
}

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

The main program

Pseudocode
sessions ← []
REPEAT 4 TIMES
{
    APPEND(sessions, INPUT())
}
DISPLAY("Total this week:")
DISPLAY(formatTime(totalStudy(sessions)))

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

Because formatTime was written by someone else, the student plans to add documentation about it. Describe one piece of documentation that would be appropriate to include, and explain how it would help another programmer understand the code segment that uses formatTime.

0 / 2,500 characters

Checking scoring…

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