AP Computer Science Midterm

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

A code segment is intended to display the following output. up down down down up down down down Which of the following code segments can be used to display the intended output?

(A) Repeat 2 times Display "up" Repeat 3 times Display "down"

To be eligible for a particular ride at an amusement park, a person must be at least 12 years old and must be between 50 and 80 inches tall, inclusive. Let age represent a person's age, in years, and let height represent the person's height, in inches. Which of the following expressions evaluates to true if and only if the person is eligible for the ride? (A)(age ≥ 12) AND ((height ≥ 50) AND (height ≤ 80)) (B)(age ≥ 12) AND ((height ≤ 50) AND (height ≥ 80)) (C)(age ≥ 12) AND ((height ≤ 50) OR (height ≥ 80)) (D)(age ≥ 12) OR ((height ≥ 50) AND (height ≤ 80))

(A) (age ≥ 12) AND ((height ≥ 50) AND (height ≤ 80))

Which of the following code segments can be used to draw the figure?

(A) xVal1 yVal0 len1 REPEAT 5 TIMES {drawLine(xVal, yVal, xVal, yVal + len) xVal ← xVal 1len ← len + 1}

Consider the following code segment. What value is displayed as a result of executing the code segment? (A)3 (B)4 (C)9 (D)12

(A)3

What are the values of first and second as a result of executing the code segment? (A)first = 100, second = 100 (B)first = 100, second = 200 (C)first = 200, second = 100 (D)first = 200, second = 200

(A)first = 100, second = 100

A sorted list of numbers contains 128 elements. Which of the following is closest to the maximum number of list elements that can be examined when performing a binary search for a value in the list? (A) 2 (B) 8 (C) 64 (D) 128

(B) 8

Which of the following is NOT a benefit of collaborating to develop a computing innovation? (A) Collaboration can decrease the size and complexity of tasks required of individual team members. (B) Collaboration can make it easier to find and correct errors during the development process. (C) Collaboration eliminates the need to resolve differences of opinion. (D) Collaboration facilitates multiple perspectives in developing ideas.

(C) Collaboration eliminates the need to resolve differences of opinion.

Which of the following is most likely to be a benefit to users of the application? (A) The application allows users to identify all other users in a particular area. (B)Users of the application may be able to easily identify all other users in a particular area as a result of the application's algorithm for determining whether users are compatible. (C)Users of the application may see health benefits as a result of the application encouraging them to exercise with each other. (D)Users of the application who live in rural areas have the ability to use all the features of the application, even when they do not have Internet and geolocation connectivity.

(C)Users of the application may see health benefits as a result of the application encouraging them to exercise with each other.

Which of the following data must be collected from a user's smartphone in order for RunRoutr to suggest a running route? (A) Available running routes near the user's home (B) The current time (C) The starting location of the user's previous run (D) The user's geographic position

(D) The user's geographic position

Which of the following best explains how devices and information can be susceptible to unauthorized access if weak passwords are used? (A)Unauthorized individuals can deny service to a computing system by overwhelming the system with login attempts. (B)Unauthorized individuals can exploit vulnerabilities in compression algorithms to determine a user's password from their decompressed data. (C)Unauthorized individuals can exploit vulnerabilities in encryption algorithms to determine a user's password from their encryption key.(D) Unauthorized individuals can use data mining and other techniques to guess a user's password.

(D) Unauthorized individuals can use data mining and other techniques to guess a user's password.

What control is represented by the decimal value 15? (A)← (B)↑ (C)→ (D)↓

(D)↓

Which of the following research proposals is most likely to be successful as a citizen science project? (A)Collecting pictures of birds from around the world that can then be analyzed to determine how location affects bird size (B)Monitoring a group of cells in a laboratory to determine how growth rate is affected by exposure to varying temperatures (C)Using a simulation to determine which one from a set of chemicals causes the most significant change to local animal and plant life (D)Using specialized equipment to perform three-dimensional scans of complex proteins found in human cells

(A) Collecting pictures of birds from around the world that can then be analyzed to determine how location affects bird size

What is the decimal value for the jump control? (A) 3 (B) 12 (C) 24 (D) 48

(C) 24

Which of the following code segments will move the robot to the gray square along the path indicated by the arrows?

C) Bot Stepper 2 Move Forward Bot Stepper 3

A list of numbers has elements, indexed from1ton. The following algorithm is intended to display true if the value target appears in the list more than once and to display false otherwise. The algorithm uses the variable position and count. Steps 4 and 5 are missing.

(A) Step 4 Repeat steps 2 and 3 until the value of position is greater than. Step 5 If the count is greater than or equal to2, display true. Otherwise, display false.

