AP Computer Science Principles Performance Task Sample 1
Total Page:16
File Type:pdf, Size:1020Kb
AP Computer Science Principles Performance Task Sample 1 Create – Applications from Ideas
The purpose of this sample is to demonstrate the type of responses that meet expectations of the AP Computer Science Principles Create – Application for Ideas Performance Task rubric. Teachers and students are encouraged to use these samples as a way to promote discussion about the requirements of the task. These samples should not be used by students for final submissions to the College Board for scoring purposes. The performance task prompts have been included in this sample as guidance to be used for classroom instruction purposes. The prompts do not need to be included in final student submissions. Please refer to the AP Computer Science Principles Course and Exam Description for more information about the performance tasks.
Sample Submission
1. Video
2. Written Responses Program Purpose and Development
2a. Provide a written response or audio narration in your video that: identifies the programming language; identifies the purpose of your program; and explains what the video illustrates.
Sample response to 2a: The purpose of my Snap! program is to use a simulation to solve the Cereal Box Problem. Imagine that a cereal company decides to put one of six random prizes into each box. When a customer collects all six prizes, they get a bigger prize. The company wants to know how many boxes of cereal a customer would need to purchase to earn the bigger prize. Because it is difficult to compute this answer mathematically, and because there is a lot of variation in the results, a simulation is a great way to give insight into this problem.
My video illustrates a simulation of this problem and visualizes the boxes purchased. This simulation is repeated a number of times, and the number of boxes needed to complete one set are placed into a list. After a few simulations, it shows the average, maximum, and minimum number of boxes.
Copyright © 2016. The College Board. These materials are samples from a College Board Program. Use or distribution of these draft materials online or in print beyond use in your classroom is prohibited. 2b. Describe the incremental and iterative development process of your program, focusing on two distinct points in that process. Describe the difficulties and/or opportunities you encountered and how they were resolved or incorporated. In your description clearly indicate whether the development described was collaborative or independent. At least one of these points must refer to independent program development.
Sample response to 2b: One-third of the way through my program development, I had one simulation working, but I wanted to visualize the purchases to show the variation. I designed Sprites that represented each prize, and I placed them on the screen to show purchases. My partner ran my program and noticed that my number of sprite stamps on the screen was off by one from the number in the list. She showed me how to fix the code for each “prize” sprite by keeping the sprite hidden while it makes its stamps.
At two-thirds of the way through the program, I decided to run multiple simulations and store the results of each in a list. So I wrote that code but when I tested it my results for minimum were not correct. After some looking, I realized that when I made the minimum block, I had copied and pasted the code from the maximum block, and then just changed the appropriate variable names. I forgot to change one of the variable names, and that was what was causing the error.
2c. Capture and paste the program code segment that implements an algorithm (marked with an oval in section 3 below) that is fundamental for your program to achieve its intended purpose. Your code segment must include an algorithm that integrates other algorithms and integrates mathematical and/or logical concepts. Describe how each algorithm within your selected algorithm functions independently, as well as in combination with others, to form a new algorithm that helps to achieve the intended purpose of the program.
Sample response to 2c:
This algorithm keeps track of how many of each prize has been collected. In the code just before this segment I create a list that stores the number of each prize that was collected, and set all the values of the elements to 0. I needed to integrate an algorithm for simulating one purchase with an algorithm for continuing until one of each prize is won. The first algorithm is the set block combined with the replace block. I take the current value of a certain element in the list and add 1, to mark one more of that prize.
The second algorithm involves the repeat block that continues until I have one of each kind of prize. I needed a way to stop this loop when you have a complete set of prizes. The repeat until block has a condition “not countOfEach contains 0.” In effect this allows the repeat to continue until the list contains no zeros.
2d. Capture and paste the program code segment that contains an abstraction you developed (marked with a rectangle in section 3 below). Your abstraction should integrate mathematical and logical concepts. Explain how your abstraction helped manage the complexity of your program.
Sample response to 2d:
Copyright © 2016. The College Board. These materials are samples from a College Board Program. Use or distribution of these draft materials online or in print beyond use in your classroom is prohibited. My abstraction is the block that I built which represents one simulation of the problem, the result of which (boxes purchased) I put into a list in the calling script. As I was developing this program, I was trying to decide what would be a good number of boxes to make a complete set. I tried 4, 5, 6, 7, and 8. After doing a lot of number changing in the code, I decided to make the Number of Prizes into an input into the problem. Once this block was working and I was trying to change the number of simulations from 10 to say 100, the program took a really long time to run. So I added the parameter for visualizing, which when set to false allows the program to run much faster. It’s easier to understand the purpose of the main program thanks to this abstraction. One final benefit of this abstraction which reduces complexity is that I made script variables for the quantities that are used only in this script 3. Program Code Copyright © 2016. The College Board. These materials are samples from a College Board Program. Use or distribution of these draft materials online or in print beyond use in your classroom is prohibited.
Comment: I actually have six (6) Cereal Box sprites in the program but only posted the code for one of the 6 sprites. The two code snippets above this represent the code for Sprite1. Code for Sprites 2 through 6 share similar code with just different x and y values.
Copyright © 2016. The College Board. These materials are samples from a College Board Program. Use or distribution of these draft materials online or in print beyond use in your classroom is prohibited.