Please enable JavaScript to use CodeHS

Sample A CSP Performance Task

By David Burnham

Component A: Program Code

Component B: Video

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 num_problems. The number of times the body of the iteration statement will execute is equal to the value stored in the variable num_problems. In this program the for loop will execute 5 times, as there are 5 elements in the first_number and second_number lists.


To modify the loop intentionally to cause an infinite loop, you could remove the input statement entirely, or replace it with a statement that always evaluates to True. For example, replacing answer = int(input("Enter your answer:")) with answer = 1 would create an infinite loop, as the loop will continuously execute, always using answer = 1 without allowing the user to input a different value.



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 = first_number[i] / second_number[i]


If second_number[i] is 0, this operation will result in a ZeroDivisionError. 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 first_number and second_number 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.