The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the center square and facing toward the top of the grid. Which of the following code segments will move the robot from the center square along the same path as the code segment above?

(A) count0REPEAT 4 TIMES{count ← count + 1REPEAT count TIMES{MOVE_FORWARD()}ROTATE_LEFT()}

Which of the following best describes a challenge involved in using a parallel computing solution? A)A parallel computing solution may not be appropriate for an algorithm in which each step requires the output from the preceding step. (B)A parallel computing solution may not be appropriate for an algorithm in which the same formula is applied to many numeric data elements. (C)A parallel computing solution may not be appropriate for an algorithm that can be easily broken down into small independent tasks. (D)A parallel computing solution may not be appropriate for an algorithm that searches for occurrences of a keyword in a large number of documents.

(A)A parallel computing solution may not be appropriate for an algorithm in which each step requires the output from the preceding step.

What is the minimum number of connections that must be broken or removed before device B can no longer communicate with device C? (A) Three (B) Four (C) Five (D) Six

(B) Four

Which of the following best exemplifies the use of keylogging to gain unauthorized access to a computer system? (A)A user unintentionally installs a program on their computer that records all user input and forwards it to another computer. A few weeks later, someone else is able to access the user's computer using the recorded data. (B)A user has a very common password for an online banking account. Someone else guesses the password after a few attempts and gains access to the user's account. (C)A user logs into an unsecure Web site. Someone else is able to view unencrypted log-in information as it is transmitted over the Internet. The user has the same username and password for multiple accounts, so the user's log-in information for multiple systems may be compromised. (D)A user receives an e-mail that claims to be from the user's bank. The e-mail instructs the user to click on a link to a Web site and enter a username and password to verify an account. Shortly after following the steps, the user discovers that the Web site is fraudulent and that the user's username and password were stolen.

(A)A user unintentionally installs a program on their computer that records all user input and forwards it to another computer. A few weeks later, someone else is able to access the user's computer using the recorded data.

Which of the following is an example of an attack using a rogue access point? (A)An unauthorized individual gains the ability to view network traffic by connecting to a network router that uses weak or no security measures. (B)An unauthorized individual physically disconnects an exposed network router, making the network unavailable to some users. (C)An unauthorized individual poses as a network administrator and attempts to trick a user into providing personal information. (D)A group of unauthorized individuals overwhelms a network router with traffic, making it unavailable to some users.

(A)An unauthorized individual gains the ability to view network traffic by connecting to a network router that uses weak or no security measures.

Which of the following is a true statement about the use of public key encryption in transmitting messages? (A)Public key encryption enables parties to initiate secure communications through an open medium, such as the Internet, in which there might be eavesdroppers. (B)Public key encryption is not considered a secure method of communication because a public key can be intercepted. (C)Public key encryption only allows the encryption of documents containing text; documents containing audio and video must use a different encryption method. (D)Public key encryption uses a single key that should be kept secure because it is used for both encryption and decryption.

(A)Public key encryption enables parties to initiate secure communications through an open medium, such as the Internet, in which there might be eavesdroppers.

Which of the following best explains how symmetric encryption algorithms are typically used? (A)Symmetric encryption uses a single key that should be kept secret. The same key is used for both encryption and decryption of data.(B)Symmetric encryption uses a single key that should be made public. The same key is used for both encryption and decryption of data. (C)Symmetric encryption uses two keys that should both be kept secret. One key is used for encryption, and the other is used for decryption. (D)Symmetric encryption uses two keys. The key used for encryption should be made public, but the key used for decryption should be kept secret.

(A)Symmetric encryption uses a single key that should be kept secret. The same key is used for both encryption and decryption of data.

An online gaming company is introducing several new initiatives to encourage respectful communication between players of online games. Which of the following best describes a solution that uses crowdsourcing? (A)The company allows individual players to endorse fellow players based on courteous interactions. Once a player receives enough endorsements, the player is given free rewards that can be used during gameplay. (B)The company eliminates chat from gameplay and sets the default chat policy to off. Players must actively turn on chat to converse outside of gameplay. (C)The company introduces software that monitors all chats. Inappropriate conversations are identified, and players involved in the conversations are banned from the game. (D)The company updates the acceptable content guidelines to explicitly describe appropriate and inappropriate behavior. All players must electronically sign an agreement to adhere to the guidelines.

