Please enable JavaScript to use CodeHS

Sample Roblox CSP Performance Task

By Joi Anderson

Instructions for Performance Task


In your program, you must include student-developed program code that contains:


☐ Instructions for input from one of the following:

  • the user (including user actions that trigger events)
  • a device
  • an online data stream
  • a file

☐ Use of at least one list (or other collection type) to represent a collection of data that is stored and used to manage program complexity and help fulfill the program’s purpose


☐ At least one procedure that contributes to the program’s intended purpose, where you have defined:

  • the procedure’s name
  • the return type (if necessary)
  • one or more parameters

☐ An algorithm that includes sequencing, selection, and iteration that is in the body of the selected procedure


☐ Calls to your student-developed procedure


☐ Instructions for output (tactile, audible, visual, or textual) based on input and program functionality


Component A: Program Code






Component B: Video


Component C: Personalized Project Reference


Procedure

Capture and paste two program code segments you developed during the administration of this task that contain a student-developed procedure that implements an algorithm used in your program and a call to that procedure.


i. The first program code segment must be a student-developed procedure that:

  • Defines the procedure’s name and return type (if necessary)
  • Contains and uses one or more parameters that have an effect on the functionality of the procedure
  • Implements an algorithm that includes sequencing, selection, and iteration


ii. The second program code segment must show where your student-developed procedure is being called in your program.




List

Capture and paste two program code segments you developed during the administration of this task that contain a list (or other collection type) being used to manage complexity in your program.


i. The first program code segment must show how data have been stored in the list.


ii. The second program code segment must show the data in the same list being used, such as creating new data from the existing data or accessing multiple elements in the list, as part of fulfilling the program’s purpose.




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 purpose of this program is to entertain the user by creating a game where they earn points by collecting orbs. In the game, 10 red, yellow, and green orbs are added to the game, and the user moves the player around to collect the orbs. When the player collides with three yellow orbs, one red orb, and one green orb., the orb disappears and they increase their point count. Their final score is printed at the end.


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 is a for loop that will execute through the range of the length of the orbsArray array. Because the program creates 10 orbs and adds them to the orbsArray, the orbsArray is 10 items long, meaning the for loop will repeat 10 times. To modify the loop intentionally to cause an infinite loop, you could adjust the for loop in lines 77-81 that creates the orbs and adds them to the orbsArray array to be an infinite loop. You could do this by changing the loop from a for loop to a while loop with the condition of true. This would create an infinite number of orbs and make the length of the orbsArray array infinite. This would in turn make the for loop in the procedure (lines 62-68) iterate through an array with a length of infinite, resulting in an infinite loop.


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 removing the orb parameter. In line 34, when the procedure tries to access the orb object’s “NotCollected” attribute, there will be an error because there is no orb object being passed into the function. This will result in 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: In the video, the input is the user moving the player around.
    • Program Functionality: In the video, 10 red, yellow, and green orbs are added to the game, and the user moves the player around to collect the orbs. The video demonstrates what happens when the player collides with three yellow orbs, one red orb, and one green orb.
    • Output: The output in the video is the message printed to the console (“You collected a yellow orb!) and the updated score.


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 an array called orbsArray that is relevant and used in the program.
  • A procedure: The response includes a defined procedure called processOrb() with two parameters called orbs and orbsArray.
  • A call to the procedure: The response includes a call to the procedure, processOrb() with a passed argument.
  • Selection: The selected algorithm includes selection (nested if-else statements)
  • 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 (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.