Please enable JavaScript to use CodeHS

Sample B 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 someone who wants to secure their messages using a Caesar Cipher encryption technique. This program meets the needs of the user by providing a simple and interactive way to encrypt their messages.


The design of the program ensures user-friendliness by accepting a word from the user and a shift value for encryption. The program then encrypts the word using the Caesar Cipher technique and displays the encrypted result. By allowing the user to input their own word and shift value, the program enables customization, ensuring that users can encrypt a wide range of messages.



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:


In the provided code snippet, the first iteration statement is a for loop that iterates through the characters of the input word provided by the user. The number of times the body of this iteration statement will execute depends on the length of the input word. If the input word contains 20 characters, the loop will execute 20 times.



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:


Change the list in the for loop to word[0]. This will cause a runtime error for the case where the list is uninitialized or empty, leading to a runtime 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 how many times a specific value appears in the word list using the isEqual procedure, you start by setting up a counter variable, count, to keep track of the occurrences. Then, you go through each element in the word list. For each element, you use the isEqual procedure to check if it's equal to the target value. If it's a match, you increase the count by 1. Keep doing this for all elements in the list. When you finish checking all elements, the count variable will contain the total number of times the target value appears in the word list. This method ensures an accurate count by utilizing the isEqual procedure for comparisons.

Scoring Commentary


Please note that the sample student code includes a list, but that list does not manage complexity as required in the instructions. Based on the four prompts provided, the lack of managing complexity does not impact the student, however, questions will vary from year to year and different questions could be used that would expose the error in the student’s code.


Score: 4 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 video demonstrates the program receiving user input for both the unencrypted phrase and the shift.
  • Program Functionality: The program's purpose is to encrypt a phrase and the video demonstrates this purpose.
  • Output:  The program demonstrates output by printing out the encrypted phrase.



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 a list called words that is relevant and used in the program.

A procedure: The response includes a defined procedure called encrypt() with a parameter called key.

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

Selection: The selected algorithm includes selection (if-else statement)

Iteration: The selected algorithm includes iteration (for loop)



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 (0 points)

The response did not earn a point for this row. While the response did identify and discuss the number of times the body of the iteration statement will execute, it did not describe a condition or error that would cause an infinite loop.




Row 5: Written Response 2(b): Algorithm Development (0 points)

The response did not earn a point for this row. The response discussed a change to the procedure that would not actually 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.