# Sample A CSP Performance Task

## Example End-of-Course Exam Written Responses

The Create Performance Task section of the end-of-course exam consists of four prompts that require students to write responses that demonstrate understanding of their personal Create performance task. The following are sample prompts for each of the four categories – Program Design, Function, and Purpose, Algorithm Development, Errors and Testing, and Data and Procedural Abstraction. Students will have access to their student-authored Personalized Project Reference, as long as it was submitted as final via the AP Digital Portfolio when responding to these prompts.

Prompt 1: Program Design, Function, and Purpose

Identify an expected user of your program. Describe one way your program’s design meets the needs of this user.

Sample Response:

The expected user of our program is a student who wants to practice multiplication or division problems. The program aims to assist students in enhancing their arithmetic skills in a fun and interactive way. One way our program's design meets the needs of this user is by providing a customized learning experience based on the user's choice between multiplication and division. Additionally, the program keeps track of the user's performance by calculating the score as the number of correct answers out of the total number of problems attempted.

Prompt 2: Algorithm Development

Consider the first iteration statement included in the Procedure section of your Personalized Project Reference. Identify the number of times the body of your iteration statement will execute. Describe a condition or error that would cause your iteration statement to not terminate and cause an infinite loop. If no such condition or error exists, explain how the loop could be modified to cause an infinite loop.

Sample Response:

The iteration statement is a for-loop that iterates through the range of numProblems. The number of times the body of the iteration statement will execute is equal to the value stored in the variable numProblems. In this program the for loop will execute 5 times, as there are 5 elements in the firstNumber and secondNumber lists.

To modify the loop intentionally to cause an infinite loop, we could alter the loop's condition to always evaluate as true. For instance, changing the for-loop's condition to for (var i = 0; true; i++) would result in an infinite loop. With this modification, the loop will continuously execute as the value of i increments indefinitely without ever reaching a termination condition.

Prompt 3: Errors and Testing

Consider the procedure included in part (i) of the Procedure section of your Personalized Project Reference. Describe a change to your procedure that will result in a run-time error. Explain why this change will result in a run-time error

Sample Response:

One change to the procedure that could result in a run-time error is modifying the division operation to divide by zero. In the provided code, if the type variable is not equal to "M", the program performs the division operation: correct = firstNumber[i] / secondNumber[i]

If secondNumber[i] is 0, this operation will result in a Zero Division Error. Dividing any number by zero is mathematically undefined, and attempting to perform such an operation in Python (or most programming languages) will cause a run-time error.

Prompt 4: Data and Procedural Abstraction

Suppose you are provided with a procedure called isEqual (value1, value2). The procedure returns true if the two parameters value1 and value2 are equal in value and returns false otherwise. Using the list you identified in the List section of your Personalized Project Reference, explain in detailed steps an algorithm that uses isEqual to count the number of times a certain value appears in your list. Your explanation must be detailed enough for someone else to write the program code.

Sample Response:

To count the number of times a specific value appears in a list using the isEqual procedure, you can initialize a variable called count and set it to 0. Then, iterate through the list using a loop and for each element, use the isEqual procedure to check if it matches the target value. If the isEqual procedure returns true, increment the count variable by 1. After iterating through the entire list, the count variable will contain the total number of occurrences of the target value in the list.

﻿

## Scoring Commentary

Score: 6 out of 6

Row 1: Course Project Video (1 point)

The response earned the point for this row, meeting the following criteria:

• The video demonstrates the running of the program including input, program functionality, and output.

• Input: The inputs demonstrated are asking users to select a problem type and then providing a guess for the problems.
• Program Functionality: The program's purpose is to create a math quiz and the video demonstrates creating both a multiplication and division quiz.
• Output: The three outputs demonstrated are outputting the problem, outputting the results from each guess, and outputting the final score at the end.

Row 2: Program Requirements (1 point)

The response earned the point for this row, meeting the following criteria:

The program code includes:

A list: The response includes the two lists firstNumber and secondNumber that are relevant and used in the program.

A procedure: The response includes a defined procedure called calculate() with a parameter called type.

A call to the procedure: The response includes a call to the procedure, calculate() with a passed argument.

Selection: The selected algorithm includes selection (two if statements)

Iteration: The selected algorithm includes iteration (for loop for the problems)

Row 3: Written Response 1: Program Function and Purpose (1 point)

The response earned the point for this row, meeting the following criteria:

The written response:

• identified an expected user of the program:

• describes one way the program's design meets the needs of the identified user.

Row 4: Written Response 2(a): Algorithm Development (1 point)

The response earned the point for this row, meeting the following criteria:

The written response:

• identified the number of times the body of the iteration statement will execute
• describes a condition or error that would cause an infinite loop.

Row 5: Written Response 2(b): Algorithm Development (1 point)

The response earned the point for this row, meeting the following criteria:

The written response:

• describes a change to the procedure that will result in a run-time error
• explains why the change will result in a run-time error

Row 6: Written Response 2(c): Data and Procedural Abstraction (1 point)

The response earned the point for this row, meeting the following criteria:

The written response:

• explains in detail steps in an algorithm that uses isEqual to count the number of elements in the list that are equal to a certain value.