(A)The company allows individual players to endorse fellow players based on courteous interactions. Once a player receives enough endorsements, the player is given free rewards that can be used during gameplay.

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? (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. Scoring GuideMid-Term 2021 ReviewAP Computer Science PrinciplesPage 3 of 29

(A)The count for the video became larger than the maximum value allowed by the data type used to store the count.

A company delivers packages by truck and would like to minimize the length of the route that each driver must travel in order to reach n delivery locations. The company is considering two different algorithms for determining delivery routes. Which of the following best categorizes algorithm II? (A) Algorithm II attempts to use an algorithmic approach to solve an otherwise undecidable problem. (B) Algorithm II uses a heuristic approach to provide an approximate solution in a reasonable time. (C)Algorithm II provides no improvement over algorithm I because neither algorithm runs in a reasonable time. (D) Algorithm II requires a much faster computer in order to provide any improvement over algorithm I.

(B) Algorithm II uses a heuristic approach to provide an approximate solution in reasonable time.

Which of the following best explains how data is transmitted on the Internet? (A) Data is broken into packets, which are all sent to the recipient in a specified order along the same path. (B) Data is broken into packets, which can be sent along different paths. (C)All data is transmitted in a single packet through a direct connection between the sender and the recipient. (D) Multiple data files are bundled together in a packet and transmitted together.

(B) Data is broken into packets, which can be sent along different paths.

A city maintains a database of all traffic tickets that were issued over the past ten years. The tickets are divided into the following two categories. Which of the following questions CANNOT be answered using only the information in the database? (A) Have the total number of traffic tickets per year increased each year over the past ten years? (B) In the past ten years, were nonmoving violations more likely to occur on a weekend than on a weekday? (C)In the past ten years, were there any months when moving violations occurred more often than nonmoving violations? (D) In how many of the past ten years were there more than one million moving violations?

(B) In the past ten years, were nonmoving violations more likely to occur on a weekend than on a weekday?

In a science experiment, result X is expected to occur 25% of the time and result Y is expected to occur the remaining 75% of the time. The following code segment is intended to simulate the experiment if there are 100 trials. The result shows that 94 trials were counted, rather than the intended 100 trials. Which of the following changes to the code segment will ensure a correct simulation of the experiment? (A)Replacing line 9 with IF(RANDOM(1, 4) ≥ 2) (B)Replacing line 9 withELSE (C) Interchanging lines 5 and 9 (D) Interchanging lines 7 and 11

(B) Replacing line 9 with ELSE

A state government is attempting to reduce the digital divide. Which of the following activities has the greatest potential to contribute to the digital divide rather than reduce it? (A) Providing programs that focus on technology literacy at local libraries (B) Requiring applicants for government jobs to apply using an online platform (C)Working with technology companies to offer computing devices at discounted prices to individuals with reduced incomes (D) Working with telecommunications companies to build network infrastructure in remote areas

(B) Requiring applicants for government jobs to apply using an online platform.

Which of the following statements about the Internet is true? (A) The Internet is a computer network that uses proprietary communication protocols. (B) The Internet is designed to scale to support an increasing number of users. (C) The Internet requires all communications to use encryption protocols. (D) The Internet uses a centralized system to determine how packets are routed.

(B) The Internet is designed to scale to support an increasing number of users.

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? (A) The account balances are represented using a fixed number of bits, resulting in overflow errors. (B) The account balances are represented using a fixed number of bits, resulting in round-off errors. (C) The account balances are represented using an unlimited number of bits, resulting in overflow errors. (D) The account balances are represented using an unlimited number of bits, resulting in round-off errors.

(B) The account balances are represented using a fixed number of bits, resulting in round-off errors.

Which of the following best explains how an analog audio signal is typically represented by a computer? (A)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. (B)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. (C)An analog audio signal is measured as a sequence of operations that describe how the sound can be reproduced. The operations are represented at the lowest level as programming instructions. (D)An analog audio signal is measured as text that describes the attributes of the sound. The text is represented at the lowest level as a string.

(B)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.

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? (A) The contents of the e-book will be encrypted and can only be decrypted by authorized individuals. (B)Individuals can freely distribute or use the contents of the e-book without needing to obtain additional permission from the author. (C) Individuals will be legally prevented from sharing the e-book on a peer-to-peer network. (D) Individuals will be legally prevented from using excerpts from the e-book in another published work.

(B)Individuals can freely distribute or use the contents of the e-book without needing to obtain additional permission from the author.

A certain social media application is popular with people across the United States. The developers of the application are updating the algorithm used by the application to introduce a new feature that allows users of the application with similar interests to connect with one another. Which of the following strategies is LEAST likely to introduce bias into the application? (A)Enticing users to spend more time using the application by providing the updated algorithm for users who use the application at least ten hours per week (B)Inviting a random sample of all users to try out the new algorithm and provide feedback before it is released to a wider audience (C) Providing the updated algorithm only to teenage users to generate excitement about the new feature (D)Testing the updated algorithm with a small number of users in the city where the developers are located so that immediate feedback can be gathered

(B)Inviting a random sample of all users to try out the new algorithm and provide feedback before it is released to a wider audience

Which of the following is most likely to be a data privacy concern for RunRoutr users? (A)Users of the application are required to carry their smartphones with them while running in order to enable all of the application's features. (B)Users of the application may have the ability to determine information about the locations of users that are not on their contact lists. (C)Users of the application may not be able to accurately track their running history if they share their smartphone with another family member. (D) Users of the application may not be compatible with any other users in their area.

(B)Users of the application may have the ability to determine information about the locations of users that are not on their contact lists

A game is played by moving a game piece left or right along a horizontal game board. The board consists of spaces of various colors, as shown. The circle represents the initial location of the game piece. If a game is begun by placing the game piece on the rightmost black space for step 1, what will be the value of the counter at the end of the game? (A) 2 (B) 3 (C) 4 (D) 5

(C) 4

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? (A) 5 (B) 6 (C) 7 (D) 8

(C) 7

Which of the following best exemplifies the use of multi-factor authentication to protect an online banking system? (A)When a user resets a password for an online bank account, the user is required to enter the new password twice. (B)When multiple people have a shared online bank account, they are each required to have their own unique username and password.(C)After entering a password for an online bank account, a user must also enter a code that is sent to the user's phone via text message.(D)An online bank requires users to change their account passwords multiple times per year without using the same password twice.

(C) After entering a password for an online bank account, a user must also enter a code that is sent to the user's phone via text message.

The grid below contains a robot represented as a triangle, initially facing toward the top of the grid. The robot can move into a white or gray square but cannot move into a black region. Which of the following replacements for<MISSING CODE>can be used to move the robot to the gray square?

(C) IF(CAN_MOVE(left)) {ROTATE_LEFT()} MOVE_FORWARD()

Which of the following statements is true about the network? (A) Information sent from device A to device D can use at most two unique paths. (B) Information sent from device A to device I will pass through at most four other devices. (C) If devices B and F fail, then device A will not be able to communicate with device G. (D) If devices C and F fail, then device D will not be able to communicate with device H.

(C) If devices B and F fail, then device A will not be able to communicate with device G.

Businesses have the ability to target advertisements to different groups of people who use RunRoutr. Which of the following groups is LEAST likely to receive targeted advertisements? (A) Individuals who appear on each other's contact lists (B) Individuals who are interested in running and fitness (C) Individuals who sign up for a premium account (D) Individuals whose running routes begin or end near a particular business location

(C) Individuals who sign up for a premium account

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 numberListis increasing and return false otherwise. Assume that numberList contains at least two elements. Which of the following changes is needed for the program to work as intended? (A)In line 3,2should be changed to1. (B)In line 6,<should be changed to≥. (C) Lines 8 and 12 should be interchanged. (D) Lines 10 and 11 should be interchanged.

(C) Lines 8 and 12 should be interchanged.

Which of the following best describes a direct benefit in using redundant routing on the Internet? (A) Redundancy enables messages to be transmitted with as few packets as possible. (B) Redundancy enables network devices to communicate with as few network connections as possible. (C) Redundancy often allows messages to be sent on the network even if some network devices or connections have failed. (D) Redundancy prevents network communications from being intercepted by unauthorized individuals.

(C) Redundancy often allows messages to be sent on the network even if some network devices or connections have failed.

In which of the following situations would it be most appropriate to choose lossy compression over lossless compression? (A) Storing digital photographs to be printed and displayed in a large format in an art gallery (B) Storing a formatted text document to be restored to its original version for a print publication (C) Storing music files on a smartphone in order to maximize the number of songs that can be stored (D) Storing a video file on an external device in order to preserve the highest possible video quality

(C) Storing music files on a smartphone in order to maximize the number of songs that can be stored

Adrianna uses RunRoutr to suggest a running route. All compatible users near Adrianna receive a notification that shows her running route. Which of the following data is not obtained using data collected from Adrianna's smartphone but necessary for RunRoutr to share Adrianna's running route? A) Adrianna's average running speed (B) Adrianna's preferred running distance (C) The current locations of other RunRoutr users (D) The usernames on Adrianna's contact list

