AP COMPUTER SCIENCE PRINCIPLES Test Booklet Q1 BM B 1. A car manufacturer uses simulation software during the design process for a new car. Which of the following are reasons to use simulation software in this context? I. Using simulation software can save the company money by helping to compare designs early in the process, before prototype cars are built. II. Using simulation software can help to identify safety issues by providing data about how different mechanical components will interact in a wide variety of situations. III. The manufacturer can present simulation software to customers to demonstrate different design possibilities. (A) I and II only (B) I and III only (C) II and III only (D) I, II, and III 2. Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case. A programmer notices the following two procedures in a library. The procedures do similar, but not identical, things. • Procedure • Procedure returns the value returns the value . . Which of the following procedures is a generalization of the procedures described above? (A) Procedure (B) Procedure (C) Procedure (D) Procedure 3. , which returns the value n + m , which returns the value , which returns the value , which returns the value A programmer is writing a program that is intended to be able to process large amounts of data. Which of the following considerations is LEAST likely to affect the ability of the program to process larger data sets? (A) How long the program takes to run (B) How many programming statements the program contains (C) How much memory the program requires as it runs (D) How much storage space the program requires as it runs 4. Which of the following best explains the ability to solve problems algorithmically? AP Computer Science Principles Page 1 of 10 Test Booklet Q1 BM B (A) Any problem can be solved algorithmically, though some algorithmic solutions may require humans to validate the results. (B) Any problem can be solved algorithmically, though some algorithmic solutions must be executed on multiple devices in parallel. (C) Any problem can be solved algorithmically, though some algorithmic solutions require a very large amount of data storage to execute. (D) There exist some problems that cannot be solved algorithmically using any computer. 5. 6. Which of the following is an advantage of a lossless compression algorithm over a lossy compression algorithm? (A) A lossless compression algorithm can guarantee that compressed information is kept secure, while a lossy compression algorithm cannot. (B) A lossless compression algorithm can guarantee reconstruction of original data, while a lossy compression algorithm cannot. (C) A lossless compression algorithm typically allows for faster transmission speeds than does a lossy compression algorithm. (D) A lossless compression algorithm typically provides a greater reduction in the number of bits stored or transmitted than does a lossy compression algorithm. Suppose a large group of people in a room were all born in the same year. Consider the following three algorithms, which are each intended to identify the people in the room who have the earliest birthday based on just the month and day. For example, a person born on February 10 is considered to have an earlier birthday than a person born on March 5. Which of the three algorithms will identify the correct people? I. All the people in the room stand up. All standing people form pairs where possible, leaving at most one person not part of a pair. For each pair, the person with the earlier birthday remains standing, while the other person in the pair sits down. If there is a tie, both people sit down. Any individual not part of a pair remains standing. Continue doing this until only one person remains standing. That person has the earliest birthday. II. All the people in the room stand up. All standing people form pairs with another standing person that they have not previously been paired with where possible, leaving at most one person not part of a pair. For each pair, the person with the earlier birthday remains standing, while the other person in the pair sits down. If there is a tie, both people in the pair remain standing. Any individual not part of a pair remains standing. Continue doing this until only one person remains standing or all persons standing have the same birthday. Anyone still standing has the earliest birthday. III. Beginning with the number 1, ask if anyone was born on that day of any month. Continue with the numbers 2, 3, and so on until a positive response is received. If only one person responds, that person has the earliest birthday. If more than one person responds, determine which person was born in the earliest month, and that person or those persons have the earliest birthday. (A) I only (B) II only (C) I and II (D) II and III Page 2 of 10 AP Computer Science Principles Test Booklet Q1 BM B 7. Consider a game in which a player flips a fair coin three times. If all three coin flips have the same result (either all heads or all tails) the player wins. Otherwise, the player loses. Which of the following code segments best simulates the behavior of the game? AP Computer Science Principles Page 3 of 10 Test Booklet Q1 BM B (A) (B) (C) (D) Page 4 of 10 AP Computer Science Principles Test Booklet Q1 BM B 8. Flight simulation software, which imitates the experience of flying, is often used to train airline pilots. Which of the following is LEAST likely to be an advantage of using flight simulation software for this purpose? (A) Flight simulation software allows pilots to practice landing in a variety of different terrains and weather conditions without having to physically travel. (B) Flight simulation software could save money due to the cost of maintenance and fuel for actual training flights. (C) Flight simulation software provides a more realistic experience for pilots than actual training flights. (D) Flight simulation software allows for the testing of emergency air situations without serious consequences. 9. For which of the following situations would it be best to use a heuristic in order to find a solution that runs in a reasonable amount of time? (A) Appending a value to a list of 10. elements, which requires no list elements be examined. (B) Finding the fastest route that visits every location among examined. locations, which requires possible routes be (C) Performing a binary search for a score in a sorted list of examined. scores, which requires that fewer than (D) Performing a linear search for a name in an unsorted database of entries be examined. scores be people, which requires that up to A certain programming language uses 4-bit binary sequences to represent nonnegative integers. For example, the binary sequence 0101 represents the corresponding decimal value 5. Using this programming language, a programmer attempts to add the decimal values 14 and 15 and assign the sum to the variable total. Which of the following best describes the result of this operation? (A) The correct sum of 29 will be assigned to the variable total. 11. (B) An overflow error will occur because 4 bits is not large enough to represent either of the values 14 or 15. (C) An overflow error will occur because 4 bits is not large enough to represent 29, the sum of 14 and 15. (D) A round-off error will occur because the decimal values 14 and 15 are represented as approximations due to the fixed number of bits used to represent numbers. A student is creating an algorithm to display the distance between the numbers num1 and num2 on a number line. The following table shows the distance for several different values. Value of num1 Value of num2 Distance Between num1 and num2 5 2 3 1 8 7 -3 4 7 Which of the following algorithms displays the correct distance for all possible values of num1 and num2 ? AP Computer Science Principles Page 5 of 10 Test Booklet Q1 BM B (A) Step 1: Add num1 and num2 and store the result in the variable sum. Step 2: Take the absolute value of sum and display the result. Step 1: Subtract num1 from num2 and store the result in the variable diff. (B) Step 2: Take the absolute value of diff and display the result. Step 1: Take the absolute value of num1 and store it in the variable absNum1. (C) Step 2: Take the absolute value of num2 and store it in the variable absNum2. Step 3: Add absNum1 and absNum2 and display the result. Step 1: Take the absolute value of num1 and store it in the variable absNum1. (D) Step 2: Take the absolute value of num2 and store it in the variable absNum2. Step 3: Subtract absNum1 from absNum2 and display the result. 12. 13. A certain game keeps track of the maximum and minimum scores obtained so far. If num represents the most recent score obtained, which of the following algorithms correctly updates the values of the maximum and the minimum? (A) If num is greater than the minimum, set the minimum equal to num. Otherwise, if num is greater than the maximum, set the maximum equal to num. (B) If num is less than the minimum, set the minimum equal to num. Otherwise, if num is greater than the maximum, set the maximum equal to num. (C) If num is less than the minimum, set the minimum equal to num. Otherwise, if num is less than the maximum, set the maximum equal to num. (D) If num is greater than the minimum, set the minimum equal to num. Otherwise, if num is less than the maximum, set the maximum equal to num. A computer science student completes a program and asks a classmate for feedback. The classmate suggests rewriting some of the code to include more procedural abstraction. Which of the following is NOT a benefit of procedural abstraction? Page 6 of 10 AP Computer Science Principles Test Booklet Q1 BM B (A) Making the code more readable (B) Making the code run faster (C) Providing more opportunities for code reuse (D) Reducing the amount of duplicated code 14. ASCII is a character-encoding scheme that uses 7 bits to represent each character. The decimal (base 10) values 65 through 90 represent the capital letters A through Z, as shown in the table below. What ASCII character is represented by the binary (base 2) number 1001010 ? (A) H (B) I (C) J (D) K 15. A computer program uses 3 bits to represent integers. When the program adds the decimal (base 10) numbers 5 and 3, the result is 0. Which of the following is the best explanation for the result? (A) An overflow error occurred. (B) A round-off error occurred. (C) The result was affected by lossy data compression. (D) The result was approximated by a floating-point representation. 16. A video-streaming Web site keeps count of the number of times each video has been played since it was first added to the site. The count is updated each time a video is played and is displayed next to each video to show its popularity. At one time, the count for the most popular video was about two million. Sometime later, the same video displayed a seven-digit negative number as its count, while the counts for the other videos displayed correctly. Which of the following is the most likely explanation for the error? AP Computer Science Principles Page 7 of 10 Test Booklet Q1 BM B 17. (A) The count for the video became larger than the maximum value allowed by the data type used to store the count. (B) The mathematical operations used to calculate the count caused a rounding error to occur. (C) The software used to update the count failed when too many videos were played simultaneously by too many users. (D) The software used to update the count contained a sampling error when using digital data to approximate the analog count. ASCII is a character-encoding scheme that uses a numeric value to represent each character. For example, the uppercase letter “G” is represented by the decimal (base 10) value 71. A partial list of characters and their corresponding ASCII values are shown in the table below. ASCII characters can also be represented by hexadecimal numbers. According to ASCII character encoding, which of the following letters is represented by the hexadecimal (base 16) number 56? (A) A (B) L (C) V (D) Y 18. Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case. A text-editing application uses binary sequences to represent each of 200 different characters. What is the minimum number of bits needed to assign a unique bit sequence to each of the possible characters? (A) 4 (B) 6 (C) 7 (D) 8 Page 8 of 10 AP Computer Science Principles Test Booklet Q1 BM B 19. Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case. In a certain science experiment, percent of trials are expected to be successful and percent of trials are expected to be unsuccessful. The program below is intended to simulate the results of repeated trials of the experiment. Which of the following can be used to replace so that the simulation works as intended? (A) (B) (C) (D) 20. Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer. I. An algorithm that accesses each element in the list twice II. An algorithm that accesses each element in the list n times III. An algorithm that accesses only the first 10 elements in the list, regardless of the size of the list Which of the algorithms run in reasonable time? AP Computer Science Principles Page 9 of 10 Test Booklet Q1 BM B (A) I only (B) III only (C) I and II only (D) I, II, and III Page 10 of 10 AP Computer Science Principles
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )