This sample AP CSP Performance Task is intended as a demonstration of a simple program that meets the PT requirements and makes the Written Response questions as easy as possible to answer.

This sample PT is presented using AP CSP Pseudocode so that it is accessible to AP CSP students using any programming language. Although there are several unofficial interpreters of AP CSP Pseudocode students should use a real programming language for their Performance Tasks.

For this same sample Performance Task in Java, see AP CSP Performance Task Sample.

If you submit this sample task to the College Board as your own, you will almost certainly be flagged for cheating.

AP CSP Performance Task Resources

Free Response from 2023 and earlier do not correspond to the current Performance Task design.

RestaurantPicker AP CSP Performance Task

RestaurantPicker features publicly available information about a handful of restaurants at Disney World (name, location, price range). This site is not affiliated with Disney or the College Board.

Sample run (not submitted to the College Board)

1: Magic Kingdom
2: EPCOT
Location number: 1

1: $14.99 and under per adult
2: $15 to $34.99 per adult
3: $35 to $59.99 per adult
4: over $60 per adult
Price range: 4

Be Our Guest Restaurant
Cinderella's Royal Table
The Crystal Palace

Note: Line breaks have been added to improve readability. The AP CSP Pseudocode does not provide a built in way to specify a line break.

Complete program code

AP CSP Pseudocode is not a real programming language and some behavior is undefined.

Code outside a procedure is assumed to run immediately upon program execution. Code inside a procedure is assumed to run only when that procedure is called.

The lists used throughout the program are initialized at the top, above the procedures. All of the procedures are assumed to have access to the lists.

Video

This video is of the Java version of this program. AP CSP Pseudocode is not a real programming language. (Several interpreters of AP CPS Pseudocode do exist.)

The video meets the Create Performance Task requirements. Specifically, the video shows:

The video is in an acceptable format (mov) and does not contain prohibited information (identifying information or voice narration).

Both links are to the same video. The YouTube verison might show ads (YouTube’s, not mine). The Google Drive version should not show ads.

Personalized Project Reference

These 4 code segments were selected to meet the requirements detailed in the instructions above. Each code segment includes notes that explain why the code segment was selected. The notes are NOT part of the actual PPR submitted to the College Board. The actual PPR must not feature any comments.

Procedure i

PROCEDURE printMatchingRestaurants(location, priceRange)
{
    index ← 1

    REPEAT UNTIL (index > LENGTH(restaurantNames))
    {
        IF(restaurantLocations[index] = location AND restaurantPriceRanges[index] = priceRange)
        {
            DISPLAY(restaurantNames[index])
        }

        index ← index + 1
    }
}

The procedure (aka: method or function) includes parameters location and priceRange. The values of the parameters have an effect on the functionality of the procedure. Specifically, the values of the parameters determine whether the DISPLAY statement executes and how many times.

The algorithm in the procedure includes:

Picking a procedure that implements a simple algorithm (as opposed to a complex one) makes some of the possible Written Response questions easier to answer.

As with all of the PPR, you must NOT include any comments. This includes procedure documentation and comments within the code. A single comment in your PPR can cause you to receive a zero for the entire Performance Task. Double check that your code does not include comments.

Well named procedures and variables are allowed. You should name procedures and variables based on their purpose.

Procedure ii

location ← getLocation()
priceRange ← getPriceRange()
printMatchingRestaurants(location, priceRange)

The procedure call must be used to accomplish something related to the program. It can’t be meaningless or unrelated to the overall program.

In this case, the call printMatchingRestaurants(location, priceRange) is used to print names of restaurants that match the specified location and price range. Both the location and price range are obtained from user input.

List i

restaurantNames ← [
    "Aloha Isle",
    "Casey's Corner",
    "The Plaza Restaurant",
    "The Diamond Horseshoe",
    "Be Our Guest Restaurant",
    "Connections Eatery",
    "La Hacienda de San Angel",
    "Le Cellier Steakhouse",
    "Monsieur Paul",
    "Cinderella's Royal Table",
    "The Crystal Palace",
    "Space 220"]

This part does NOT require that the code segment be a complete procedure, or even in a procedure.

The code selected MUST store values in list. It can set values or add values, but values must go into the list.

