APCSP Exam
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? Select one: 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.
A
Which of the following has the greatest potential for compromising a user's personal privacy? Select one: a. A group of cookies stored by the user's Web browser b. The Internet Protocol (IP) address of the user's computer c. The user's e-mail address d. The user's public key used for encryption
A
Which of the following activities poses the greatest personal cybersecurity risk? Select one: a. Making a purchase at an online store that uses public key encryption to transmit credit card information b. Paying a bill using a secure electronic payment system c. Reserving a hotel room by e~mailing a credit card number to a hotel d. Withdrawing money from a bank account using an automated teller machine (ATM)
C
The code fragment below is intended to display "odd" if the positive number num is odd. IF (<MISSING CONDITION>) DISPLAY "odd" Which of the following can be used to replace <MISSING CONDITION> so that the code fragment will work as intended? Select one: a. (num MOD 1) = 0 b. (num MOD 1) = 1 c. (num MOD 2 ) = 0 d. (num MOD 2) = 1
D
A program is expressed in a programming language. Which of the following is true of the program? Select one: a. The program can also be expressed as binary code, but will be more easily understood by humans when expressed in a higher-level programming language. b. The program can also be expressed as binary code, which will reduce the likelihood of errors. c. The program cannot be expressed as binary code, because binary code can only be used to represent data. d. Some parts of the program can be expressed as binary code, but operations must be expressed using a higher-level programming language.
A
A student is recording a song on her computer. When the recording is finished, she saves a copy on her computer. The student notices that the saved copy is of lower sound quality than the original recording. Which of the following could be a possible explanation for the difference in sound quality? Select one: a. The song was saved using fewer bits per second than the original song. b. The song was saved using more bits per second than the original song. c. The song was saved using a lossless compression technique. d. Some information is lost every time a file is saved from one location on a computer to another location.
A
Consider the code segment below. Line 1: IF (a = 0) Line 2: { Line 3: b ← a + 10 Line 4: } Line 5: ELSE Line 6: { Line 7: b ← a + 2O Line 8: } Which of the following changes will NOT affect the results when the code segment is executed? Select one: a. Changing line 3 to b ← 10 b. Changing line 3 to a ← b + 10 c. Changing line 7 to b ← 20 d. Changing line 7 to a ← b + 10
A
Two lists, listl and 1ist2, contain the names of books found in two different collections. A librarian wants to create newList, which will contain the names of all books found in either list, in alphabetical order, with duplicate entries removed. For example, if 1istl contains ["Macbeth", "Frankenstein", "Jane Eyre"] and 1ist2 contains ["Frankenstein", "Dracula, "Macbeth", "Hamlet"], then newList will contain ["Dracula", "Frankenstein", "Hamlet", "Jane Eyre", "Macbeth"]. The following procedures are available to create newList. Procedure Explanation Sort (list) Sorts list in alphabetical order and returns the resulting list. Combine (listl, list2) Creates a new list consisting of the entries from 1ist1 followed by the entries from 1ist2. The resulting list is returned. RemoveDuplicates (list) Iterates through 1ist. If any two or more entries have the same value, the duplicate entries are removed so that any entry appears at most once. The resulting list is returned. Which of the following code segments will correctly create newList? Select one: a. newList ← Combine (listl, list2) newList ← Sort (newList) newList ← RemoveDup1icates (newList) b. listl ← Sort (listl) list2 ← Sort (list2) newList ← Combine (listl, list2) newList ← RemoveDuplicates (newList) c. listl ← RemoveDuplicates (listl) list2 ← RemoveDuplicates (list2) newList ← Combine (listl, 1ist2) newList ← Sort (newList) d. listl ← RemoveDuplicates (listl) listl ← Sort (listl) list2 ← RemoveDuplicates (list2) 1ist2 ← Sort (list2) newList ← Combine (listl, list2)
A
Which of the following is LEAST likely to indicate a phishing attack? Select one: a. An e-mail from your bank asks you to call the number on your card to verify a transaction b. An e-mail from a merchant asks that you click on a link to reset your password c. An e-mail from a utility company asks you to enter your date of birth and social security number for verification purposes d. An e-mail indicates that you have won a large sum of money and asks you to enter your bank account number so that the money can be transferred to you
A
A school library allows students to borrow laptops. A computer program is used to count the number of times a particular laptop has been borrowed from the library (borrows) and the number of times the same laptop has been returned to the library (returns). Which of the following indicate that a particular laptop is not currently borrowed? Select two answers. a. The difference between borrows and returns is zero. b. The product of borrows and returns is a positive even number. c. The quotient when borrows is divided by returns is greater than l. d. The sum of borrows and returns is a positive even number.
A and D
Researchers have developed a simulation of packets traveling between server computers and client computers in a network. Of the following, which two outcomes are most likely to be results of the simulation? Select two answers. Select one or more: a. Better understanding of the effect of temporarily unavailable network connections b. Better understanding of the effect of using hexadecimal representations for binary data c. Better understanding of the impact of access to public data in identifying solutions to problems d. Better understanding of the impact of increased connection speeds for frequently visited servers
A and D
A programmer is deciding between using a linear or binary search to find a target value in a sorted list. Which of the following is true? Select one: a. In all cases, a binary search of a sorted list requires fewer comparisons than a linear search. b. Generally, the advantage of using a binary search over a linear search increases as the size of the list increases. c. A linear search will generally run faster than a binary search because a linear search requires fewer lines of code to implement. d. Using a linear search is preferable to using a binary search if there is a chance that the target may not be found in the list.
B
Central High School keeps a database of information about each student, including the numeric variables numboerOfAbsences and gradePointAverage. The expression below is used to determine whether a student is eligible to receive an academic award. (numberOfAbsences <= 5) AND (gradePointAverage > 3.5) Which of the following pairs of values indicates that a student is eligible to receive an academic award? Select one: a. numberOfAbsences = 3, gradePointAverage = 3.5 b. numberOfAbsences = 5, gradePointAverage = 3.8 c. numberOfAbsences = 6, gradePointAverage = 3.4 d. numberOfAbsences = 6, gradePointAverage = 3.6
B
Consider the following numbers. ° Binary 1100 ° Decimal 11 ° Hexadecimal D Which of the following lists the numbers in order from least to greatest? Select one: a. Binary 1100, Decimal 11, Hexadecimal D b. Decimal 11, Binary 1100, Hexadecimal D c. Decimal 11, Hexadecimal D, Binary 1100 d. Hexadecimal D, Decimal 11, Binary 1100
B
In the program below, y is a positive integer (e.g. l, 2, 3, ...). result ← 0 REPEAT 3 TIMES { REPEAT y TIMES { result ← result + 1 } } What is the value of result after running the program? Select one: a. y+3 b. 3y c. y^3 d. 3^y
B
Many Web browsers allow users to open anonymous windows. During a browsing session in an anonymous window, the browser does not record a browsing history or a list of downloaded files. When the anonymous window is exited, cookies created during the session are deleted. Which of the following statements about browsing sessions in an anonymous window is true? Select one: a. The activities of a user browsing in an anonymous window will not be visible to people who monitor the user's network, such as the system administrator. b. Items placed in a Web store's shopping cart for future purchase during the anonymous browsing session will not be saved on the user's computer. c. A user will not be able to log in to e-mail or social media accounts during the anonymous browsing session. d. A user browsing in an anonymous window will be protected from viruses launched from any web sites visited or files downloaded.
B
Some programming languages use constants, which are variables that are initialized at the beginning of a program and never changed. Which of the following are good uses for a constant? I. To represent the mathematical value for (pi) as 3.14 II. To represent the current score in a game III. To represent a known value such as the number of days in a week Select one: a. I and II only b. I and III only c. II and III only d. I, II, and III
B
Which of the following best explains what happens when a new device is connected to the Internet? Select one: a. A device driver is assigned to the device. b. An Internet Protocol (IP) address is assigned to the device. c. A packet number is assigned to the device. d. A Web site is assigned to the device.
B
Which of the following is a characteristic of the fault-tolerant nature of routing on the Internet? Select one: a. The ability to use a hierarchical naming system to avoid naming conflicts b. The ability to provide data transmission even when some connections have failed c. The ability to resolve errors in domain name system (DNS) lookups d. The ability to use multiple protocols such as hypertext transfer protocol (HTTP), Internet protocol (LP), and simple mail transfer protocol (SMTP) to transfer data
B
Which of the following can be represented by a single binary digit? Select two answers. Select one or more: a. The position of the minute hand of a clock b. The remainder when dividing a whole number by 2 c. The value of a Boolean variable d. The volume of a car radio
B and C
A search engine has a trend-tracking feature that provides information on how popular a search term is. The data can be filtered by geographic region, date, and category. Categories include arts and entertainment, computers and electronics, games, news, people and society, shopping, sports, and travel. Which of the following questions is LEAST likely to be answerable using the trends feature? Select one: a. In what month does a particular sport receive the most searches? b. In which political candidates are people interested? c. What is the cost of a certain electronics product? d. Which region of the country has the greatest number of people searching for opera performances?
C
An algorithm has been developed to compute the sum of all the elements in a list of integers. Which of the following programming structures must be added to the existing algorithm so that the new algorithm computes the sum of only the even integers in the list? Select one: a. Iteration b. Searching c. Selection d. Sequencing
C
An author is considering publishing an e-book using a Creative Commons license. In which of the following situations would it be better for the author to use a Creative Commons license instead of a traditional copyright? I. The author wants to make the e-book available as a free download. II. The author wants to prevent people from sharing copies of the e-book on peer-to-peer networks. III. The author wants to allow people permission to use and modify the e-book. Select one: a. I only b. II only c. I and III d. II and III
C
An online store uses 6-bit binary sequences to identify each unique item for sale. The store plans to increase the number of items it sells and is considering using 7-bit binary sequences. Which of the following best describes the result of using 7-bit sequences instead of 6- bit sequences? Select one: a. 2 more items can be uniquely identified. b. 10 more items can be uniquely identified. c. 2 times as many items can be uniquely identified. d. 10 times as many items can be uniquely identified.
C
Historically, it has been observed that computer processing speeds tend to double every two years. Which of the following best describes how technology companies can use this observation for planning purposes? Select one: a. Technology companies can accurately predict the dates when new computing innovations will be available to use. b. Technology companies can plan to double the costs of new products each time advances in processing speed occur. c. Technology companies can set research and development goals based on anticipated processing speeds. d. Technology companies can spend less effort developing new processors because processing speed will always improve at the observed rate.
C
In the procedure Mystery below, the parameter number is a positive integer. PROCEDURE Mystery (number) { REPEAT UNTIL (number <= 0) { number ← number - 2 } IF (number = 0) { RETURN (true) } ELSE { RETURN (false) } } Which of the following best describes the result of running the procedure Mystery? Select one: a. The procedure returns true when the initial value of number is 2, and it otherwise returns false. b. The procedure returns true when the initial value of number is greater than 2, and it otherwise returns false. c. The procedure returns true when the initial value of number is even, and it otherwise returns false. d. The procedure returns true when the initial value of number is odd, and it otherwise returns false.
C
The procedure below is intended to display the index in a list of unique names (nameList) where a particular name (targetName) is found. lf targetName is not found in nameList, the code should display 0. PROCEDURE FindName (nameList, targetName) { index ← 0 FOR EACH name IN nameList { index ← index + 1 IF (name = targetName) { foundIndex ← index } ELSE { foundIndex ← 0 } } DISPLAY (foundIndex) } Which of the following procedure calls can be used to demonstrate that the procedure does NOT Work as intended? Select one: a. FindName (["Andrea", "Ben"], "Ben" ) b. FindName (["Andrea", "Ben" ], "Diane" ) c. FindName (["Andrea", "Ben", "Chris"], "Ben") d. FindName (["Andrea", "Chris", "Diane"], "Ben")
C
Which of the following is a true statement about cloud computing? Select one: a. Cloud computing is convenient to implement but has a negative effect on the scalability of systems. b. Cloud computing is useful for large businesses but is not useful for individuals. c. Storing data using cloud computing can help ensure that data are not lost if a user's computer stops functioning. d. Storing data using cloud computing improves security over storing data on a personal computer.
C
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. Select one: a. I and II only b. I and III only c. II and III only d. I, II, and III
D
A new bank plans to make customer convenience a priority by minimizing the amount of time a customer waits in line. The bank is considering two options: a single line where the customer at the front waits for the next available teller, or separate lines for each teller. The bank decides to use a computer simulation of these two options to determine the average wait time for customers. Which of the following is NOT true about the bank's plan? Select one: a. The bank can incorporate other factors, such as the number of tellers, in the simulation. b. The bank can use the simulation to investigate these two options without causing inconvenience for customers. c. The bank may consider new alternatives based on the simulation results. d. The simulation will not produce usable results because actual customer data are not available.
D
A programmer wrote the code segment below to display the average of all the elements in a list called numbers. There is always at least one number in the list. Line 1: count ← 0 Line 2: sum ← 0 Line 3: FOR EACH value IN numbers Line 4: { Line 5: count ← count + 1 Line 6: sum ← sum + value Line 7: average ← sum / count Line 8: } Line 9: DISPLAY (average) The programmer wants to reduce the number of operations that are performed when the program is run. Which change will result in a correct program with a reduced number of operations performed? Select one: a. Interchanging line 1 and line 2 b. Interchanging line 5 and line 6 c. Interchanging line 6 and line 7 d. lnterchanging line 7 and line 8
D
An algorithm will be used to identify the maximum value in a list of one or more integers. Consider the two versions of the algorithm below. Algorithm I : Set the value of a variable max to -1. Iterate through the list of integer values. If a data value is greater than the value of the variable max, set max to the data value. Algorithm II : Set the value of a variable max to the first data value. Iterate through the remaining values in the list of integers. If a data value is greater than the value of the variable max, set max to the data value. Which of the following statements best describes the behavior of the two algorithms? Select one: a. Both algorithms work correctly on all input values. b. Algorithm I always works correctly, but Algorithm II only works correctly when the maximum value is not the first value in the list. c. Algorithm II always works correctly, but Algorithm I only works correctly when the maximum value is greater than or equal to -l. d. Neither algorithm will correctly identify the maximum value when the input contains both positive and negative input values.
D
The algorithm below is used to simulate the results of flipping a coin 4 times. Consider the goal of determining Whether the simulation resulted in an equal number of heads and tails. Step l : Initialize the variables heads_counter and f1ip_counter to 0. Step 2 : A variable coin_f1ip is randomly assigned a value of either 0 or l. If coin_f1ip has the value 0, the coin flip result is heads, so heads_counter is incremented by 1. Step 3 : Increment the value of f1ip_counter by l. Step 4 : Repeat steps 2 and 3 until f1ip_counter equals 4. Following execution of the algorithm, which of the following expressions indicates that the simulation resulted in an equal number of heads and tails? Select one: a. coin_f1ip = 1 b. flip_counter = 1 c. flip_counter = 2 d. heads_counter = 2
D
Two computers are built by different manufacturers. One is running a Web server and the other is running a Web browser. Which of the following best describes the ability of the two computers to communicate with each other across the Internet? Select one: a. The computers cannot communicate because different manufacturers use different communication protocols. b. The computers can communicate, but additional hardware is needed to convert data packets from one computer's protocol to the other computer's protocol. c. The computers can communicate directly only if the messages consist of text; other formats cannot be interpreted across computers. d. The computers can communicate directly because Internet communication uses standard protocols.
D
Which of the following statements are true about using a high-level programming language instead of a lower-level language? I. Programs written in a high-level language are generally easier for people to read than programs written in a low-level language. II. A high-level language provides programmers with more abstractions than a low-level language. III. Programs written in a high-level language are generally easier to debug than programs written in a low-level language. Select one: a. I only b. I and III only c. II and III only d. I, II, and III
D