AP Computer Science College Board Review CB#1 - CB#3

Ace your homework & exams now with Quizwiz!

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 5

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 An overflow error occurred.

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 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.

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 The song was saved using fewer bits per second than the original song.

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 Which items listed in the database are not currently in the store

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 Choice A has three boxes in a column.In choice A the top box reads a left arrow b, the middle box reads temp left arrow a, and the bottom box reads b left arrow temp. B Choice B has three boxes in a column. In choice B the top box reads temp left arrow a, the middle box reads a left arrow b, and the bottom box reads b left arrow temp. C Choice C has three boxes in a column. In choice C the top box reads temp left arrow a, the middle box reads a left arrow temp, and the bottom box reads b left arrow a. D Choice D has three boxes in a column. In choice D the top box reads temp left arrow a, the middle box reads b left arrow temp, and the bottom box reads a left arrow b.

B Choice B has three boxes in a column. In choice B the top box reads temp left arrow a, the middle box reads a left arrow b, and the bottom box reads b left arrow temp.

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 Generally, the advantage of using a binary search over a linear search increases as the size of the list increases.

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 How many programming statements the program contains

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 How many states have a higher percentage of female computer science majors than male computer science majors attending college in that state?

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 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.

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 The number of movies purchased by an individual subscriber for a particular month

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 First, change all occurrences of "goats" to "foxes." Then, change all occurrences of "sheep" to "goats." Last, change all occurrences of "foxes" to "sheep."

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 Putting all government forms on the city Web site

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. A segment of code is shown. At the top is a white box that reads sum left arrow numList, then the number 1 in a square. This is at the top left corner of a larger grey box, at the top of which it reads FOR EACH value IN numList. Below this in the grey box and indented is a white box that reads sum left arrow sum plus value. Below the larger grey box at its lower left corner is a white box that reads DISPLAY, then sum, which is in a rectangle. 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 The conclusion is incorrect; using the test case [0, 1, 4, 5] is not sufficient to conclude the program is correct.

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 To determine the topics that many users are posting about

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

D I, II, and III

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. text... 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 line 7 D Interchanging line 7 and line 8

D Interchanging line 7 and line 8

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 The simulation will not produce usable results because actual customer data are not available.


Related study sets

What is the relationship between literature and place?

View Set

Ch. 6: Funding the Public Sector

View Set

Thoracic Surgery and Chest Tubes- 7 questions

View Set

Eukaryotic and Prokaryotic Cells

View Set

Washington Laws, Rules and Regulations

View Set

Chpt 13 ABC, Chpt 12 ABC, Chpt 11 ABC, Chapt. 10 ABC

View Set

Nutrition chapter 13- Trace minerals

View Set