AP CSP Semester 1 Exam
A large spreadsheet contains the following information about the books at a bookstore. A sample portion of the spreadsheet is shown below. An employee wants to count the number of books that meet all of the following criteria. Is a mystery book Costs less than $10.00 Has at least one copy in stock For a given row in the spreadsheet, suppose genre contains the genre as a string, num contains the number of copies in stock as a number, and cost contains the cost as a number. Which of the following expressions will evaluate to true if the book should be counted and evaluates to false otherwise?
(genre = "mystery") AND ((1 ≤ num) AND (cost < 10.00))
A large spreadsheet contains information about the schedule for a college radio station. A sample portion of the spreadsheet is shown below. A student wants to count the number of shows that meet both of the following criteria. Is a talk show Is on Saturday or Sunday For a given row in the spreadsheet, suppose genre contains the genre as a string and day contains the day as a string. Which of the following expressions will evaluate to true if the show should be counted and evaluates to false otherwise?
(genre = "talk") AND ((day = "Saturday") OR (day = "Sunday"))
Let n be an integer value. Which of the following expressions evaluates to true if and only if n is a two-digit integer (i.e., in the range from 10 to 99, inclusive)?
(n ≥ 10) AND (n < 100)
Consider the following code segment. If the value of x is 3 and the value of y is 5, what is displayed as a result of executing the code segment?
-2
In the following procedure, the parameter str is a string and the parameter num is a number. PROCEDURE printArgs(str, num) { DISPLAY(num) DISPLAY(str) DISPLAY(num) } Consider the following code segment. printArgs("**", 1) printArgs("*", 2) What is displayed as a result of executing the code segment?
1 ** 1 2 * 2
A sorted list of numbers contains 500 elements. Which of the following is closest to the maximum number of list elements that will be examined when performing a binary search for a value in the list?
10
Consider the following procedure. PROCEDURE doSomething(num1, num2) { DISPLAY(num1) RETURN(num1) DISPLAY(num2) } Consider the following statement. DISPLAY(doSomething(10, 20)) What is displayed as a result of executing the statement above?
10 10
Consider the following code segment. What is displayed as a result of executing the code segment?
100 300 500
Each student that enrolls at a school is assigned a unique ID number, which is stored as a binary number. The ID numbers increase sequentially by 1 with each newly enrolled student. If the ID number assigned to the last student who enrolled was the binary number 1001 0011, what binary number will be assigned to the next student who enrolls?
1001 0100
Consider the following code segment. Assume that index1 is a number between 1 and LENGTH(theList), inclusive, and index2 is a number between 2 and LENGTH(theList) - 1, inclusive. theList ← [9, -1, 5, 2, 4, 8] x ← theList[index1] + theList[index2] What is the largest possible value that the variable x can have after the code segment executes?
14
A time stamp indicates the date and time that a measurement was taken. A data scientist has a list containing 10,000 time stamps, sorted in chronological order. Which of the following is closest to the maximum number of values that will need to be examined when performing a binary search for a value in the list?
15
Consider the following code segment. What is the value of result after the code segment is executed?
15
Consider the following code segment. What is the value of sum after the code segment is executed?
16
The figure below represents a network of physically linked devices, labeled A through H. A line between two devices indicates a connection. Devices can communicate only through the connections shown. What is the minimum number of connections that would need to be removed from the network in order for device A to not be able to communicate with device F?
2
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?
2 times as many items can be uniquely identified.
Consider the following code segment. What is the value of r as a result of executing the code segment?
20
Consider the following code segment. What is displayed as a result of executing the code segment?
21 40 30 50
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?
2^32 times as many values can be represented.
Consider the following code segment. Which of the following initial values of the variable y would result in the variable z being set to 2 after the code segment is executed?
3
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. What is the minimum number of connections that must be broken or removed in the network before computer E can no longer communicate with computer F?
3
A certain computer has two identical processors that are able to run in parallel. The table below indicates the amount of time it takes each processor to execute each of two processes. Assume that neither process is dependent on the other. (Process p=30 seconds, process q=45 seconds) Which of the following best approximates the difference in execution time between running the two processes in parallel instead of running them one after the other on a single processor?
30 seconds
The list wordList contains a list of 10 string values. Which of the following is a valid index for the list?
4
Consider the following code segment. result ← 1 IF(score1 > 500) { result ← result + 1 IF(score2 > 500) { result ← result + 1 } ELSE { result ← result + 2 } } ELSE { result ← result + 5 IF(score2 > 500) { result ← result + 1 } ELSE { result ← result - 1 } } If the value of score1 is 350 and the value of score2 is 210, what will be the value of result after the code segment is executed?
5
A sorted list of numbers contains 200 elements. Which of the following is closest to the maximum number of list elements that will need to be examined when performing a binary search for a particular value in the list?
8
A homework assignment consists of 10 questions. The assignment is graded as follows. Number of Correct Answers Grade9-10check plus7-8checkUnder 7check minus Let numCorrect represent the number of correct answers for a particular student. The following code segment is intended to display the appropriate grade based on numCorrect. The code segment does not work as intended in all cases. For which of the following values of numCorrect does the code segment NOT display the intended grade? Select two answers.
8, 6
A certain computer has two identical processors that are able to run in parallel. Each processor can run only one process at a time, and each process must be executed on a single processor. The following table indicates the amount of time it takes to execute each of three processes on a single processor. Assume that none of the processes are dependent on any of the other processes. (Process x=60 seconds, process y=30 seconds, process z=50 seconds) Which of the following best approximates the minimum possible time to execute all three processes when the two processors are run in parallel?
80 seconds
Which of the following best exemplifies the use of multifactor authentication?
A Web site requires a user to enter a password as well as a numeric code received via text message before the user can log in to an account.
Which of the following has the greatest potential for compromising a user's personal privacy?
A group of cookies stored by the user's Web browser
Computers are often used to search through large sets of data to find useful patterns in the data. Which of the following tasks is NOT an example where searching for patterns is needed to produce useful information?
A high school analyzing student grades to identify the students with the top ten highest grade point averages
The upgraded system uses a directory containing additional information not supplied by the customer. The directory is used to help direct calls effectively. Which of the following is LEAST likely to be included in the directory?
A list of computers the company owns and the computers' corresponding IP addresses
Which of the following is an advantage of a lossless compression algorithm over a lossy compression algorithm?
A lossless compression algorithm can guarantee reconstruction of original data, while a lossy compression algorithm cannot.
Which of the following actions is most likely to raise legal or ethical concerns?
A musician creates a song using samples of a copyrighted work and then uses a Creative Commons license to publish the song.
A student is writing a program that is intended to replace each negative value in a particular column of a spreadsheet with the value 0. Which of the following procedures is most likely to be useful in the student's program?
A procedure findNegative, which returns the row number of the first negative value that appears in the column or -1 if there are no negative values.
Which of the following procedures would be most useful as part of a program to determine whether a word appears in two different text files?
A procedure isFound, which takes a word and a text file as input and returns true if the word appears in the text file
A student has a data file containing 10,000 numerical values. The student is writing a program to compute the average of the numbers contained in the file. Which of the following procedures is most likely to be useful in the student's program?
A procedure that returns the sum of the values in the file
In which of the following scenarios would a simulation be the LEAST beneficial?
A retail company wants to determine the most popular item that was sold on the company's Web site last month.
Which of the following school policies is most likely to have a positive impact on the digital divide?
A school provides a laptop or tablet computer to all students enrolled at the school.
Which of the following is a benefit of using a simulation instead of an experiment to make a prediction? Select two answers.
A simulation allows investigation of a phenomenon without the real-world limitations on time, safety, or budget. A simulation can be used to model real-world events that are impractical for experiments.
Consider the following code segment, which is intended to store ten consecutive even integers, beginning with 2, in the list evenList. Assume that evenList is initially empty. i ← 1 REPEAT 10 TIMES { <MISSING CODE> } Which of the following can be used to replace <MISSING CODE> so that the code segment works as intended?
APPEND(evenList, 2 * i) i ←← i + 1
An individual receives an e-mail that appears to be from an insurance company. The message offers a low insurance rate, and prompts the recipient to click a link to learn more. Which of the following is most indicative that the e-mail is part of a phishing attempt?
After clicking the link, a Web page opens that prompts the recipient for personal information.
A computer scientist is analyzing four different algorithms used to sort a list. The table below shows the number of steps each algorithm took to sort lists of different sizes. Based on the values in the table, which of the algorithms appear to run in reasonable time? Select two answers.
Algorithm A and D
Which of the following best explains what happens when a new device is connected to the Internet?
An Internet Protocol (IP) address is assigned to the device.
Which of the following applications is most likely to benefit from the use of crowdsourcing?
An application that allows users to view descriptions and photographs of local landmarks
Which of the following is LEAST likely to indicate a phishing attack?
An e-mail from your bank asks you to call the number on your card to verify a transaction
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?
An overflow error occurred.
A certain programming language uses 4-bit binary sequences to represent nonnegative integers. For example, the binary sequence 0101 represents the corresponding decimal value 5. Using this programming language, a programmer attempts to add the decimal values 14 and 15 and assign the sum to the variable total. Which of the following best describes the result of this operation?
An overflow error will occur because 4 bits is not large enough to represent 29, the sum of 14 and 15.
A teacher has a goal of displaying the names of 2 students selected at random from a group of 30 students in a classroom. Any possible pair of students should be equally likely to be selected. Which of the following algorithms can be used to accomplish the teacher's goal?
Assign each student a unique integer from 1 to 30. Step 2: Generate a random integer n from 1 to 30. Step 3: Select the student who is currently assigned integer n and display the student's name. Step 4: The student who was selected in the previous step is assigned 0. All other students are reassigned a unique integer from 1 to 29. Step 5: Generate a new random integer n from 1 to 29. Step 6: Select the student who is currently assigned integer n and display the student's name.
A database of information about shows at a concert venue contains the following information. Name of artist performing at the show Date of show Total dollar amount of all tickets sold Which of the following additional pieces of information would be most useful in determining the artist with the greatest attendance during a particular month?
Average ticket price
Researchers have developed a simulation of packets traveling between server computers and client computers in a network. Of the following, which two outcomes are most likely to be results of the simulation? Select two answers.
Better understanding of the effect of temporarily unavailable network connections Better understanding of the impact of increased connection speeds for frequently visited servers
A wildlife preserve is developing an interactive exhibit for its guests. The exhibit is intended to allow guests to select the name of an animal on a touch screen and display various facts about the selected animal. The preserve has two databases of information available to use for the exhibit. The first database contains information for each animal's name, classification, skin type, and thermoregulation. The second database contains information for each animal's name, lifestyle, average life span, and top speed. Which of the following explains how the two databases can be used to develop the interactive exhibit?
Both databases are needed. Each database can be searched by animal name to find all information to be displayed.
Which of the following best explains how fault tolerance in a network is achieved?
By providing multiple paths between devices, enabling routing to occur even in the presence of a failed component
In the following procedure, the parameters x and y are integers. Which of the following is the most appropriate documentation to appear with the calculate procedure?
Displays the value of (x + y) / x. The value of the parameter x must not be 0.
A programmer is creating an algorithm that will be used to turn on the motor to open the gate in a parking garage. The specifications for the algorithm are as follows. The gate should not open when the time is outside of business hours. The motor should not turn on unless the gate sensor is activated. The motor should not turn on if the gate is already open. Which of the following algorithms can be used to open the gate under the appropriate conditions?
Check if the time is during business hours. If it is, check if the gate sensor is activated. If it is, check if the gate is open. If it is not, turn on the motor.
A company that develops educational software wants to assemble a collaborative team of developers from a variety of professional and cultural backgrounds. Which of the following is NOT considered a benefit of assembling such a team?
Collaboration that includes diverse backgrounds and perspectives can eliminate the need for software testing.
Which of the following activities is most likely to be successful as a citizen science project?
Collecting pictures of plants from around the world that can be analyzed to look for regional differences in plant growth.
A user wants to save a data file on an online storage site. The user wants to reduce the size of the file, if possible, and wants to be able to completely restore the file to its original version. Which of the following actions best supports the user's needs?
Compressing the file using a lossless compression algorithm before uploading it
Which of the following is the most likely data privacy concern of the upgraded system?
Customers' personal information could be compromised if an unauthorized individual gains access to the call session database.
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?
Do the movement patterns of the animal vary according to the weather?
Which of the following actions is most likely to help reduce the digital divide?
Deploying satellites and other infrastructure to provide inexpensive Internet access to remote areas of Earth
A digital photo file contains data representing the level of red, green, and blue for each pixel in the photo. The file also contains metadata that describes the date and geographic location where the photo was taken. For which of the following goals would analyzing the metadata be more appropriate than analyzing the data?
Determining the likelihood that the photo was taken at a particular public event
For which of the following problems is using a simulation LEAST likely to be beneficial?
Determining the longest word in a textbook
A team of researchers wants to create a program to analyze the amount of pollution reported in roughly 3,000 counties across the United States. The program is intended to combine county data sets and then process the data. Which of the following is most likely to be a challenge in creating the program?
Different counties may organize data in different ways.
Which of the following best explains how data is typically assembled in packets for transmission over the Internet?
Each packet contains data to be transmitted, along with metadata containing information used for routing the data.
Shoppers at a mall were asked whether they preferred wearing gloves or mittens in cold weather. Shoppers' preferences were stored in the list voteList as strings, with the string "Gloves" representing a preference for gloves and the string "Mittens" representing a preference for mittens. The following code segment is intended to traverse the list and display the number of shoppers who chose gloves and the number of shoppers who chose mittens. Which of the following should replace <MISSING CODE> so that the code segment works as intended?
FOR EACH vote IN voteList
A large spreadsheet contains information about the photographs in a museum's collection. A sample portion of the spreadsheet is shown below. Which of the following sequences of steps can be used to identify the desired entry? Select two answers.
Filter by photographer, then filter by year, then sort by year Sort by year, then filter by year, then filter by photographer
The procedure below is intended to display the index in a list of unique names (nameList) where a particular name (targetName) is found. If targetName is not found in nameList, the code should display 0. Which of the following procedure calls can be used to demonstrate that the procedure does NOT work as intended?
FindName (["Andrea", "Ben", "Chris"], "Ben")
A video game character can face toward one of four directions: north, south, east, and west. Each direction is stored in memory as a sequence of four bits. A new version of the game is created in which the character can face toward one of eight directions, adding northwest, northeast, southwest, and southeast to the original four possibilities. Which of the following statements is true about how the eight directions must be stored in memory?
Four bits are enough to store the eight directions.
Two grids are shown below. Each grid contains a robot represented as a triangle. Both robots are initially facing left. Each robot can move into a white or gray square, but cannot move into a black region. For each grid, the program below is intended to move the robot to the gray square. The program uses the procedure Goal_Reached ( ), which evaluates to true if the robot is in the gray square and evaluates to false otherwise. For which of the grids does the program correctly move the robot to the gray square?
Grid I only
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?
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?
How many states have a higher percentage of female computer science majors than male computer science majors attending college in that state?
A teacher sends students an anonymous survey in order to learn more about the students' work habits. The survey contains the following questions. On average, how long does homework take you each night (in minutes) ? On average, how long do you study for each test (in minutes) ? Do you enjoy the subject material of this class (yes or no) ? Which of the following questions about the students who responded to the survey can the teacher answer by analyzing the survey results? Do students who enjoy the subject material tend to spend more time on homework each night than the other students do? Do students who spend more time on homework each night tend to spend less time studying for tests than the other students do? Do students who spend more time studying for tests tend to earn higher grades in the class than the other students do?
I and II
DineOutHelper is a mobile application that people can use to select a restaurant for a group meal. Each user creates a profile with a unique username and a list of food allergies or dietary restrictions. Each user can then build a contact list of other users of the app. A user who is organizing a meal with a group selects all the members of the group from the user's contact list. The application then recommends one or more nearby restaurants based on whether the restaurant can accommodate all of the group members' allergies and dietary restrictions. Suppose that Alejandra is using DineOutHelper to organize a meal with Brandon and Cynthia. Which of the following data are needed for DineOutHelper to recommend a restaurant for the group? Each group member's list of food allergies or dietary restrictions Alejandra's geographic location The usernames of the people on Brandon and Cynthia's contact lists
I and II only
Which of the following is a primary benefit of making a computing system fault-tolerant?
If one component of the system fails, users of the system can often still access it.
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? The author wants to make the e-book available as a free download. The author wants to prevent people from sharing copies of the e-book on peer-to-peer networks. The author wants to allow people permission to use and modify the e-book.
I and III only
Some programming languages use constants, which are variables that are initialized at the beginning of a program and never changed. Which of the following are good uses for a constant? I. To represent the mathematical value π (pi) as 3.14 II. To represent the current score in a game III. To represent a known value such as the number of days in a week
I and III only
To direct a call to the appropriate destination, which of the following input data is needed by the upgraded system that was NOT needed by the original system? Audio signal of the customer's voice The customer's keypad selection The customer's phone number
I only
Which of the following are true statements about digital certificates in Web browsers? Digital certificates are used to verify the ownership of encrypted keys used in secured communication. Digital certificates are used to verify that the connection to a Web site is fault tolerant.
I only
For which of the following lists can a binary search be used to search for an item in the list? ["blue", "green", "jade", "mauve", "pink"] [5, 5, 5, 5, 6, 7, 8, 8, 8] [10, 5, 3, 2, -4, -8, -9, -12]
I, II, and III
Which of the following are true statements about the data that can be represented using binary sequences? Binary sequences can be used to represent strings of characters. Binary sequences can be used to represent colors. Binary sequences can be used to represent audio recordings.
I, II, and III
Three teams (Team A, Team B, and Team C) are participating in a trivia contest. Let scoreA represent the number of correct questions for Team A, scoreB represent the number of correct questions for Team B, and scoreC represent the number of correct questions for Team C. Assuming no two teams get the same number of correct questions, which of the following code segments correctly displays the team with the highest number of correct questions?
If score A>score B If score A>score C
In a certain game, the integer variable bonus is assigned a value based on the value of the integer variable score. If score is greater than 100, bonus is assigned a value that is 10 times score. If score is between 50 and 100 inclusive, bonus is assigned the value of score. If score is less than 50, bonus is assigned a value of 0. Which of the following code segments assigns bonus correctly for all possible integer values of score ? Select two answers.
IF(score > 100) { bonus ←← score * 10 } ELSE { IF(score ≥ 50) { bonus ←← score } ELSE { bonus ←← 0 } } IF(score < 50) { bonus ←← 0 } ELSE { IF(score > 100) { bonus ←← score * 10 } ELSE { bonus ←← score } }
In a certain country, a person must be at least 16 years old to drive a car and must be at least 18 years old to vote. The variable age represents the age of a person as an integer. Which of the following expressions evaluates to true if the person is old enough to drive but not old enough to vote, and evaluates to false otherwise? (age ≥ 16) AND (age ≤ 18) (age ≥ 16) AND (NOT(age ≥ 18)) (age < 18) AND (NOT(age < 16))
II and III only
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
II and III only
Suppose a large group of people in a room were all born in the same year. Consider the following three algorithms, which are each intended to identify the people in the room who have the earliest birthday based on just the month and day. For example, a person born on February 10 is considered to have an earlier birthday than a person born on March 5. Which of the three algorithms will identify the correct people?
II only
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.
II only
DineOutHelper is a mobile application that people can use to select a restaurant for a group meal. Each user creates a profile with a unique username and a list of food allergies or dietary restrictions. Each user can then build a contact list of other users of the app. A user who is organizing a meal with a group selects all the members of the group from the user's contact list. The application then recommends one or more nearby restaurants based on whether the restaurant can accommodate all of the group members' allergies and dietary restrictions. Suppose that Alejandra is using DineOutHelper to organize a meal with Brandon and Cynthia. Which of the following data is not provided by Alejandra but is necessary for DineOutHelper to recommend a restaurant for the group? Brandon's contact list Information about which restaurants Brandon and Cynthia have visited in the past Information about which food allergies and dietary restrictions can be accommodated at different restaurants near Alejandra
III only
The figure below represents a network of physically linked devices, labeled A through F. A line between two devices indicates a connection. Devices can communicate only through the connections shown. Which of the following statements are true about the ability for devices A and C to communicate? Select two answers.
If devices B and D were to fail, then information sent from device A could not reach device C. If devices D and F were to fail, then information sent from device A could not reach device C.
A certain game keeps track of the maximum and minimum scores obtained so far. If num represents the most recent score obtained, which of the following algorithms correctly updates the values of the maximum and the minimum?
If num is less than the minimum, set the minimum equal to num. Otherwise, if num is greater than the maximum, set the maximum equal to num.
Three different numbers need to be placed in order from least to greatest. For example, if the numbers are ordered 9, 16, 4, they should be reordered as 4, 9, 16. Which of the following algorithms can be used to place any three numbers in the correct order?
If the first number is greater than the middle number, swap them. Then, if the middle number is greater than the last number, swap them. Then, if the first number is greater than the middle number, swap them.
In the following code segment, score and penalty are initially positive integers. The code segment is intended to reduce the value of score by penalty. However, if doing so would cause score to be negative, score should be assigned the value 0. For example, if score is 20 and penalty is 5, the code segment should set score to 15.If score is 20 and penalty is 30, score should be set to 0. The code segment does not work as intended. Line 1: IF(score - penalty < 0) Line 2: { Line 3: score ← score - penalty Line 4: } Line 5: ELSE Line 6: { Line 7: score ← 0 Line 8: } Which of the following changes can be made so that the code segment works as intended?
Interchanging lines 3 and 7
In which of the following scenarios is using a simulation more beneficial than performing a calculation? Select two answers.
Investigating ways to reduce the amount of trash in the ocean Studying the effect of a genetic change in a population
In the following procedure, assume that the parameter x is an integer. Which of the following best describes the behavior of the procedure?
It displays true if x is negative and displays nothing otherwise.
A software development company has created an application called FileCleanUp. When the application is run on a user device, it searches for all files (including pictures, videos, and documents) that have not been accessed in the past month, stores them on the company's Web server, and deletes them from the user device. The application runs once each day. Users have the ability to manually retrieve files from the server if they are needed. Which of the following is most likely to be a harmful effect of using FileCleanUp?
It prevents users from accessing infrequently used files when there is no Internet connectivity.
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?
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.
The figure below shows four grids, each containing a robot represented as a triangle. The robot cannot move to a black square or move beyond the edge of the grid. Which of the following algorithms will allow the robot to make a single circuit around the rectangular region of black squares, finishing in the exact location and direction that it started in each of the four grids?
Keep moving forward, one square at a time, until the square to the right of the robot is no longer black. Step 2: Turn right and move one square forward. Step 3: Repeat steps 1 and 2 three more times.
A programmer has a need to round many numeric values to the nearest integer. Which of the following best explains the benefit of using a list as a data abstraction in this situation?
Keeping the numeric values in a list makes it easier to apply the same computation to every data element.
Which of the following is a benefit of using a list as a data abstraction in a program?
Lists often allow their size to be easily updated to hold as many data values as needed.
A programmer is developing software for a social media platform. The programmer is planning to use compression when users send attachments to other users. Which of the following is a true statement about the use of compression?
Lossy compression of an image file generally provides a greater reduction in transmission time than lossless compression does.
A computer science student completes a program and asks a classmate for feedback. The classmate suggests rewriting some of the code to include more procedural abstraction. Which of the following is NOT a benefit of procedural abstraction?
Making code run faster
The developers of a music-streaming application are updating the algorithm they use to recommend music to listeners. Which of the following strategies is LEAST likely to introduce bias into the application?
Making recommendations based on listening data gathered from a random sample of users of the application
The following procedure is intended to return the number of times the value val appears in the list myList. The procedure does not work as intended. Which of the following changes can be made so that the procedure will work as intended?
Moving the statement in line 5 so that it appears between lines 2 and 3
Which of the following is a primary reason for the use of open protocols on the Internet?
Open protocols provide a way to standardize data transmission between different devices.
A game program contains the following code to update three score variables, health, food, and knowledge. The maximum values for the three variables are 100, 80, and 25, respectively. health ← health + 10 IF(health > 100) { health ← 100 } food ← food + 1 IF(food > 80) { food ← 80 } knowledge ← knowledge + 5 IF(knowledge > 25) { knowledge ← 25 } The game program's author would like to write a procedure that could be used to update any variable in the game (myScore) that has a maximum value (myLimit) by a given amount (myAmount). A correct call of the procedure is shown below. myScore ← updateScore(myScore, myAmount, myLimit) Which of the following is a correct implementation of updateScore ?
PROCEDURE updateScore(score, amount, limit) { score ←← score + amount IF(score > limit) { score ←← limit } RETURN(score) }
A mobile game tracks players' locations using GPS. The game offers special in-game items to players when they visit real-world points of interest. Which of the following best explains how bias could occur in the game?
Points of interest may be more densely located in cities, favoring players in urban areas over players in rural areas.
In the following procedure, the parameter max is a positive integer. PROCEDURE printNums(max) { count ← 1 REPEAT UNTIL(count > max) { DISPLAY(count) count ← count + 2 } } Which of the following is the most appropriate documentation to appear with the printNums procedure?
Prints all positive odd integers that are less than or equal to max.
Which of the following are benefits of procedural abstraction? Select two answers.
Procedural abstraction makes it easier for people to read computer programs. Procedural abstraction provides an opportunity to give a name to a block of code that describes the purpose of the code block.
A computer has two processors that are able to run in parallel. The table below indicates the amount of time it takes either processor to execute four different processes. Assume that none of the processes is dependent on any of the other processes. ProcessExecution TimeW20 secondsX30 secondsY45 secondsZ50 seconds A program is used to assign processes to each of the processors. Which of the following describes how the program should assign the four processes to optimize execution time?
Processes W and Z should be assigned to one processor, and processes X and Y should be assigned to the other processor.
Which of the following is a true statement about program documentation?
Program documentation is useful during initial program development and also when modifications are made to existing programs.
Which of the following actions is most likely to be effective in reducing the digital divide at a local level?
Providing free community access to computers at schools, libraries, and community centers
Which of the following is considered an unethical use of computer resources?
Purchasing a single-user copy of photo editing software and installing it on all the computers in a computer lab
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?
Putting all government forms on the city Web site
In a certain district, 20 percent of the voters are expected to vote for Candidate A in an election. The computer program below is intended to simulate the result of the election with voters, and display the number of votes received by Candidate A. Which of the following can be used to replace in line 4 so that the program works as intended? Select two answers.
Random (1, 5)=1 Random (1, 10) <_ 2
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 and facing toward the top of the grid. Which of the following code segments can be used to move the robot to the gray square? Select two answers.
Repeat 4 times {Move forward Rotate Left Move Forward Rotate Right} Repeat 2 times {Repeat 4 times {Move Forward} Rotate Left}
Which of the following activities poses the greatest personal cybersecurity risk?
Reserving a hotel room by e-mailing a credit card number to a hotel
In the following procedure, the parameter numList is a list of numbers and the parameters j and k are integers. PROCEDURE swapListElements(numList, j, k) { newList ← numList newList[j] ← numList[k] newList[k] ← numList[j] RETURN(newList) } Which of the following is the most appropriate documentation to appear with the swapListElements procedure?
Returns a copy of numList with the elements at indices j and k interchanged.The values of j and k must both be between 1 and LENGTH(numList), inclusive
A student wants to determine whether a certain problem is undecidable. Which of the following will demonstrate that the problem is undecidable?
Show that for one instance of the problem, no algorithm can be written that is capable of providing a correct yes-or-no answer. C
Which of the following is LEAST likely to be a contributing factor to the digital divide?
Some parents prefer to limit the amount of time their children spend using computing devices or the Internet.
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?
Sorting data
Consider the following spinner, which is used to determine how pieces are to be moved on a game board. Each region is of equal size. Which of the following code segments can be used to simulate the behavior of the spinner?
Spin<-Random 1, 4 If spin =1 color<-"yellow"
In the following statement, val1, val2, and result are Boolean variables. Which of the following code segments produce the same result as the statement above for all possible values of val1 and val2 ? Select two answers.
Starts with: Result <- false )for both)
Which of the following algorithms display all integers between 1 and 20, inclusive, that are not divisible by 3 ? Select two answers.
Step 1: Set x to 0. Step 2: Increment x by 1. Step 3: If x is not divisible by 3, then display x. Step 4: Repeat steps 2 and 3 until x is 20. Set x to 1. Step 2: If x is divisible by 3, then do nothing; otherwise display x. Step 3: Increment x by 1. Step 4: Repeat steps 2 and 3 until x is greater than 20.
A list of numbers has n elements, indexed from 1 to n. The following algorithm is intended to display the number of elements in the list that have a value greater than 100. The algorithm uses the variables count and position. Steps 3 and 4 are missing. Step 1:Set count to 0 and position to 1.Step 2:If the value of the element at index position is greater than 100, increase the value of count by 1.Step 3:(missing step) Step 4:(missing step) Step 5:Display the value of count. Which of the following could be used to replace steps 3 and 4 so that the algorithm works as intended?
Step 3: Increase the value of position by 1. Step 4: Repeat steps 2 and 3 until the value of position is greater than n.
A researcher is analyzing data about students in a school district to determine whether there is a relationship between grade point average and number of absences. The researcher plans on compiling data from several sources to create a record for each student. The researcher has access to a database with the following information about each student. Last name First name Grade level (9, 10, 11, or 12) Grade point average (on a 0.0 to 4.0 scale) The researcher also has access to another database with the following information about each student. First name Last name Number of absences from school Number of late arrivals to school Upon compiling the data, the researcher identifies a problem due to the fact that neither data source uses a unique ID number for each student. Which of the following best describes the problem caused by the lack of unique ID numbers?
Students who have the same name may be confused with each other.
A student is creating an algorithm to display the distance between the numbers num1 and num2 on a number line. The following table shows the distance for several different values. Which of the following algorithms displays the correct distance for all possible values of num1 and num2 ?
Subtract num1 from num2 and store the result in the variable diff. Step 2: Take the absolute value of diff and display the result.
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?
Technology companies can set research and development goals based on anticipated processing speeds.
A software company is designing a mobile game system that should be able to recognize the faces of people who are playing the game and automatically load their profiles. Which of the following actions is most likely to reduce the possibility of bias in the system?
Testing the system with people of different ages, genders, and ethnicities
Which of the following best explains how the Internet is a fault-tolerant system?
The Internet is fault-tolerant because there are usually multiple paths between devices, allowing messages to sometimes be sent even when parts of the network fail.
Which of the following best describes the relationship between the World Wide Web and the Internet?
The World Wide Web is a system of linked pages, programs, and files that is accessed via a network called the Internet.
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?
The ability to provide credibility to the information distributed
Which of the following is a characteristic of the fault-tolerant nature of routing on the Internet?
The ability to provide data transmission even when some connections have failed
A graphic artist uses a program to draw geometric shapes in a given pattern. The program uses an algorithm that draws the shapes based on input from the artist. The table shows the approximate number of steps the algorithm takes to draw different numbers of shapes. Based on the values in the table, which of the following best characterizes the algorithm for drawing n shapes, where n is a very large number?
The algorithm runs in a reasonable amount of time because it will use approximately n^2 steps to draw n shapes.
Consider the following code segment. Which of the following best describes the behavior of the code segment?
The code segment displays the value of 2(5^3) by initializing result to 2 and then multiplying result by 5 a total of three times.
A student wrote the following code segment, which displays true if the list myList contains any duplicate values and displays false otherwise. The code segment compares pairs of list elements, setting containsDuplicates to true if any two elements are found to be equal in value. Which of the following best describes the behavior of how pairs of elements are compared?
The code segment iterates through myList, comparing each element to all subsequent elements in the list.
A chain of retail stores uses software to manage telephone calls from customers. The system was recently upgraded. Customers interacted with the original system using their phone keypad. Customers interact with the upgraded system using their voice. The upgraded system (but not the original system) stores all information from the calling session in a database for future reference. This includes the customer's telephone number and any information provided by the customer (name, address, order number, credit card number, etc.). The original system and the upgraded system are described in the following flowcharts. Each flowchart uses the following blocks. Which of the following is most likely to be a benefit of storing the information from each calling session in a database?
The company can analyze the calling session data and thereby make better business decisions.
Of the following potential benefits, which is LEAST likely to be provided by the upgraded system?
The company will be able to provide a human representative for any incoming call.
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?
The computers can communicate directly because Internet communication uses standard protocols.
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. 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?
The conclusion is incorrect; using the test case [0, 1, 4, 5] is not sufficient to conclude the program is correct. D
A student is creating an application that allows customers to order food for delivery from a local restaurant. Which of the following is LEAST likely to be an input provided by a customer using the application?
The cost of a food item currently available for order
From the perspective of the application's developers, which of the following is most likely to be a benefit of storing all user data in a database?
The developers can analyze the data to make improvements to the application based on user behavior.
A school library allows students to borrow laptops. A computer program is used to count the number of times a particular laptop has been borrowed from the library and the number of times the same laptop has been returned to the library . Which of the following indicate that a particular laptop is not currently borrowed? Select two answers.
The difference between and is zero. The sum of and is a positive even number.
Which of the following best describes the ability of parallel computing solutions to improve efficiency?
The efficiency of a solution that can be broken down into parallel portions is still limited by a sequential portion.
Suppose that a list of numbers contains values [-4, -1, 1, 5, 2, 10, 10, 15, 30]. Which of the following best explains why a binary search should NOT be used to search for an item in this list?
The elements of the list are not sorted.
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?
The file is broken into packets for transmission. The packets must be reassembled upon receipt.
Which of the following best explains how messages are typically transmitted over the Internet?
The message is broken into packets. The packets can be received in any order and still be reassembled by the recipient's device.
A city planner is using simulation software to study crowd flow out of a large arena after an event has ended. The arena is located in an urban city. Which of the following best describes a limitation of using a simulation for this purpose?
The model used by the simulation software often omits details so that it is easier to implement.
The following figure represents a network of physically linked devices labeled P through S. A line between two devices indicates a connection. Devices can communicate only through the connections shown. Which of the following statements best explains the ability of the network to provide fault tolerance?
The network is considered fault-tolerant because there are redundant paths between each pair of devices.
A camera mounted on the dashboard of a car captures an image of the view from the driver's seat every second. Each image is stored as data. Along with each image, the camera also captures and stores the car's speed, the date and time, and the car's GPS location as metadata. Which of the following can best be determined using only the data and none of the metadata?
The number of bicycles the car passed on a particular day
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?
The number of movies purchased by an individual subscriber for a particular month
In a certain game, a player may have the opportunity to attempt a bonus round to earn extra points. In a typical game, a player is given 1 to 4 bonus round attempts. For each attempt, the player typically earns the extra points 70% of the time and does not earn the extra points 30% of the time. The following code segment can be used to simulate the bonus round. Which of the following is NOT a possible output of this simulation?
The player had 3 bonus round attempts and 7 of them earned extra points.
The position of a runner in a race is a type of analog data. The runner's position is tracked using sensors. Which of the following best describes how the position of the runner is represented digitally?
The position of the runner is sampled at regular intervals to approximate the real-word position, and a sequence of bits is used to represent each sample.
Which of the following are benefits of using well-named variables in a computer program? Select two answers.
The program will be easier for people to read. The program will be easier to modify in the future.
A programmer created a piece of software and wants to publish it using a Creative Commons license. Which of the following is a direct benefit of publishing the software with this type of license?
The programmer can specify the ways that other people are legally allowed to use and distribute the software.
Which of the following can be represented by a single binary digit? Select two answers.
The remainder when dividing a whole number by 2 The value of a Boolean variable
A researcher wants to publish the results of a study in an open access journal. Which of the following is a direct benefit of publishing the results in this type of publication?
The researcher can allow the results to be easily obtained by other researchers and members of the general public.
A user unintentionally installs keylogging software on a computer. Which of the following is an example of how the keylogging software can be used by an unauthorized individual to gain access to computing resources?
The software records all user input on the computer. The recorded information is transmitted to an unauthorized individual, who analyzes it to determine the user's login passwords.
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?
The song was saved using fewer bits per second than the original song.
The owner of a clothing store records the following information for each transaction made at the store during a 7-day period. The date of the transaction The method of payment used in the transaction The number of items purchased in the transaction The total amount of the transaction, in dollars Customers can pay for purchases using cash, check, a debit card, or a credit card. Using only the data collected during the 7-day period, which of the following statements is true?
The total number of items purchased on a given date can be determined by searching the data for all transactions that occurred on the given date and then adding the number of items purchased for each matching transaction.
A user purchased a new smart home device with embedded software and connected the device to a home network. The user then registered the device with the manufacturer, setting up an account using a personal e-mail and password. Which of the following explains how a phishing attack could occur against the user of the smart home device?
The user is sent an e-mail appearing to be from the manufacturer, asking the user to confirm the account password by clicking on a link in the e-mail and entering the password on the resulting page.
Consider the following code segment. What are the values of first and second as a result of executing the code segment?
The value of first is true, and the value of second is true.
The list listOne is a sorted list of numbers that contains 700 elements. The list listTwo is a sorted list of numbers that contains 900 elements. Let x represent the maximum number of list elements that will need to be examined when performing a binary search for a value in listOne, and let y represent the maximum number of list elements that will need to be examined when performing a binary search for a value in listTwo. Which of the following statements about x and y is true?
The value of x is approximately equal to the value of y.
A city's police department has installed cameras throughout city streets. The cameras capture and store license plate data from cars driven and parked throughout the city. The authorities use recorded license plate data to identify stolen cars and to enforce parking regulations. Which of the following best describes a privacy risk that could occur if this method of data collection is misused?
The vehicle location data could be used to monitor the movements of city residents.
Which of the following is a true statement about data compression?
There are trade-offs involved in choosing a compression technique for storing and transmitting data.
A team of programmers is designing software. One portion of the project presents a problem for which there is not an obvious solution. After some research, the team determines that the problem is undecidable. Which of the following best explains the consequence of the problem being undecidable?
There is no possible algorithm that can be used to solve all instances of the problem.
Three students in different locations are collaborating on the development of an application. Which of the following strategies is LEAST likely to facilitate collaboration among the students?
Three students in different locations are collaborating on the development of an application. Which of the following strategies is LEAST likely to facilitate collaboration among the students?
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?
To determine the topics that many users are posting about
A new rechargeable battery pack is available for products that use AA batteries. Which of the following best explains how the data files in the table can be used to send a targeted e-mail to only those customers who have purchased products that use AA batteries to let them know about the new accessory?
Use the products file to generate a list of product IDs that use AA batteries, then use the list of product IDs to search the purchases file to generate a list of customer IDs, then use the list of customer IDs to search the customers file to generate a list of e-mail addresses
A company that develops mobile applications wants to involve users in the software development process. Which of the following best explains the benefit in having users participate?
Users can provide feedback that can be used to incorporate a variety of perspectives into the software.
A mobile application is used to display local traffic conditions. Which of the following features of the application best exemplifies the use of crowdsourcing?
Users can submit updates on local traffic conditions in real time.
A student is creating a Web site that is intended to display information about a city based on a city name that a user enters in a text field. Which of the following are likely to be challenges associated with processing city names that users might provide as input? Select two answers.
Users might enter abbreviations for the names of cities. Users might misspell the name of the city.
Which of the following is most likely to be a data privacy concern for StreamPal users?
Users of the application may have the ability to determine information about the locations of users that are not on their contact list.
Which of the following statements is most likely true about the differences between the basic version and the premium version of StreamPal?
Users of the basic version of StreamPal indirectly support StreamPal by allowing themselves to receive advertisements.
MeeReader is an e-reading application that allows users to download and read books and articles on a device. Each user creates a profile with the following personal preferences. Screen brightness and contrast Choice of typeface and font size Amount of spacing between lines of text Activation of a text-to-speech feature that reads the text out loud When the user launches the application, the application scans the user's face and uses facial recognition software to determine the user's identity. Once the user has been identified, the user's personal preferences are applied to whatever book or article the user chooses to read. The application stores all user information in a database, including personal preferences and a record of previously read books and articles. Which of the following is most likely to be a beneficial effect of using MeeReader?
Users with visual impairments may be able to more easily read or listen to books and articles.
The transportation department plans to build a new high-speed train route between two cities. The transportation department wants to implement a simulation of the train before any construction begins on this project. Which of the following statements is true about the use of a simulation for this project?
Using a simulation may expose potential safety issues that can be corrected before construction begins.
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?
Web sites that are not visited frequently might no longer be accessible to users.
A search engine has a trend-tracking feature that provides information on how popular a search term is. The data can be filtered by geographic region, date, and category. Categories include arts and entertainment, computers and electronics, games, news, people and society, shopping, sports, and travel. Which of the following questions is LEAST likely to be answerable using the trends feature?
What is the cost of a certain electronics product?
A Web site uses several strategies to prevent unauthorized individuals from accessing user accounts. Which of the following is NOT an example of multifactor authentication?
When a user enters an incorrect password more than two times in a row, the user is locked out of the account for 24 hours.
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?
Which items listed in the database are not currently in the store
The following procedure is intended to return true if the list of numbers myList contains only positive numbers and is intended to return false otherwise. The procedure does not work as intended. PROCEDURE allPositive(myList) { index ← 1 len ← LENGTH(myList) REPEAT len TIMES { IF(myList[index] > 0) { RETURN(true) } index ← index + 1 } RETURN(false) } For which of the following contents of myList does the procedure NOT return the intended result?
[-1, 0, 1]
Consider the following code segment. What are the contents of yourList after the code segment is executed?
[10, 30, 50, 70]
According to the domain name system (DNS), which of the following is a subdomain of the domain example.com?
about.example.com
Consider the following code segment. theList ← [-2, -1, 0, 1, 2] count1 ← 0 count2 ← 0 FOR EACH value IN theList { IF(value > 0) { count1 ← count1 + 1 } ELSE { count2 ← count2 + 1 } } What are the values of count1 and count2 as a result of executing the code segment?
count1 = 2, count2 = 3
Consider the following procedure. The drawCircle procedure is to be used to draw the following figure on a coordinate grid. Let the value of the variable x be 2, the value of the variable y be 2, and the value of the variable r be 1. Which of the following code segments can be used to draw the figure?
drawCircle(x, y, r) drawCircle(x, y + 3, r) drawCircle(x + 3, y, r) drawCircle(x + 3, y + 3, r)
Consider the following procedure. The drawLine procedure is to be used to draw the following figure on a coordinate grid. Let the value of the variable xVal be 6 and the value of the variable yVal be 5. Which of the following code segments can be used to draw the figure?
drawLine(1, 5, xVal, yVal) drawline(1, 5, xVal, yVal + 2) drawline(1, 5, xVal, yVal - 2)
Consider the following code segment. What is displayed as a result of executing the code segment?
false false false
Consider the following procedures for string manipulation. The variable initials is to be assigned a string consisting of the first letter of the string firstName followed by the first letter of the string lastName. Which of the following assigns the correct string to initials ?
initials ← concat(prefix(firstName, 1), prefix(lastName, 1))
A teacher stores the most recent quiz scores for her class in the list scores. The first element in the list holds the maximum possible number of points that can be awarded on the quiz, and each remaining element holds one student's quiz score. Assume that scores contains at least two elements. Which of the following code segments will set the variable found to true if at least one student scored the maximum possible number of points on the quiz and will set found to false otherwise?
len<-length scores -1 found<-false index<-2 Repeat len Times
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 ?
newList ← Combine (list1, list2) newList ← Sort (newList) newList ← RemoveDuplicates (newList)
Consider the following procedures for string manipulation. Assume that the string oldString contains at least 4 characters. A programmer is writing a code segment that is intended to remove the first two characters and the last two characters from oldString and assign the result to newString. For example, if oldString contains "student", then newString should contain "ude". Which of the following code segments can be used to assign the intended string to newString ? Select two answers.
newString ←← substring(oldString, 3, len(oldString) - 4) tempString ←← substring(oldString, 3, len(oldString) - 2) newString ←← substring(tempString, 1, len(tempString) - 2)
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?
numberOfAbsences = 5, gradePointAverage = 3.8
A spinner contains 12 regions of equal size. The regions are numbered 1 to 12. Which of the following code segments can be used to simulate the results of spinning the spinner three times and assigns the sum of the values obtained by the three spins to the variable sum?
sum ←← RANDOM(1, 12) + RANDOM(1, 12) + RANDOM(1, 12)
Three words are stored in the variables word1, word2, and word3. The values of the variables are to be updated as shown in the following table. Which of the following code segments can be used to update the values of the variables as shown in the table?
temp ← word1 word1 ← word3 word3 ← temp
Which of the following code segments can be used to interchange the values of the variables num1 and num2 ?
temp<- num1 num1<-num2 num2<-temp
The following code segment is used to determine whether a customer is eligible for a discount on a movie ticket. val1 ← (NOT (category = "new")) OR (age ≥ 65) val2 ← (category = "new") AND (age < 12) If category is "new" and age is 20, what are the values of val1 and val2 as a result of executing the code segment?
val1 = false, val2 = false
In the following expression, the variable truckWeight has the value 70000 and the variable weightLimit has the value 80000. truckWeight < weightLimit What value does the expression evaluate to?
true
Consider the following code segment. What is displayed as a result of executing the code segment?
true true true
Consider the following procedures for string manipulation. Which of the following code segments can be used to store "noon" in the string variable word ?
word ←← "on" word ←← concat(reverse(word), word)
The following code segment is intended to set max equal to the maximum value among the integer variables x, y, and z. The code segment does not work as intended in all cases. Which of the following initial values for x, y, and z can be used to show that the code segment does not work as intended?
x = 3, y = 2, z = 1
Consider the following procedure. The drawCircle procedure is to be used to draw the following figure on a coordinate grid. Which of the following code segments can be used to draw the figure? Select two answers.
x ←← 4 y ←← 1 r ←← 0 REPEAT 3 TIMES { r ←← r + 1 y ←← y + 1 drawCircle(x, y, r) } x ←← 4 y ←← 4 r ←← 3 REPEAT 3 TIMES { drawCircle(x, y, r) y ←← y - 1 r ←← r - 1 }
Consider the following code segment. x ← 25 y ← 50 z ← 75 x ← y y ← z z ← x Which of the variables have the value 50 after executing the code segment?
x, y, and z