AP Computer Science Midterm Questions
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.
A
ccording to the domain name system (DNS), which of the following is a subdomain of the domain example.com? A. about.example.com B. example.co.uk C. example.com.org D. example.org
A
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? l. The author wants to make the e-book available as a free download. ll. The author wants to prevent people from sharing copies of the e-book on peer-to-peer networks. lll. The author wants to allow people permission to use and modify the e-book. A. I only B. II only C. I and III D. II and III
C
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem? A. When the problem can be solved in a reasonable time and an approximate solution is acceptable B. When the problem can be solved in a reasonable time and an exact solution is needed C. When the problem cannot be solved in a reasonable time and an approximate solution is acceptable D. When the problem cannot be solved in a reasonable time and an exact solution is needed
C
Which of the following is a true statement about data compression? A. Data compression is only useful for files being transmitted over the Internet. B. Regardless of the compression technique used, once a data file is compressed, it cannot be restored to its original state. C. Sending a compressed version of a file ensures that the contents of the file cannot be intercepted by an unauthorized user. D. There are trade-offs involved in choosing a compression technique for storing and transmitting data.
D
Which of the following statements is true? A. Every problem can be solved with an algorithm for all possible inputs, in a reasonable amount of time, using a modern computer. B. Every problem can be solved with an algorithm for all possible inputs, but some will take more than 100 years, even with the fastest possible computer. C. Every problem can be solved with an algorithm for all possible inputs, but some of these algorithms have not been discovered yet. D. There exist problems that no algorithm will ever be able to solve for all possible inputs.
D
A program is expressed in a programming language. Which of the following is true of the program? 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? 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
A user enters a Web address in a browser, and a request for a file is sent to a Web server. Which of the following best describes how the file is sent to the user? A. The file is broken into packets for transmission. The packets must be reassembled upon receipt. B. The file is broken into packets for transmission. The user's browser must request each packet in order until all packets are received. C. The server attempts to connect directly to the user's computer. If the connection is successful, the entire file is sent. If the connection is unsuccessful, an error message is sent to the user. D. The server repeatedly attempts to connect directly to the user's computer until a connection is made. Once the connection is made, the entire file is sent.
A
The diagram below shows a circuit composed of two logic gates labeled OR and AND. Each gate takes two inputs and produces a single output. If the inputs A and C are both true, which of the following best describes the output of the AND gate? A. The output will be true no matter what the value of input B is. B. The output will be false no matter what the value of input B is. C. The output will be true if input B is true; otherwise it will be false. D. The output will be false if input B is true; otherwise it will be true.
A
The figure below shows a circuit composed of two logic gates. The output of the circuit is true. Which of the following is a true statement about input A? A. Input A must be true. B. Input A must be false. C. Input A can be either true or false. D. There is no possible value of input A that will cause the circuit to have the output true.
A
The question below uses a robot in a grid of sq... 0/1 MC point The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the bottom-left square of the grid and facing toward the top of the grid. Code for the procedure Mystery is shown below. Assume that the parameter p has been assigned a positive integer value (e.g., 1, 2, 3, ...). Which of the following shows a possible result of calling the procedure? A. Grid 1 (bottom middle of grid) B. Grip 2 (far right side on grid) C. Grid 3 (bottom corner) D. Grid 4 (middle of grid)
A
Two lists, list1 and list2, 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 list1 contains ["Macbeth", "Frankenstein", "Jane Eyre"] and list2 contains ["Frankenstein", "Dracula", "Macbeth", "Hamlet"], then newList will contain ["Dracula", "Frankenstein", "Hamlet", "Jane Eyre", "Macbeth"]. The following procedures are available to create newList. Which of the following code segments will correctly create newList ? A. newList ← Combine (list1, list2) newList ← Sort (newList) newList ← RemoveDuplicates (newList) B. list1 ← Sort (list1) list2 ← Sort (list2) newList ← Combine (list1, list2) newList ← RemoveDuplicates (newList) C. list1 ← RemoveDuplicates (list1) list2 ← RemoveDuplicates (list2) newList ← Combine (list1, list2) newList ← Sort (newList) D. list1 ← RemoveDuplicates (list1) list1 ← Sort (list1) list2 ← RemoveDuplicates (list2) list2 ← Sort (list2) newList ← Combine (list1, list2)
A
Which of the following are true statements about digital certificates in Web browsers? l. Digital certificates are used to verify the ownership of encrypted keys used in secured communication. ll. Digital certificates are used to verify that the connection to a Web site is fault tolerant. A. I only B. II only C. I and II D. Neither I nor II
A
Which of the following has the greatest potential for compromising a user's personal privacy? 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 is LEAST likely to indicate a phishing attack? 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
flowchart is a way to visually represent an algorithm. The flowchart below uses the following building blocks. What is displayed as a result of executing the algorithm in the flowchart? A. 5 B. 15 C. 1 2 3 4 D. 1 2 3 4 5
A
onsider the following code segment. j <-- 1 Repeat UNTIl <missing condition j <-- j +2 Which of the following replacements for <MISSING CONDITION> will result in an infinite loop? A. j = 6 B. j ≥ 6 C. j = 7 D. j > 7
A
retailer that sells footwear maintains a single database containing records with the following information about each item for sale in the retailer's store. - Item identification number - Footwear type (sneakers, - ----- boots, sandals, etc.) - Selling price (in dollars) - Size - Color - Quantity available Using only the database, which of the following can be determined? A. Which items listed in the database are not currently in the store B. Which colors are more popular among men than women C. Which type of footwear is most popular among adults D. The total number of shoes sold in a particular month
A
A cable television company stores information about movie purchases made by subscribers. Each day, the following information is summarized and stored in a publicly available database. The day and date each movie was purchased The title of each movie purchased The cities where subscribers purchased each movie The number of times each movie was purchased by subscribers in a given city A sample portion of the database is shown below. The database is sorted by date and movie title. Which of the following CANNOT be determined using only the information in the database? A. The date when a certain movie was purchased the greatest number of times B. The number of movies purchased by an individual subscriber for a particular month C. The total number of cities in which a certain movie was purchased D. The total number of movies purchased in a certain city during a particular month
B
A certain computer game is played between a human player and a computer-controlled player. Every time the computer-controlled player has a turn, the game runs slowly because the computer evaluates all potential moves and selects the best one. Which of the following best describes the possibility of improving the running speed of the game? A. The game's running speed can only be improved if the game is played between two human players instead of with the computer-controlled player. B. The game's running speed might be improved by using a process that finds approximate solutions every time the computer-controlled player has a turn. C. The game's running speed cannot be improved because computers can only be programmed to find the best possible solution. D. The game's running speed cannot be improved because the game is an example of an algorithm that does not run in a reasonable time.
B
A code segment will be used to swap the values of the variables a and b using the temporary variable temp. Which of the following code segments correctly swaps the values of a and b ? A. a <-- b temp <-- a b <-- temp B. temp <-- a a <-- b b <--- temp C. temp <-- a a <-- temp a <-- b D. temp <-- a a <-- temp a <-- b
B
A large data set contains information about all students majoring in computer science in colleges across the United States. The data set contains the following information about each student. - The student's gender - The state in which the student attends college - The student's grade point average on a 4.0 scale Which of the following questions could be answered by analyzing only information in the data set? A. Do students majoring in computer science tend to have higher grade point averages than students majoring in other subjects? B. How many states have a higher percentage of female computer science majors than male computer science majors attending college in that state? C. What percent of students attending college in a certain state are majoring in computer science? D. Which college has the highest number of students majoring in computer science?
B
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? 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
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
B
Both online newspapers and social media sites are used to distribute information on the Internet. Which of the following best describes an advantage that online newspapers have over social media sites? A. The ability to distribute information instantaneously B. The ability to provide credibility to the information distributed C. The ability to provide information that is widely accessible D. The ability to provide media-rich content for low cost
B
Central High School keeps a database of information about each student, including the numeric variables numberOfAbsences 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? A. numberOfAbsences = 3, gradePointAverage = 3. 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? 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., 1, 2, 3, ...) result <-- 0 REPEAT 3 TIMES REPEAT y TIMES result <-- result + 1 What is the value of result after running the program? A. y + 3 B. 3y C. y3 D. 3y
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? 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
The code segment below uses the procedure IsFound (list, item), which returns true if item appears in list and returns false otherwise. The list resultList is initially empty. FOR EACH item IN inputList1 { IF (IsFound (inputList2, item) { APPEND (resultList, item) } } Which of the following best describes the contents of resultList after the code segment is executed? A. All elements in inputList1 followed by all elements in inputList2 B. Only elements that appear in both inputList1 and inputList2 C. Only elements that appear in either inputList1 or inputList2 but not in both lists D. Only elements that appear in inputList1 but not in inputList2
B
The figure below represents a network of physically linked computers labeled A through G. A line between two computers indicates that the computers can communicate directly with each other. Any information sent between two computers that are not directly connected must go through at least one other computer. For example, information can be sent directly between computers A and B, but information sent between computers A and C must go through other computers. Which of the following statements about security in the network is true? Computers A and D need to communicate with at least two additional computers in the network in order to communicate with each other. Computers B and C can communicate with each other without additional computers being aware of the communication. A. I only B. II only C. I and II D. Neither I nor II
B
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 of the grid and facing toward the top of the grid. The following code segment is used to move the robot within the grid. x <---- Random ( 1, 3) REPEAT x TIMES { ROTATE_RIGHT () } y <--- RANDOM ( 1, 2) REPEAT y TIMES { MOVE_FORWARD () } A gray square represents a possible final location of the robot after the code segment is executed. Which of the following represents all possible final locations for the robot? A. Grid 1 ( one squ. shaded up, down, sides} B. Grid 2 (shaded in on both sides and downwards) C. Grid 3 (shaded up, on right, and downward) D. Grid 4 (2 squ. shaded up, down, sides
B
The table below shows the time a computer system takes to complete a specified task on the customer data of different-sized companies. Based on the information in the table, which of the following tasks is likely to take the longest amount of time when scaled up for a very large company of approximately 100,000 customers? A. Backing up data B. Deleting entries from data C. Searching through data D. Sorting data
B
Which of the following best describes a Distributed Denial of Service (DDoS) attack? A. An attempt by a country to deny its citizens access to the Internet B. An attempt to deny users access to a Web site's resources by flooding the Web site with requests from multiple systems C. An attempt by one user to deny service to another user by posting material on a social network D. An attempt by a user of the Internet to get private information from a secure database
B
Which of the following best explains what happens when a new device is connected to the Internet? 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? 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 (IP), and simple mail transfer protocol (SMTP) to transfer data
B
onsider the code segment below. If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment? A. Is anyone there? B. Better late than never. C. Hello. Is anyone there? D. Hello. Better late than never.
B
A certain social media Web site allows users to post messages and to comment on other messages that have been posted. When a user posts a message, the message itself is considered data. In addition to the data, the site stores the following metadata. - The time the message was posted - The name of the user who posted the message - The names of any users who comment on the message and the times the comments were made For which of the following goals would it be more useful to analyze the data instead of the metadata? A. To determine the users who post messages most frequently B. To determine the time of day that the site is most active C. To determine the topics that many users are posting about D. To determine which posts from a particular user have received the greatest number of comments
C
A city government is attempting to reduce the digital divide between groups with differing access to computing and the Internet. Which of the following activities is LEAST likely to be effective in this purpose? A. Holding basic computer classes at community centers B. Providing free wireless Internet connections at locations in low-income neighborhoods C. Putting all government forms on the city Web site D. Requiring that every city school has computers that meet a minimum hardware and software standard
C
A programmer completes the user manual for a video game she has developed and realizes she has reversed the roles of goats and sheep throughout the text. Consider the programmer's goal of changing all occurrences of "goats" to "sheep" and all occurrences of "sheep" to "goats." The programmer will use the fact that the word "foxes" does not appear anywhere in the original text. Which of the following algorithms can be used to accomplish the programmer's goal? A. First, change all occurrences of "goats" to "sheep." Then, change all occurrences of "sheep" to "goats." B. First, change all occurrences of "goats" to "sheep." Then, change all occurrences of "sheep" to "goats." Last, change all occurrences of "foxes" to "sheep." C. First, change all occurrences of "goats" to "foxes." Then, change all occurrences of "sheep" to "goats." Last, change all occurrences of "foxes" to "sheep." D. First, change all occurrences of "goats" to "foxes." Then, change all occurrences of "foxes" to "sheep." Last, change all occurrences of "sheep" to "goats."
C
A programmer wrote the program below. The program uses a list of numbers called numList. The program is intended to display the sum of the numbers in the list. sum <-- numList 1 FOR EACH value IN numList sum <-- sum + value DISPLAY sum In order to test the program, the programmer initializes numList to [0, 1, 4, 5]. The program displays 10, and the programmer concludes that the program works as intended. Which of the following is true? A. The conclusion is correct; the program works as intended. B. The conclusion is incorrect; the program does not display the correct value for the test case [0, 1, 4, 5]. C. The conclusion is incorrect; using the test case [0, 1, 4, 5] is not sufficient to conclude the program is correct. D. The conclusion is incorrect; using the test case [0, 1, 4, 5] only confirms that the program works for lists in increasing order.
C
A video-streaming Web site uses 32-bit integers to count the number of times each video has been played. In anticipation of some videos being played more times than can be represented with 32 bits, the Web site is planning to change to 64-bit integers for the counter. Which of the following best describes the result of using 64-bit integers instead of 32-bit integers? A. 2 times as many values can be represented. B. 32 times as many values can be represented. C. 232 times as many values can be represented. D. 322 times as many values can be represented.
C
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
C
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
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? A. Iteration B. Searching C. Selection D. Sequencing
C
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? 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 − 1. D. Neither algorithm will correctly identify the maximum value when the input contains both positive and negative input values.
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? 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
Biologists often attach tracking collars to wild animals. For each animal, the following geolocation data is collected at frequent intervals. - The time - The date - The location of the animal Which of the following questions about a particular animal could NOT be answered using only the data collected from the tracking collars? A. Approximately how many miles did the animal travel in one week? B. Does the animal travel in groups with other tracked animals? C. Do the movement patterns of the animal vary according to the weather? D. In what geographic locations does the animal typically travel?
C
Digital images are often represented by the red, green, and blue values (an RGB triplet) of each individual pixel in the image. A photographer is manipulating a digital image and overwriting the original image. Which of the following describes a lossless transformation of the digital image? A. Compressing the image in a way that may lose information but will suffer only a small loss of image quality. B. Creating the gray scale of an image by averaging the amounts of red, green, and blue in each pixel and assigning this new value to the corresponding pixel in the new image. The new value of each pixel represents a shade of gray, ranging from white to black. C. Creating the negative of an image by creating a new RGB triplet for each pixel in which each value is calculated by subtracting the original value from 255. The negative of an image is reversed from the original;light areas appear dark, and colors are reversed. D. Modifying part of the image by taking the pixels in one part of the picture and copying them to the pixels in another part of the picture.
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? 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? 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
There are 32 students standing in a classroom. Two different algorithms are given for finding the average height of the students. Algorithm A Step 1: All students stand. Step 2: A randomly selected student writes his or her height on a card and is seated. Step 3: A randomly selected standing student adds his or her height to the value on the card, records the new value on the card, and is seated. The previous value on the card is erased. Step 4: Repeat step 3 until no students remain standing. Step 5: The sum on the card is divided by 32. The result is given to the teacher. Algorithm B Step 1: All students stand. Step 2: Each student is given a card. Each student writes his or her height on the card. Step 3: Standing students form random pairs at the same time. Each pair adds the numbers written on their cards and writes the result on one student's card; the other student is seated. The previous value on the card is erased. Step 4: Repeat step 3 until one student remains standing. Step 5: The sum on the last student's card is divided by 32. The result is given to the teacher. Which of the following statements is true? A. Algorithm A always calculates the correct average, but Algorithm B does not. B. Algorithm B always calculates the correct average, but Algorithm A does not. C. Both Algorithm A and Algorithm B always calculate the correct average. D. Neither Algorithm A nor Algorithm B calculates the correct average.
C
When a cellular telephone user places a call, the carrier transmits the caller's voice as well as the voice of the person who is called. The encoded voices are the data of the call. In addition to transmitting the data, the carrier also stores metadata. The metadata of the call include information such as the time the call is placed and the phone numbers of both participants. For which of the following goals would it be more useful to computationally analyze the metadata instead of the data? - To determine if a caller frequently uses a specific word - To estimate the number of phone calls that will be placed next Monday between 10:30 A.M. and noon. - To generate a list of criminal suspects when given the telephone number of a known criminal A. I only B. II only C. II and III only D. I, II, and III
C
Which of the following activities poses the greatest personal cybersecurity risk? 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
Which of the following is a true statement about cloud computing? 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
Which of the following is considered an unethical use of computer resources? A. Downloading freeware or shareware onto your home computer B. Purchasing a game from an app store and downloading it directly to a mobile device C. Purchasing a single-user copy of photo editing software and installing it on all the computers in a computer lab D. Searching online for an electronic version of a school textbook
C
Which of the following programs is most likely to benefit from the use of a heuristic? A. A program that calculates a student's grade based on the student's quiz and homework scores B. A program that encrypts a folder of digital files C. A program that finds the shortest driving route between two locations on a map D. A program that sorts a list of numbers in order from least to greatest
C
Which of the following statements describes a limitation of using a computer simulation to model a real-world object or system? A. Computer simulations can only be built after the real-world object or system has been created. B. Computer simulations only run on very powerful computers that are not available to the general public. C. Computer simulations usually make some simplifying assumptions about the real-world object or system being modeled. D. It is difficult to change input parameters or conditions when using computer simulations.
C
onsider the following code segment, which uses the variables r, s, and t. r ← 1 s ← 2 t ← 3 r ← s s ← t DISPLAY (r) DISPLAY (s) What is displayed as a result of running the code segment? A. 1 1 B. 1 2 C. 2 3 D. 3 2
C
A car manufacturer uses simulation software during the design process for a new car. Which of the following is reasons to use simulation software in this context? l. Using simulation software can save the company money by helping to compare designs early in the process before prototype cars are built. ll. 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. lll. 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
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? 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 num 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? A. Interchanging line 1 and line 2 B. Interchanging line 5 and line 6 C. Interchanging line 6 and line7 D. Interchanging line 7 and line 8
D
An Internet service provider (ISP) is considering an update to its servers that would save copies of the Web pages most frequently visited by each user. Which of the following is LEAST likely to occur as a result of the update? A. Average response time for user requests might decrease. B. Privacy of users might be negatively affected. C. Storage requirements for the servers might increase. D. Web sites that are not visited frequently might no longer be accessible to users.
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 1: Initialize the variables heads_counter and flip_counter to 0. Step 2: A variable coin_flip is randomly assigned a value of either 0 or 1. If coin_flip has the value 0, the coin flip result is heads, so heads_counter is incremented by 1. Step 3: Increment the value of flip_counter by 1. Step 4: Repeat steps 2 and 3 until flip_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? A. coin_flip = 1 B. flip_counter = 1 C. flip_counter = 2 D. head_counter = 2
D
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? A. (num MOD 1) = 0 B. (num MOD 1) = 1 C. (num MOD 2) = 0 D. (num MOD 2) = 1
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? 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