AP Computer Science Principles Written Response

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:42 PM on 6/15/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

16 Terms

1
New cards

1. Describe one piece of documentation that would be appropriate to include with or in your program. Describe the intended purpose of this documentation by identifying who would use it and what they would do with it.

One piece of documentation I would include would be to explain how the function that filters through all the food options works. The purpose of the documentation is to help collaborators to quickly understand the purpose and functionality of the "filter" function, especially when debugging the code.

2
New cards

1. Explain how you used or could have used feedback, testing, or reflection in the development of your program.

I could have gathered feedback from potential users to help me with the design of my app to see if it was user friendly. This would help me make adjustments before my final product of the app.

3
New cards

1. Describe the problem that your program was created to address or the creative expression it pursues.

The problem my program was created to address is the decision-making process individuals are faced with when choosing a fast food item from a menu. It aims to address this issue by allowing users to select their preferred type of food and then generating a multitude of options that fall under that category for them to choose from.

4
New cards

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

The expected user of this program is someone looking for meal suggestions based on their preferred food type, such as fast food options. The program's design meets the needs of this user by allowing them to select their preferred food type from a dropdown menu and then generating a random suggestion from that type.

5
New cards

2(a) Consider the first iteration statement included in the Procedure section of your Personalized Project Reference. Describe the condition(s) that will cause the body of the iteration statement to execute at least once.

As long as the food options list has at least one item in the list, the body of the iteration statement will execute at least once.

6
New cards

2(a) Consider the first conditional statement included in the Procedure section of your Personalized Project Reference. Write an equivalent Boolean expression for this conditional statement.

A boolean expression for my conditional statement is foodType[i] == preferredType. This is saying that if a food type in the original, unfiltered foodType list matches the prefferedType that the user selects then the item is added to the new filteredTypes list.

7
New cards

2(a) Consider the code segment in part (ii) of the List section of your Personalized Project Reference that shows how your list is being used. Explain in detailed steps how this code segment works. Your explanation must be detailed enough for someone else to write the code segment.

This code segment is run through if the user selects an item from the preferred food group drop down. The text from the user's selected choice is stored in the preferred food group variable. This is then used in the filterList function to transverse the food options list and add the foods that match the user's selected group to a new list to generate a random food group for the user.

8
New cards

2. (a) 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

My for loop will execute foodOptions.length-1 times, where foodOptions is the list containing the names of all the food in the unfiltered list. One condition that would cause the iteration statement to not terminate and cause an infinite loop is if the array is empty. In such a case, the for loop will never reach a condition where i is greater than or equal to foodOptions.length, leading to an infinite loop.

9
New cards

2(b) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Write a call to your procedure with specific argument(s) that you could use for testing this procedure. Describe the program functionality that is related to this call.

A call to my procedure with a specific argument would be: filterList(preferredType). The program functionality related to this call is when it is called, all the foods in the original list that match the preffered type would be filtered into the new list.

10
New cards

2(b) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Identify a strategy, other than using test cases, that you can use to test the correctness of your procedure. Describe how you would use this strategy.

I could have used watchers to test the correctness of my procedure. I would use this strategy by first adding a watcher for the original, unfiltered list and for the filteredTypes list. When the function is executed I would check to see if the list was filtered properly.

11
New cards

2(b) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Passing different values as arguments to a procedure can cause different segments of code to execute. Based on one of your arguments, describe where you could insert output statements in your procedure to test whether a block of code is executed or not.

To test whether a block of code within the filter function is executed based on different arguments, you can insert console.log statements at strategic points. You could insert console.log statements inside each conditional block of code in the procedure to test whether a specific block is executed based on the argument passed.

12
New cards

2. (b) 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.

If I called my procedure "FilterList" with a capital F and not "filterList" with a lowercase f. This would cause a run time error because my program makes calls to the procedure "filterList" which would not exist if I made a mistake in the name of my function

13
New cards

2(c) Consider the list identified in the List section of your Personalized Project Reference. Explain how you would need to adjust this part of your program if the list was not included in your code.

If the list was not included I would need to adjust my code by adding a variable for each element in the list, making it much harder to manage the complexity of my program.

14
New cards

2(c) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Procedures are often used to organize larger problems into subproblems or smaller tasks. Identify the subproblem being solved or task that is being accomplished by your procedure. Explain how the procedure is used to accomplish the overall functionality of your program.

The subproblem being solved by my procedure is organizing the task of extracting values from the dataset based on a specific food type. This procedure is used to accomplish the overall functionality of my program as once the procedure completes, a filtered list is fully created and can be used to generate options for the user, which is the purpose of my program.

15
New cards

2(c) Consider the procedure identified in part (i) of the Procedure section of your Personalized Project Reference. Explain how your program could be written differently if one of your parameters was removed from your procedure.

This could be written differently if the variable using the food group the user selected (preferredType) was plugged into the procedure to start. This would eliminate the need for the parameter in this situation because the variable stores the food group that the function is sorting the food options list by.

16
New cards

2. (c) 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.

You can create a variable count to keep track of the number of occurrences. I would use a for loop to iterate through each element in the list. For each element, I will use the isEqual procedure to compare the element in the list (Value 1) with the target value (Value 2). If the elements are equal, the count variable will increase by one. After going through the entire list, count will contain the number of occurrences of the target value.