2009 AP Computer Science A?Free-Response Questions Free Download
2009 AP 計算機科學A簡答題部分免費下載
此套題僅?p II含有簡答題,
共計時1小時45分鐘,共4題
占總分50%
每道大題可能含有不同數量的小題
完整版下載鏈接見文末
部分真題預覽:
1)A statistician is studying sequences of numbers obtained by repeatedly tossing a six-sided number cube. On each side of the number cube is a single number in the range of 1 to 6, inclusive, and no number is repeated on the cube. The statistician is particularly interested in runs of numbers. A run occurs when two or more consecutive tosses of the cube produce the same value. For example, in the following sequence of cube tosses, there are runs starting at positions 1, 6, 12, and 14.
The number cube is represented by the following class.
You will implement a method that collects the results of several tosses of a number cube and another method that calculates the longest run found in a sequence of tosses.
Write the method getCubeTosses that takes a number cube and a number of tosses as parameters. The method should return an array of the values produced by tossing the number cube the given number of times.
Complete method getCubeTosses below.
Write the method getLongestRun that takes as its parameter an array of integer values representing a series of number cube tosses. The method returns the starting index in the array of a run of maximum size. A run is defined as the repeated occurrence of the same value in two or more consecutive positions in the array.
For example, the following array contains two runs of length 4, one starting at index 6 and another starting at index 14. The method may return either of those starting indexes.
If there are no runs of any value, the method returns -1.
以上就是關于【2009 AP Computer Science A 計算機科學A真題系列之簡答題免費下載】的解答,如需了解學校/賽事/課程動態,可至翰林教育官網獲取更多信息。