This code is not required to include a loop. The code is required to contribute to the program’s purpose.

The code for the List section is not required to be related to the code in the Procedure section.

List ii

index ← 1

REPEAT UNTIL (index > LENGTH(restaurantNames))
{
    IF(restaurantLocations[index] = location AND restaurantPriceRanges[index] = priceRange)
    {
        DISPLAY(restaurantNames[index])
    }

    index ← index + 1
}

The list used here must be the SAME list as in List i. The grader will have access to your complete program code and might jump through a hoop to determine if this is the case. The best approach is to make it obvious. Use the same name for the list, even if the list is passed as a parameter.

Although not explicitly required, picking a code segment that loops through the list makes some possible Written Response questions easier to answer. Looping through the list also makes it easier to ensure that the code is “being used to manage complexity in your program.”

See Lists as abstractions for further discussion about using a list to manage complexity in a program.

As with the algorithm in the Procedure section, a simple algorithm is better than a complex algorithm.

Sample Written Response answers for 2025 Set 1

2025 Written Response Prompts Set 1

Response to question 1

The program could output:

Be Our Guest Restaurant
Cinderella's Royal Table
The Crystal Palace

These are expensive (price range 4) restaurants in Magic Kingdom.

The program’s purpose is to display the names of restaurants that match the location and price range entered by the user.

As mentioned above, AP CSP Pseudocode does not provide a way to specify line breaks. Line breaks have been added above for readability.

Response to question 2 (a)

The Boolean expression is:

IF(restaurantLocations[index] = location AND restaurantPriceRanges[index] = priceRange)

The expression will evaluate to true if:

restaurantLocations[index] is "Magic Kingdom",

location is "Magic Kingdom",

restaurantPriceRanges[index] is 1,

and priceRange is 1.

The expression checks if elements at the same position in two lists match the values of the parameters.

Response to question 2 (b)

Changing the AND to OR would result in a logic error. The procedure would display the names of restaurants that match either (or both) of the criteria (location and price range) instead of restaurants that match both criteria.

Response to question 2 (c)

If another programmer added elements to the end of the restaurantNames list the code segment in List (ii) may or may not need to be modified.

If the other programmer also added corresponding elements to the restaurantLocations and restaurantPriceRanges lists, the code segment in List (ii) would not need to be modified. The loop already runs based on the length of restaurantNames and the existing loop body would correctly check the new restaurants.

If the other programmer did not add corresponding elements to the restaurantLocations and restaurantPriceRanges lists, the code segment in List (ii) would need to be modified to run based on the length of one of the other lists. This would be necessary to prevent accessing elements in restaurantLocations and restaurantPriceRanges that do not exist.

Sample Written Response answers for 2025 Set 2

2025 Written Response Prompts Set 2

Response to question 1

When prompted to select a location, a user could enter a number that does not correspond to a location, such as -1. The program tells the user that the input is invalid and prompts for another input. This process is repeated until the user enters valid input.

This is handled in the getLocation() procedure.

Response to question 2 (a)

The Boolean expression is:

IF(restaurantLocations[index] = location AND restaurantPriceRanges[index] = priceRange)

The expression will evaluate to false if:

restaurantLocations[index] is "Magic Kingdom"

and location is "Epcot".

The values after the AND do not matter because the left expression is false.

The expression checks if elements at the same position in two lists match the values of the parameters.

Response to question 2 (b)

Changing the AND to OR would result in a logic error. The code segment would display the names of restaurants that match either (or both) of the criteria (location and price range) instead of restaurants that match both criteria.

Response to question 2 (c)

The procedure outputs the names of restaurants that match the location and price range specified as parameters.

The program can be modified to include more restaurants and more locations, such as restaurants in Animal Kingdom. When new restaurants are added, the procedure can be tested separately from the rest of the program. Testing the procedure with fixed inputs, such as:

printMatchingRestaurants("Animal Kingdom", 3) and
printMatchingRestaurants("Animal Kingdom", 4)

is easier than running the program multiple times and entering different values. It is also easier to repeat the tests after making changes.

Help & comments

Get help from AP CS Tutor Brandon Horn

Comment on AP CSP Performance Task Sample in AP CSP Pseudocode