AP MCQ Practice Exam Corrections - LindaLiu1202/lindaliu GitHub Wiki
AP MCQ Practice Exam Corrections
Score: 60 out of 70
Q9 Digital representation of audio signal
- Question: Which of the following best explains how an analog audio signal is typically represented by a computer?
- Answer I chose: An analog audio signal is measured as input parameters to a program or procedure. The inputs are represented at the lowest level as a collection of variables.
- Correct answer: An analog audio signal is measured at regular intervals. Each measurement is stored as a sample, which is represented at the lowest level as a sequence of bits.
- Reason: While some programs or procedures take audio data as input, this is not how audio data are represented digitally. At the lowest level, all digital data are represented as sequences of bits.
Q14 Error in isIncreasing procedure
- Question: A list of numbers is considered increasing if each value after the first is greater than or equal to the preceding value. The following procedure is intended to return true if numberList is increasing and return false otherwise. Assume that numberList contains at least two elements.
Line 1: PROCEDURE isIncreasing(numberList) Line 2: { Line 3: count ← 2 Line 4: REPEAT UNTIL(count > LENGTH(numberList)) Line 5: { Line 6: IF(numberList[count] < numberList[count - 1]) Line 7: { Line 8: RETURN(true) Line 9: } Line 10: count ← count + 1 Line 11: } Line 12: RETURN(false) Line 13: } Which of the following changes is needed for the program to work as intended
- Answer I chose: A In line 3, 2 should be changed to 1.
- Correct Answer: C Lines 8 and 12 should be interchanged.
- Reason: As is, the procedure traverses numberList from left to right and returns true whenever it encounters a value that is less than the preceding value. If it never encounters such a value, false is returned. This has the effect of returning true whenever the list is not increasing and returning false whenever the list is increasing, which is the opposite of what is intended.
Q16 Consequence of using Creative Commons
- Question: The author of an e-book publishes the e-book using a no-rights-reserved Creative Commons license. Which of the following best explains the consequences of publishing the book with this type of license?
- Answer I chose: C Individuals will be legally prevented from sharing the e-book on a peer-to-peer network.
- Correct Answer: B Individuals can freely distribute or use the contents of the e-book without needing to obtain additional permissions from the author.
- Reason: A no-rights-reserved Creative Commons license is used when the creator of a published work wants the work to be made freely available to everyone. So publishing an e-book with a no-rights-reserved Creative Commons license enables people to freely distribute it.
Q25 Result of iteration statements
- Question: In the following procedure, the parameter n is an integer greater than 2. The figure presents a block of code that consists of 7 lines. Throughout the code there are nested blocks of code, as follows.
[Begin Block] Line 1: PROCEDURE compute [begin block] n [end block] [Begin Block] Line 2: [begin block] result ← 1 [end block] Line 3: [begin block] j ← 2 [end block] [Begin Block] Line 4: REPEAT UNTIL [begin block] j ˃ 2 [end block] [Begin Block] Line 5: [begin block] result ← result + j [end block] Line 6: [begin block] j ← j + 1 [end block] [End Block] [End Block] Line 7: [begin block] RETURN [begin block] result [end block] [end block] [End Block] [End Block]
Which of the following best describes the value returned by the procedure?
- Answer I chose: B The procedure returns the value of 2 * n.
- Correct Answer: D The procedure returns the sum of the integers from 1 to n.
- Reason: The procedure does not return the value of 2 * n. For a procedure to return 2 * n, it could initialize result to 0 and then repeatedly add 2 to result a total of n times. D is correct because in the REPEAT UNTIL loop, result is first assigned the sum of result and j, or 1 + 2. The value of j is then increased to 3. In each subsequent iteration of the loop, result is increased by each successive value of j (3, 4, 5, etc.) until j exceeds n.
Q32 Statement about public key encryption
- Question: Which of the following is a true statement about the use of public key encryption in transmitting messages?
- Answer I chose: B Public key encryption is not considered a secure method of communication because a public key can be intercepted.
- Correct Answer: A Public key encryption enables parties to initiate secure communications through an open medium, such as the Internet, in which there might be eavesdroppers.
- Reason: A public key is used to encrypt messages, while a private key is used to decrypt messages. Public key encryption is still considered secure even if a public key is obtained by an unauthorized individual.
Q36 Why information is hard to remove from Internet
- Question: Individuals sometimes attempt to remove personal information from the Internet. Which of the following is the LEAST likely reason the personal information is hard to remove?
- Answer I chose: C Automated technologies collect information about Internet users without their knowledge.
- Correct Answer: D All personal information is stored online using authentication measures, making the information hard to access.
- Reason: Personal information can be found in a variety of places where authentication measures may not be used, including social media sites. Personal information placed online can be collected, aggregated, distributed, and exploited. Search engines, social media sites, and other data aggregators can automatically collect personal information that is posted online.
Q39 Number of bits needed for item inventory
- Question: A store uses binary numbers to assign a unique binary sequence to each item in its inventory. What is the minimum number of bits required for each binary sequence if the store has between 75 and 100 items in its inventory?
- Answer I chose: B 6
- Correct Answer: C 7
- Reason: Using 6 bits will only allow for up to 64 sequences because 26=64 2^6=64. Using 7 bits will allow for up to 128 sequences because 27=128 2^7=128. Therefore, a minimum of 7 bits are needed.
Q44 Storing real numbers values using an approximation
- Question: A program developed for a Web store represents customer account balances using a format that approximates real numbers. While testing the program, a software developer discovers that some values appear to be mathematically imprecise. Which of the following is the most likely cause of the imprecision?
- Answer I chose: A The account balances are represented using a fixed number of bits, resulting in overflow errors.
- Correct Answer: B The account balances are represented using a fixed number of bits, resulting in round-off errors.
- Reason: An overflow occurs when a value exceeds the maximum representable value. This type of error does not typically lead to imprecision of values. The fixed number of bits used to represent real numbers limits the range of these values; this limitation can result in round-off errors. Round-off errors typically result in imprecise values or results.
Q55 Move element from end of list to beginning
- Question: A code segment is intended to transform the list utensils so that the last element of the list is moved to the beginning of the list.
For example, if utensils initially contains ["fork", "spoon", "tongs", "spatula", "whisk"], it should contain ["whisk", "fork", "spoon", "tongs", "spatula"] after executing the code segment.
Which of the following code segments transforms the list as intended?
- Answer I chose: A len ← LENGTH(utensils) temp ← utensils[len] REMOVE(utensils, len) APPEND(utensils, temp)
- Correct Answer: C len ← LENGTH(utensils) temp ← utensils[len] REMOVE(utensils, len) INSERT(utensils, 1, temp)
- Reason: Answer A assigns the value of the last element of the list to the variable temp, then removes the last element of the list, then appends temp to the end of the list. The resulting list is the same as the original list.
Q66 Set bonus points based on timer
- Question: In a certain video game, players are awarded bonus points at the end of a level based on the value of the integer variable timer. The bonus points are awarded as follows.
If timer is less than 30, then 500 bonus points are awarded. If timer is between 30 and 60 inclusive, then 1000 bonus points are awarded. If timer is greater than 60, then 1500 bonus points are awarded. Which of the following code segments assigns the correct number of bonus points to bonus for all possible values of timer ?
Select two answers.
- Answer I chose: D
- Correct Answer: D & A
- Reason: I didn’t see that I need to choose 2 answers. D is correct, but A is also correct because this code segment assigns 500 bonus points by default. If timer is less than 30, no additional bonus points are added. If timer is between 30 and 60 inclusive, bonus is incremented by 500 in the first IF block. If timer is greater than 60, bonus is incremented by 500 twice (once in each IF block). The correct number of bonus points is assigned to bonus for all possible values of timer.