历年AP Computer Science计算机科学系列
真题与答案下载
翰林国际教育全网首发
力争超快速发布最全资料
助你在升学路上一帆风顺
为你的未来保驾护航
2013 AP Computer Science A Free-Response Questions Free Download
2013 AP 计算机科学A简答题部分免费下载
此套题仅 Section II含有简答题,
共计时1小时45分钟,共4题
占总分50%
每道大题可能含有不同数量的小题
完整版下载链接见文末
部分真题预览:
1)A music Web site keeps track of downloaded music. For each download, the site uses a DownloadInfo object to store a song's title and the number of times it has been downloaded. A partial declaration for the DownloadInfo class is shown below.
The list of downloaded information is stored in a MusicDownloads object. A partial declaration for the MusicDownloads class is shown below.
- Write the MusicDownloads method getDownloadInfo, which returns a reference to a DownloadInfo object if an object with a title that matches the parameter title exists in the downloadList. If no song in downloadList has a title that matches the parameter title, the method returns null.
For example, suppose variable webMusicA refers to an instance of MusicDownloads and that the table below represents the contents of downloadList. The list contains three DownloadInfo objects. The object at position 0 has a title of "Hey Jude" and a download count of 5. The object at position 1 has a title of "Soul Sister" and a download count of 3. The object at position 2 has a title of "Aqualung" and a download count of 10.
The call webMusicA.getDownloadInfo("Aqualung") returns a reference to the object in position 2 of the list.
The call webMusicA.getDownloadInfo("Happy Birthday") returns null because there are no DownloadInfo objects with that title in the list.
Complete method getDownloadInfo below. - Write the MusicDownloads method updateDownloads, which takes a list of song titles as a parameter. For each title in the list, the method updates downloadList, either by incrementing the download count if a DownloadInfo object with the same title exists, or by adding a new DownloadInfo object with that title and a download count of 1 to the end of the list. When a new DownloadInfo object is added to the end of the list, the order of the already existing entries in downloadList remains unchanged.
For example, suppose variable webMusicB refers to an instance of MusicDownloads and that the table below represents the contents of the instance variable downloadList.
Assume that the variable List<String> songTitles has been defined and contains the following entries.
{"Lights", "Aqualung", "Soul Sister", "Go Now", "Lights", "Soul Sister"}
The call webMusicB.updateDownloads(songTitles) results in the following downloadList with incremented download counts for the objects with titles of "Soul Sister" and "Aqualung". It also has a new DownloadInfo object with a title of "Lights" and a download count of 2, and another DownloadInfo object with a title of "Go Now" and a download count of 1. The order of the already existing entries remains unchanged.
In writing your solution, you must use the getDownloadInfo method. Assume that getDownloadInfo works as specified, regardless of what you wrote for part (a).
Complete method updateDownloads below.
完整版真题下载链接请注册或登录后查看
文件为PDF格式
推荐使用电脑下载
2013 AP Computer Science A 计算机科学FRQ简答题完整版答案免费下载
请持续关注,稍后更新
翰林学员全站资料免费打包下载,专享高速下载通道。