(C) The current locations of other RunRoutr users

A binary number is to be transformed by appending three 0s to the end of the number. For example, 11101 is transformed to 11101000. Which of the following correctly describes the relationship between the transformed number and the original number? (A) The transformed number is 3 times the value of the original number. (B) The transformed number is 4 times the value of the original number. (C) The transformed number is 8 times the value of the original number. (D) The transformed number is 1,000 times the value of the original number.

(C) The transformed number is 8 times the value of the original number.

Which of the following is NOT a possible value displayed by the program? (A)"artichoke" (B)"broccoli" (C)"carrot" (D)"daikon"

(C)"carrot"

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? (A)lenLENGTH(utensils)temp utensils[len]REMOVE(utensils, len)APPEND(utensils, temp) (B)lenLENGTH(utensils)REMOVE(utensils, len)temp utensils[len]APPEND(utensils, temp) (C)lenLENGTH(utensils)temp utensils[len]REMOVE(utensils, len)INSERT(utensils, 1, temp) (D)lenLENGTH(utensils)REMOVE(utensils, len)temp utensils[len]INSERT(utensils, 1, temp)

(C)lenLENGTH(utensils)temp utensils[len]REMOVE(utensils, len)INSERT(utensils, 1, temp)

Which of the following best explains the relationship between the Internet and the World Wide Web? (A) Both the Internet and the World Wide Web refer to the same interconnected network of devices. (B)The Internet is an interconnected network of data servers, and the World Wide Web is a network of user devices that communicates with the data servers. (C)The Internet is a local network of interconnected devices, and the World Wide Web is a global network that connects the local networks with each other. (D)The Internet is a network of interconnected networks, and the World Wide Web is a system of linked pages, programs, and files that is accessed via the Internet.

