Score: 65/67 = 97%

AP COMPUTER SCIENCE PRINCIPLES

Corrections

Question 29 - A person wants to transmit an audio file from a device to a second device. Which of the following scenarios best demonstrates the use of lossless compression of the original file?

AP COMPUTER SCIENCE PRINCIPLES

I got this question wrong. I put B, A device compresses the audio file by removing details that are not easily perceived by the human ear. The compressed file is transmitted to a second device, which plays it. B is incorrect because this technique is an example of lossy audio compression. The correct answer is A, A device compresses the audio file before transmitting it to a second device. The second device restores the compressed file to its original version before playing it. A is correct because lossless compression is a technique that allows for complete reconstruction of the original data.

Question 67 - The procedure NumOccurrences is intended to count and return the number of times targetWord appears in the list wordList. The procedure does not work as intended. For which of the following code segments will the call to NumOccurrences NOT return the intended value?

AP COMPUTER SCIENCE PRINCIPLES

I got this question wrong. I put B and D. B is correect because for this code segment, count is increased to 1 the first time “maple” is encountered in the list. However, count is reset to 0 when the code segment moves to the next list element. This causes the procedure to return 0 instead of the intended result 1. D is incorrect because for this code segment, count is initialized to 0. Since “spruce” does not appear in the list, the procedure returns the intended result 0. The second corrrect answer is A because for this code segment, count is increased to 1 the first time “birch” is encountered in the list. However, count is reset to 0 when the code segment moves to the next list element. The last time “birch” is encountered in the list, count is again increased to 1, causing the procedure to return 1 instead of the intended result 2.