APCSP exam
A student is writing a program to model different real-world events using simulations. Which of the following simulations will generate a result that would best be stored using a Boolean variable?
A; A simulation of a flipping a fair coin
Which of the following best describes the purpose of machine learning programs?
A; To analyze large data sets, recognize patterns, and make predictions based on data
Same prompt as 25. For which of the following strings is it NOT possible to use byte pair encoding to shorten the string's length?
B; "LEVEL_UP"
Which of the following is an example of symmetric encryption?
B; Finn and Gwenn.....
Which of the following describes how a distributed denial-of-service (DDoS) attack is most likely to compromise an online store's Web site?
C; By preventing customers from placing their orders
Which of the following is a true statement about internet communication?
C; Every device connected to the internet is assigned an IP address
A NAND gate is a type of logic gate that produces an output of false only when both of its two inputs are true. Otherwise, the gate produces an output of true. Which of the following Boolean expressions correctly models a NAND gate with inputs P and Q?
C; NOT ( P and Q)
A video streaming service maintains a database of information about its customers and the videos they have watched. Which of the following best approximates the amount of time it takes the program to execute?
D; 5 hours
Same prompt at question 13. Which of the following hypotheses is most consistent with the data in the table?
D; The mobile app release led to users tending to write shorter message.
Which of the following allows uses to refer to Web sites using names, such as example.com, rather than numbers, such as 93.184.216.34?
B; The domain name system (DNS)
A media librarian at a movie studio is planning to save digital video files for archival purposes. The movie studio would like to be able to access full-quality videos if they are needed for future projects. Which of the following actions is LEAST likely to support the studio's goal?
B; Using lossy compression software to reduce the size requirements of the data being stored
The code segment below is intended to swap the values of the variables first and second using a temporary variable, temp. Which of the following can be used to replace <missing code> so that the code segment works as intended.
B; second <--- temp
Which of the following is an underlying assumption that is made when Moore's law is used?
C; As computer hardware improves, future computers will be able to run faster than current computers.
Which of the following describes a benefit of using hexadecimal numbers instead of binary numbers to represent data?
D; A hexadecimal representation of a value generally requires fewer digits than a binary representation of the same value
Which of the following actions could be uses to help reduce the digital device?
D; I, II, III
Two different schools maintain data sets about their currently enrolled students. No individual student is enrolled at both schools. Each line of data contains information, separated by commas about on student. The two schools would like to combine their data to make a single data set. Which of the following can be done with the combined date? Select two answers.
A & B; The schools can create a single list of students names, sorted by last name: The schools can determine the average number of days students are absent.
Which of the following are ways in which a programmer can use abstraction to manage the complexity of a program? Select two answers.
A & D; Replacing each instance of repeated code with a call to procedure: Replacing the string variables name1, name2, name3, and name4 with a list of strings called names
The diagram below shows a circuit composed of three logic gates. Each gate takes two inputs and produces a single output. For which of the following input values will the circuit have an output of false?
A; A=true, B=false, C=false, D=false
A library of e-books contains metadata for each book. The metadata are intended to help a search feature find books that users are interested in. Which of the following is LEAST likely to be contained in the metadata of each e-book.
A; An archive containing previous versions of the e-book.
Which of the following best describes the role of Internet Engineering Task Force (IETF)?
A; Developing standard and protocols for internet communication.
Which of the following are true statements about how the Internet enables crowd sourcing?
A; I and II only- The internet can provide crowd sourcing participants access to useful tools; The speed and reach of the internet can lower geographic barriers, allowing individuals from different locations to contribute to projects.
An application program interface (API) provides a procedure Max, which returns the greater of its two integer arguments. A programmer would like to find the greatest of three integer values a, b, and c. Which of the following expressions will produce the desired result in every case?
A; Max (Max (a, b), c)
Which of the following explains a benefit of using open standards and protocols for Internet Communication?
A; Open standards and protocols allow different manufacturers and developers to build hardware and software that can communicate with hardware and software on the rest of the network.
Participants in a survey were asked how many hours per day they spend reading, how many hours per day they spend using a smartphone, and whether or not they would be interested in a smartphone application that lets users share book reviews. The data from the survey are represented in the graph below. Each x represents a survey participant who said he or she was interested in the application, and O represents a participant who said he or she was not interested. Which of the following hypotheses is most consistent with the data in the graph?
A; Participants who read more were generally more likely to say they are interested in the application
An online retailer uses an algorithm to sort a list of n items by price. The table below shows the approximate number of steps the algorithm takes to sort lists of different sizes. Based on the values in the table, which of the following best characterizes the algorithm for very large values of n?
A; The algorithm runs in reasonable time
The grid below contains a robot represented as a triangle, initially facing up. The robot can move into a white or gray square but cannot move into a black region. The code segment below uses the procedure GoalReached, which evaluates to true if the robot in the gray square and evaluates to false otherwise. Which of the following replacements for <missing code> can be used to move the robot to the gray square.
A; if (can move (right)) rotate right, move forward
A flowchart is a way to visually represent an algorithm. The flowchart below is used by an apartment rental Web site to set the variable include to true for apartments that meet the certain criteria. Which of the following statements is equivalent to the algorithm in the flowchart?
A; inclue <-- (floor>10) or (bedrooms=3)
Which of the following statements describe how cloud computing has affected Internet communication? Select two answers.
B & C; Cloud computing has helped enhance collaboration: Cloud computing has introduced new data-security concerns.
Which of the following statements accurately describe the hierarchy of web pages example.org and about.example.org? Select two answers.
B & C; The web page about.example.org is a subdomain of example.org: The web page example.org is a domain under the top-level domain .org
The program below is intended to count the number of prime numbers in a list called numbers and display the result. The program uses the procedure isPrime (n), which returns true if n is a prime number false otherwise. The program does not work as intended. Which two lines of code should be removed so that the program will work as intended?
B & D; Line 4: Line 9
A program is created to perform arithmetic operations on positive and negative integers. The program contains the following incorrect procedure, which is intended to return the product of the integers x and y. A programmer suspects that an error in the program is caused by this procedure. Under which of the following conditions will the procedure NOT return the correct product?Select two answers.
B & D; When the value of x is positive and the value of y is negative: When the values of x and y are both negative.
A social media site allows users to send messages to each other. A group of researchers gathered user data for the first 10 years of the site's existence. Some of the data are summarized in the table below along with some of the company milestones. The researches noticed that the total number of registered users appears to be increasing at about a constant rate. If this pattern continues, which of the following best approximates the total number of registered users, in millions, in year 12?
B; 31.2
A student wrote the following code for a guessing game. While debugging the code, the student realizes that the loop never terminates. The student plans to insert the instruction win<-- true somewhere in the code. Where could win <--- true be inserted so that the code segment works as intended.
B; Between line 9 and line 10
A bank customer receives an email from a sender claiming to be a bank employee. The email asks the customer to provide personal information and to call a phone number if he or she has any questions. The customer suspects the email might be a phishing attempt. Which of the following responses is most likely to be a privacy risk for the bank customer?
B; Calling the phone number given in the email and providing the personal information over the phone.
A program contains the following procedures for string manipulation. Which of the following expressions can be used to generate the string "Happy"?
B; Concat (Substring ("Harp",1,2), Substring ("Puppy",3,3))
A smartphone stores the following data for each photo that is taken using the phone; file name of photo, the date and time, the location. Assume that all of the photos that have been taken on the phone are accessible. Which of the following can be determined using the photo data described above?
B; I & II, The number of photos that were taken at a particular geographic location and the number of photos that were taken in the last year.
The procedure below searches for the value target in list. It returns true if the target is found and returns false otherwise. Which of the following are true statements about the procedure?
B; II only- It implements a linear search
A computer program uses 4 bits to represent non negative integers. Which of the following statements describe a possible result when the program uses this number representation?
B; II only- the operation 7 + 10 will result in an overflow error
The following question uses a robot in a grid of squares. The robot is represented by a triangle which is initially facing right. Which of the following code segments will move the robot to the gray square?
B; MoveXTimes 2 RightXTimes 3 MoveXTimes 3
A computer program performs the operation 2/3 and represents the result as a value 0.666667. Which of the following best explains this result?
B; The precision of the result is limited due to the constraints of using a floating-point representation.
Same prompt at 45. A programmer is writing a procedure to calculate a student's final grade in the course using the exam replacement policy as described above. The student's exam scores are stored in the variable midtermExam and finalExam. The procedure Max (a,b) returns the larger of a and b. Which of the following could be used in the procedure to calculate a students final points earned in the course and store the result of the variable adjustedTotal?
B; adjusted total <--- Max (midtermExam, finalExam) + final exam
A student is creating a procedure to determine whether the weather for a particular month was considered very hot. The procedure takes as input a list containing daily high temperatures for a particular month. The procedure is intended to return true if the daily high temperature was at least 90 degrees for a majority of days in the month and return otherwise. Which of the following can be used to replace <missing code> so that the procedure works are intended?
B; counter > .5 * total
The following figures represent different ways of configuring a network of physically linked computers labeled P, Q, R, ans S. A line between two computers indicates that the computers can communicate directly with each other. In which configuration is it NOT possible to have redundant routing between computers P and S.
B; figure shaped like a N
The procedure DrawCircle (x,y,r) can be used to draw a circle on a coordinate gird. The circle is centered at the coordinate (x,y) and has a radius of r units. The procedure will be used to draw the following figure on a coordinate grid. Which of the following code segments can be used to draw the figure?
B; xpos <--3 ypos <--6 xpos <-- xpos + 2 ypos <-- ypos - 2
A free online encyclopedia contains articles that can be written and edited by an user. Which of the following are advantages the online encyclopedia has over the traditional paper-based encyclopedia? Select two answers.
C & D; The ability to have a larger number of perspectives reflected in the encyclopedia content: The ability to quickly update encyclopedia content as new information becomes available
The procedure Smallest intended to return the least value in the list numbers. The procedure does not work as intended. For which of the following values of theList will Smallest NOT return the intended value? Select two answers.
C & D; theList<--(30,40,20,10): theList<--(40,30,20,10)
The code segment below intended to display all multiples of 5 between the values start and end, inclusive. For example, if start has the value of 35 and end has the value of 50, the code segment should display 35, 40, 45, and 50. Assume the stat and end are multiples of 5 and that start is less than end. Which of the following could replace <missing expression> in line 2 so that the code segment works as intended?
C; ( (end-start) / 5) + 1
Consider the following program, which uses the variables start, end, and current. What is displayed as a result of executing the program? start <-- 1 end <--20 current<--3 etc...
C; 3 4
A color is often represented by a 6-digit hexadecimal number that describes how the colors red, green, and blue are mixed together to create the desired color. From left to right, the first two digits represent the amount of red, the second two digits represent the amount of green, and the last two digits represent the amount of blue. Which of the following hexadecimal numbers represents the color with the greatest amount of blue in it?
C; A100B0
Which of the following would be the best use of citizen science?
C; An experiment that requires data measurements to be taken into many different locations.
The two code segments below are each intended to display to average of the numbers in the list numList. Assume the numList contains more than one value. Which of the following best describes the two code segments?
C; Both code segments display the correct average, but code segment I requires more arithmetic operations than code segment II
The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the bottom right square of the grid facing toward the top of the grid. The following programs are each intended to move the robot to the gray square. Program II uses the procedure GoalReached, which returns true if the robot is in the gray square and returns false otherwise. Which of the following statements is true?
C; Both program I and program II correctly move the robot to the gray square
Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string more than once and replaces each instance of that pair with a corresponding character that does not appear in the string. The algorithm saves a list containing the mapping of character pairs to their corresponding replacement characters. Which of the following statements about byte pair encoding is true?
C; Byte pair encoding is an example of a lossless transformation because an encoded string can be restored to its original version
The ticket prices at a movie theater are given below. A programmer is creating an algorithm to set the value you ticketPrice based on the information in the table. The programmer uses the integer variable age for the ago of the moviegoer. The Boolean variable is3D is true when the movie is 3-D and false otherwise. Which of the following code segments correctly sets the value of ticketPrice?
C; IF, IF, ticket price <--- ticket price +5
A snack bar has a frequent customer program in which every 10th purchase is free. Customers are enrolled in the program when they make their first purchase. A programmer is writing a program to implement the frequent customer program. Which of the following code segments will set cost to 0 for every 10th purchase a customer makes after enrolling in the frequent customer purchase?
C; If (count MOD 10=0) cost <--- 0
Which of the following best compares the values displayed by programs A and B?
C; Program A and program B display the same number of values, but the values differ.
A population researcher is interested in predicting the number of births that will occur in a particular community. She created a computer model that uses the data from the past ten years, including number of residents and the number of babies born. The model predicted there would be 200 births last year, but the actual number of births last year was only 120. Which of the following strategies is LEAST likely to provide a more accurate prediction?
C; Removing as many details from the model as possible so that the calculations can be performed quickly.
Internet protocol version 4 represents each IP address as a 32-bit binary number. Internet protocol version 6 represents each IP address as a 128-bit number. Which of the following best describes the result of using 128-bit addresses instead of 32-bit addresses.
D; 2^96 times as many addresses are available
A text-editing application uses binary sequences to represent each of 200 different characters. What is the minimum number of bits needed to assign a unique bit sequence to each of the possible characters?
D; 8
Which of the following best characterizes a high-level programming language?
D; A language that uses multiple abstractions to manage complexity.
Grades in the CS course are based on total points earned on a midterm exam and a final exam. The teaches provides a way for students to improve their course grades if they receive high scores on the final exam: if a students final exam score is greater than the student's midterm exam score, the final exam score replaces the midterm exam score in the calculation of total points. The teacher has data representing the scores of thousands of students. For each student, the data contains the student name, the midterm exam score, and the result of the total points calculation. Which of the following could be determined from the data?
D; I,II,III
A programmer is developing a word game. The programmer wants to crate an algorithm that will take a list of words and return a list containing the first letter of all the words that are palindromes (words that read the same forward or backwards) . The programmer knows that the following steps are necessary for the algorithm but is not sure in which order they should be executed. Executing which of the following sequences of steps will enable the algorithm to work as intended?
D; II and III- First keep the palindromes, then shorten, then sort. First sort, then keep the palindromes, then shorten.
Which of the following best describes one of the benefits of using an iterative and incremental process of program development?
D; It helps programmers identify errors as components are added to a working program.
A student wants to create an algorithm that can determine, given any program and program input, whether or not the program will go into an infinite loop for that input. The problem the student is attempting to solve is considered an undecidable problem. Which of the following is true?
D; It is not possible to create an algorithm that will solve the problem for all programs and inputs
The latency of a network connection is most appropriately measured with which of the following units?
D; Milliseconds
A programmer notices the following procedures in a library. The procedures do similar, but not identical, things. Which of the following procedures is a generalization of the procedures described above?
D; Procedure Power (n,m) which returns the value n^m
In a certain science experiment, 75 percent of trials are expected to be successful and 25 percent of trials are expected to be unsuccessful. The program below is intended to simulate the results of the repeated trials of the experiment. Which of the following can be used to replace <missing code> so that the simulation works as intended?
D; RANDOM (1,100) less than or equal to 75
A researcher wrote a program to simulate the number of mice in an environment that contains predators. The program uses the following procedures. Based on the code, which of the following assumptions is made in the simulation?
D; The number of predators does not change from day to day
A student wrote the procedure below, which is intended to ask whether a user wants to keep playing a game. The procedure does not work as intended. Which of the following best describes the result of running the procedure?
D; The procedure returns false no matter what the input value is
Which of the following describes the result of executing the program?
D; The program displays the sum of the odd integers 1 to 19
In public key cryptography, the send uses the recipient's public key to encrypt a message. Which of the following is needed to decrypt the message?
D; The recipients private key
A user reads reviews of a popular artist's new album and then downloads the album from the web site of a licensed online music seller. Which of the following is LEAST likely to be a consequence of this action?
D; The user will be in violation of the digital millennium copyright act (DMCA)
A musician is creating a song using audio samples. Which of the following actions will minimize the risk of a copyright violation when creating sample-based music?
D; Using samples published with a no-rights reserved creative commons license
A spinner is divided into three sections. The sector labeled Red is four times as large as each of the sectors labeled Blue and Yellow, which are of equal size. Which of the following can be used to replace <missing code> so that the procedure correctly simulates the spinner?
D; spin <-- random 1, 6 return "yellow" return "blue"