(D )The Internet is a network of interconnected networks, and the World Wide Web is a system of linked pages, programs, and files that is accessed via the Internet.

A local router is configured to limit the bandwidth of guest users connecting to the Internet. Which of the following best explains the result of this configuration as compared to a configuration in which the router does not limit the bandwidth? (A) The amount of time it takes guest users to send and receive large files is likely to decrease. (B) The number of packets required for guest users to send and receive data is likely to decrease. (C) Guest users will be prevented from having fault-tolerant routing on the Internet. (D) Guest users will be restricted in the maximum amount of data that they can send and receive per second.

(D) Guest users will be restricted in the maximum amount of data that they can send and receive per second.

Which of the following is an example of a phishing attack? (A)Loading malicious software onto a user's computer in order to secretly gain access to sensitive information (B) Flooding a user's computer with e-mail requests in order to cause the computer to crash (C) Gaining remote access to a user's computer in order to steal user IDs and passwords (D) Using fraudulent e-mails in order to trick a user into voluntarily providing sensitive information

(D) Using fraudulent e-mails in order to trick a user into voluntarily providing sensitive information

Which of the following initial values of j and k will cause the algorithm represented in the flowchart to result in an infinite loop? (A)j = -5,k = 5 (B)j = 0,k = 5 (C)j = 5,k = 0 (D)j = 5,k = -5

(D) j = 5,k = -5

Based on the algorithm represented in the flowchart, what value is displayed if j has the initial value 3 and k has the initial value4? (A)7 (B)9 (C)10 (D)12

(D)12

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? (A)Internet users with a copy of the information might redistribute the personal information without first seeking permission. (B)There are potentially an extremely large number of devices on the Internet that may contain the information. (C) Automated technologies collect information about Internet users without their knowledge. (D)All personal information is stored online using authentication measures, making the information hard to access.

(D)All personal information is stored online using authentication measures, making the information hard to access.

In the following procedure, the parameter n is an integer greater than2. Which of the following best describes the value returned by the procedure? (A) The procedure returns nothing because it will not terminate.(B)The procedure returns the value of2 * n. (C)The procedure returns the value of n * n. (D)The procedure returns the sum of the integers from 1 to n.

(D)The procedure returns the sum of the integers from 1 to n.

A scientist wants to investigate several problems. In which of the following situations is using a simulation LEAST suitable for solving a problem? (A)When a scientific study requires performing a large number of trials that need to be conducted very quickly (B)When it is considered acceptable to make simplifying assumptions when modeling a real-world object or phenomenon (C) When performing an experiment that would be too costly or dangerous to conduct in the real world (D)When the solution to the problem requires real-world data inputs that are continually measured at regular intervals.

(D)When the solution to the problem requires real-world data inputs that are continually measured at regular intervals.


Set pelajaran terkait

Chapter 14 Building Positive Employee Relations

View Set

Chapter 6: Human Behavior and Organizational Environment

View Set

PEDS Exam #1 Ch. 23: The Child with Respiratory Dysfunction

View Set

Test 3 investments CH. - 7,8,9,&10

View Set

Old Testament History and Literature

View Set