1/34
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
A certain computer game is played between a human player and a computer-controlled player. Every time the computer-controlled player has a turn, the game runs slowly because the computer evaluates all potential moves and selects the best one. Which of the following best describes the possibility of improving the running speed of the game?
Responses
A
The game’s running speed can only be improved if the game is played between two human players instead of with the computer-controlled player.
B
The game’s running speed might be improved by using a process that finds approximate solutions every time the computer-controlled player has a turn.
C
The game’s running speed cannot be improved because computers can only be programmed to find the best possible solution.
D
The game’s running speed cannot be improved because the game is an example of an algorithm that does not run in a reasonable time.
A certain computer game is played between a human player and a computer-controlled player. Every time the computer-controlled player has a turn, the game runs slowly because the computer evaluates all potential moves and selects the best one. Which of the following best describes the possibility of improving the running speed of the game?
Responses
A
The game’s running speed can only be improved if the game is played between two human players instead of with the computer-controlled player.
B
The game’s running speed might be improved by using a process that finds approximate solutions every time the computer-controlled player has a turn.
C
The game’s running speed cannot be improved because computers can only be programmed to find the best possible solution.
D
The game’s running speed cannot be improved because the game is an example of an algorithm that does not run in a reasonable time.
The code segment below uses the procedure IsFound (list, item), which returns true if item appears in list and returns false otherwise. The list resultList is initially empty.
Which of the following best describes the contents of resultList after the code segment is executed?
Responses
A
All elements in inputList1 followed by all elements in inputList2
B
Only elements that appear in both inputList1 and inputList2
C
Only elements that appear in either inputList1 or inputList2 but not in both lists
D
Only elements that appear in inputList1 but not in inputList2
Only elements that appear in both inputList1 and inputList2
The following spinner is used in a game. The region labeled "blue" represents 14 of the spinner. The regions labeled "orange" and "purple" are equal in size.
Which of the following code segments can be used to simulate the behavior of the spinner?
Select two answers.
response - correct
Responses
A
B
C
D
A
The following procedures are available for string manipulation.
Procedure Call | Explanation |
substring(str, start, end) | Returns a substring of consecutive characters of str starting with the character at position start and ending with the character at position end. The first character of str is considered position 1. For example, substring("delivery", 3, 6) returns "live". |
concat(str1, str2) | Returns a single string consisting of str1 followed by str2. For example, concat("key", "board") returns "keyboard". |
len(str) | Returns the number of characters in str. For example, len("key") returns 3. |
A programmer wants to create a new string by removing the character in position n of the string oldStr. For example, if oldStr is "best" and n is 3, then the new string should be "bet". Assume that 1 < n < len(oldStr).
Which of the following code segments can be used to create the desired new string and store it in newStr ?
Select two answers.
response - correct
Responses
A
left ← substring(oldStr, 1, n - 1)
right ← substring(oldStr, n + 1, len(oldStr))
newStr ← concat(left, right)
B
left ← substring(oldStr, 1, n + 1)
right ← substring(oldStr, n - 1, len(oldStr))
newStr ← concat(left, right)
C
newStr ← substring(oldStr, 1, n - 1)
newStr ← concat(newStr, substring(oldStr, n + 1, len(oldStr)))
D
newStr ← substring(oldStr, n + 1, len(oldStr))
newStr ← concat(newStr, substring(oldStr, 1, n - 1))
left ← substring(oldStr, 1, n - 1)
right ← substring(oldStr, n + 1, len(oldStr))
newStr ← concat(left, right)
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?
Responses
A
2 more items can be uniquely identified.
B
10 more items can be uniquely identified.
C
2 times as many items can be uniquely identified.
D
10 times as many items can be uniquely identified.
2 times as many items can be uniquely identified.
A group of students take hundreds of digital photos for a science project about weather patterns. Each 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, time, 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?
Select two answers.
response - correct
Responses
A
Determining the chronological order of the photos
B
Determining the number of clouds in a particular photo
C
Determining whether a photo is suitable for printing in black-and-white
D
Determining whether two photos were taken at the same location on different days
Determining the chronological order of the photos, Determining whether two photos were taken at the same location on different days
The algorithm below is used to simulate the results of flipping a coin 4 times. Consider the goal of determining whether the simulation resulted in an equal number of heads and tails.
Step 1: Initialize the variables heads_counter and flip_counter to 0.
Step 2: A variable coin_flip is randomly assigned a value of either 0 or 1. If coin_flip has the value 0, the coin flip result is heads, so heads_counter is incremented by 1.
Step 3: Increment the value of flip_counter by 1.
Step 4: Repeat steps 2 and 3 until flip_counter equals 4.
Following execution of the algorithm, which of the following expressions indicates that the simulation resulted in an equal number of heads and tails?
Responses
A
coin_flip = 1
B
flip_counter = 1
C
flip_counter = 2
D
heads_counter = 2
heads_counter = 2
The procedure Draw (length, direction) is used to draw a line segment length units long in a given direction (left, right, up, or down), starting at the current cursor position. The cursor is then repositioned at the end of the line segment that was drawn. Consider the following program, where the cursor starts in the upper left corner of a grid of dots. The dots are spaced one unit apart.
Draw (1, right)
Draw (2, down)
Draw (1, left)
Draw (1, right)
Draw (1, up)
Draw (1, left)
Which of the following represents the figure that is drawn by the program?
Responses
A
B
C
D
A list of numbers has n elements, indexed from 1 to n. The following algorithm is intended to display true if the value target appears in the list more than once and to display false otherwise. The algorithm uses the variables position and count. Steps 4 and 5 are missing.
Step 1:
Set count to 0 and position to 1.
Step 2:
If the value of the element at index position is equal to target, increase the value of count by 1.
Step 3:
Increase the value of position by 1.
Step 4:
(missing step)
Step 5:
(missing step)
Which of the following could be used to replace steps 4 and 5 so that the algorithm works as intended?
Responses
A
Step 4
Repeat steps 2 and 3 until the value of position is greater than n.
Step 5
If count is greater than or equal to 2, display true. Otherwise, display false.
B
Step 4
Repeat steps 2 and 3 until the value of position is greater than n.
Step 5
If count is greater than or equal to position, display true. Otherwise, display false.
C
Step 4
Repeat steps 2 and 3 until the value of count is greater than 2.
Step 5
If position is greater than or equal to n, display true. Otherwise, display false.
D
Step 4
Repeat steps 2 and 3 until the value of count is greater than n.
Step 5
If count is greater than or equal to 2, display true. Otherwise, display false.
Step 4
Repeat steps 2 and 3 until the value of position is greater than n.
Step 5
If count is greater than or equal to 2, display true. Otherwise, display false.
A sorted list of numbers contains 128 elements. Which of the following is closest to the maximum number of list elements that can be examined when performing a binary search for a value in the list?
Responses
A
2
B
8
C
64
D
128
8
In the following procedure, the parameter age represents a person’s age. The procedure is intended to return the name of the age group associated with age. People who are under 18 are considered minors, people who are 65 and older are considered senior citizens, and all other people are considered adults. The procedure does not work as intended.
Line 1: PROCEDURE ageGroup(age)
Line 2: {
Line 3: result ← "adult"
Line 4: IF(age ≥ 65)
Line 5: {
Line 6: result ← "senior citizen"
Line 7: }
Line 8: RETURN(result)
Line 9:
Line 10: result ← "adult"
Line 11: IF(age < 18)
Line 12: {
Line 13: result ← "minor"
Line 14: }
Line 15: RETURN(result)
Line 16: }
Removing which two lines of code will cause the procedure to work as intended?
Select two answers.
response - correct
Responses
A
Line 3
B
Line 8
C
Line 10
D
Line 15
Line 8, Line 10
RunRoutr is a fitness tracking application for smartphones that creates suggested running routes so that users can run with each other. Upon downloading the application, each user creates a username, a personal profile, and a contact list of friends who also use the application. The application uses the smartphone’s GPS unit to track a user’s location, running speed, and distance traveled. Users can use the application to review information and statistics about their previous runs.
At the beginning of a run, users indicate the distance they want to run from their current location, and the application suggests a running route. Once a user accepts a suggested route, the application shares the suggested route with other compatible users in the area so that they can run together. Users are considered compatible if they are on each other’s contact lists or if they typically run at similar speeds.
A basic RunRoutr account is free, but it displays advertisements that are targeted to individual users based on data collected by the application. For example, if a user’s running route begins or ends near a particular store, the application may display an advertisement for that store. Users have the ability to pay a monthly fee for a premium account, which removes advertisements from the application.
Which of the following data must be collected from a user’s smartphone in order for RunRoutr to suggest a running route?
Responses
A
Available running routes near the user’s home
B
The current time
C
The starting location of the user’s previous run
D
The user’s geographic position
The user’s geographic position
RunRoutr is a fitness tracking application for smartphones that creates suggested running routes so that users can run with each other. Upon downloading the application, each user creates a username, a personal profile, and a contact list of friends who also use the application. The application uses the smartphone’s GPS unit to track a user’s location, running speed, and distance traveled. Users can use the application to review information and statistics about their previous runs.
At the beginning of a run, users indicate the distance they want to run from their current location, and the application suggests a running route. Once a user accepts a suggested route, the application shares the suggested route with other compatible users in the area so that they can run together. Users are considered compatible if they are on each other’s contact lists or if they typically run at similar speeds.
A basic RunRoutr account is free, but it displays advertisements that are targeted to individual users based on data collected by the application. For example, if a user’s running route begins or ends near a particular store, the application may display an advertisement for that store. Users have the ability to pay a monthly fee for a premium account, which removes advertisements from the application.
Adrianna uses RunRoutr to suggest a running route. All compatible users near Adrianna receive a notification that shows her running route. Which of the following data is not obtained using data collected from Adrianna’s smartphone but necessary for RunRoutr to share Adrianna’s running route?
Responses
A
Adrianna’s average running speed
B
Adrianna’s preferred running distance
C
The current locations of other RunRoutr users
D
The usernames on Adrianna’s contact list
The current locations of other RunRoutr users
RunRoutr is a fitness tracking application for smartphones that creates suggested running routes so that users can run with each other. Upon downloading the application, each user creates a username, a personal profile, and a contact list of friends who also use the application. The application uses the smartphone’s GPS unit to track a user’s location, running speed, and distance traveled. Users can use the application to review information and statistics about their previous runs.
At the beginning of a run, users indicate the distance they want to run from their current location, and the application suggests a running route. Once a user accepts a suggested route, the application shares the suggested route with other compatible users in the area so that they can run together. Users are considered compatible if they are on each other’s contact lists or if they typically run at similar speeds.
A basic RunRoutr account is free, but it displays advertisements that are targeted to individual users based on data collected by the application. For example, if a user’s running route begins or ends near a particular store, the application may display an advertisement for that store. Users have the ability to pay a monthly fee for a premium account, which removes advertisements from the application.
Which of the following is most likely to be a benefit to users of the application?
Responses
A
The application allows users to identify all other users in a particular area.
B
Users of the application may be able to easily identify all other users in a particular area as a result of the application's algorithm for determining whether users are compatible.
C
Users of the application may see health benefits as a result of the application encouraging them to exercise with each other.
D
Users of the application who live in rural areas have the ability to use all the features of the application, even when they do not have Internet and geolocation connectivity.
Users of the application may see health benefits as a result of the application encouraging them to exercise with each other.
RunRoutr is a fitness tracking application for smartphones that creates suggested running routes so that users can run with each other. Upon downloading the application, each user creates a username, a personal profile, and a contact list of friends who also use the application. The application uses the smartphone’s GPS unit to track a user’s location, running speed, and distance traveled. Users can use the application to review information and statistics about their previous runs.
At the beginning of a run, users indicate the distance they want to run from their current location, and the application suggests a running route. Once a user accepts a suggested route, the application shares the suggested route with other compatible users in the area so that they can run together. Users are considered compatible if they are on each other’s contact lists or if they typically run at similar speeds.
A basic RunRoutr account is free, but it displays advertisements that are targeted to individual users based on data collected by the application. For example, if a user’s running route begins or ends near a particular store, the application may display an advertisement for that store. Users have the ability to pay a monthly fee for a premium account, which removes advertisements from the application.
Which of the following is most likely to be a data privacy concern for RunRoutr users?
Responses
A
Users of the application are required to carry their smartphones with them while running in order to enable all of the application’s features.
B
Users of the application may have the ability to determine information about the locations of users that are not on their contact lists.
C
Users of the application may not be able to accurately track their running history if they share their smartphone with another family member.
D
Users of the application may not be compatible with any other users in their area.
Users of the application may have the ability to determine information about the locations of users that are not on their contact lists.
RunRoutr is a fitness tracking application for smartphones that creates suggested running routes so that users can run with each other. Upon downloading the application, each user creates a username, a personal profile, and a contact list of friends who also use the application. The application uses the smartphone’s GPS unit to track a user’s location, running speed, and distance traveled. Users can use the application to review information and statistics about their previous runs.
At the beginning of a run, users indicate the distance they want to run from their current location, and the application suggests a running route. Once a user accepts a suggested route, the application shares the suggested route with other compatible users in the area so that they can run together. Users are considered compatible if they are on each other’s contact lists or if they typically run at similar speeds.
A basic RunRoutr account is free, but it displays advertisements that are targeted to individual users based on data collected by the application. For example, if a user’s running route begins or ends near a particular store, the application may display an advertisement for that store. Users have the ability to pay a monthly fee for a premium account, which removes advertisements from the application.
Businesses have the ability to target advertisements to different groups of people who use RunRoutr. Which of the following groups is LEAST likely to receive targeted advertisements?
Responses
A
Individuals who appear on each other’s contact lists
B
Individuals who are interested in running and fitness
C
Individuals who sign up for a premium account
D
Individuals whose running routes begin or end near a particular business location
Individuals who sign up for a premium account
Which of the following best exemplifies the use of keylogging to gain unauthorized access to a computer system?
Responses
A
A user unintentionally installs a program on their computer that records all user input and forwards it to another computer. A few weeks later, someone else is able to access the user’s computer using the recorded data.
B
A user has a very common password for an online banking account. Someone else guesses the password after a few attempts and gains access to the user’s account.
C
A user logs into an unsecure Web site. Someone else is able to view unencrypted log-in information as it is transmitted over the Internet. The user has the same username and password for multiple accounts, so the user’s log-in information for multiple systems may be compromised.
D
A user receives an e-mail that claims to be from the user’s bank. The e-mail instructs the user to click on a link to a Web site and enter a username and password to verify an account. Shortly after following the steps, the user discovers that the Web site is fraudulent and that the user’s username and password were stolen.
A user unintentionally installs a program on their computer that records all user input and forwards it to another computer. A few weeks later, someone else is able to access the user’s computer using the recorded data.
Consider the following code segment, which uses the variables r, s, and t.
r ← 1
s ← 2
t ← 3
r ← s
s ← t
DISPLAY (r)
DISPLAY (s)
What is displayed as a result of running the code segment?
Responses
A
1 1
B
1 2
C
2 3
D
3 2
2 3
A certain computer has two identical processors that are able to run in parallel. The following table indicates the amount of time it takes to execute each of four processes on a single processor. Assume that none of the processes is dependent on any of the other processes.
Process | Execution Time onEither Processor |
P | 30 seconds |
Q | 10 seconds |
R | 20 seconds |
S | 15 seconds |
Which of the following parallel computing solutions would minimize the amount of time it takes to execute all four processes?
Responses
A
Running processes P and Q on one processor and processes R and S on the other processor
B
Running processes P and R on one processor and processes Q and S on the other processor
C
Running processes P and S on one processor and processes Q and R on the other processor
D
Running process P on one processor and processes Q, R, and S on the other processor
Running processes P and Q on one processor and processes R and S on the other processor
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
Responses
A
I only
B
II only
C
II and III only
D
I, II, and III
II and III only
In the procedure Mystery below, the parameter number is a positive integer.
Which of the following best describes the result of running the procedure Mystery?
Responses
A
The procedure returns true when the initial value of number is 2, and it otherwise returns false.
B
The procedure returns true when the initial value of number is greater than 2, and it otherwise returns false.
C
The procedure returns true when the initial value of number is even, and it otherwise returns false.
D
The procedure returns true when the initial value of number is odd, and it otherwise returns false.
The procedure returns true when the initial value of number is even, and it otherwise returns false.
Programs I and II below are each intended to calculate the sum of the integers from 1 to n. Assume that n is a positive integer (e.g., 1, 2, 3, …).
Which of the following best describes the behavior of the two programs?
Responses
A
Program I displays the correct sum, but program II does not.
B
Program II displays the correct sum, but program I does not.
C
Both program I and program II display the correct sum.
D
Neither program I nor program II displays the correct sum.
Both program I and program II display the correct sum.
Which of the following is an example of an attack using a rogue access point?
Responses
A
An unauthorized individual gains the ability to view network traffic by connecting to a network router that uses weak or no security measures.
B
An unauthorized individual physically disconnects an exposed network router, making the network unavailable to some users.
C
An unauthorized individual poses as a network administrator and attempts to trick a user into providing personal information.
D
A group of unauthorized individuals overwhelms a network router with traffic, making it unavailable to some users.
An unauthorized individual gains the ability to view network traffic by connecting to a network router that uses weak or no security measures.
The following code segment is intended to remove all duplicate elements in the list myList. The procedure does not work as intended.
j ← LENGTH(myList)
REPEAT UNTIL(j = 1)
{
IF(myList[j] = myList[j - 1])
{
REMOVE(myList, j)
}
j ← j - 1
}
For which of the following contents of myList will the procedure NOT produce the intended results?
Select two answers.
response - correct
Responses
A
[10, 10, 20, 20, 10, 10]
B
[30, 30, 30, 10, 20, 20]
C
[30, 50, 40, 10, 20, 40]
D
[50, 50, 50, 50, 50, 50]
[10, 10, 20, 20, 10, 10] , [30, 50, 40, 10, 20, 40]
In a certain video game, players are awarded bonus points at the end of a level based on the value of the integer variable timer. The bonus points are awarded as follows.
If timer is less than 30, then 500 bonus points are awarded.
If timer is between 30 and 60 inclusive, then 1000 bonus points are awarded.
If timer is greater than 60, then 1500 bonus points are awarded.
Which of the following code segments assigns the correct number of bonus points to bonus for all possible values of timer ?
Select two answers.
response - correct
Responses
A
B
C
D
A (remember 500)
The program segment below is intended to move a robot in a grid to a gray square. The program segment uses the procedure GoalReached, which evaluates to true if the robot is in the gray square and evaluates to false otherwise. The robot in each grid is represented as a triangle and is initially facing left. The robot can move into a white or gray square but cannot move into a black region.
For which of the following grids does the program NOT correctly move the robot to the gray square?
Responses
A
B
C
D
An algorithm will be used to identify the maximum value in a list of one or more integers. Consider the two versions of the algorithm below.
Algorithm I : Set the value of a variable max to − 1. Iterate through the list of integer values. If a data value is greater than the value of the variable max, set max to the data value.
Algorithm II : Set the value of a variable max to the first data value. Iterate through the remaining values in the list of integers. If a data value is greater than the value of the variable max, set max to the data value.
Which of the following statements best describes the behavior of the two algorithms?
Responses
A
Both algorithms work correctly on all input values.
B
Algorithm I always works correctly, but Algorithm II only works correctly when the maximum value is not the first value in the list.
C
Algorithm II always works correctly, but Algorithm I only works correctly when the maximum value is greater than or equal to − 1.
D
Neither algorithm will correctly identify the maximum value when the input contains both positive and negative input values.
Algorithm II always works correctly, but Algorithm I only works correctly when the maximum value is greater than or equal to − 1.
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.
response - correct
Responses
A
The difference between
and
is zero.
B
The product of
and
is a positive even number.
C
The quotient when
is divided by
is greater than 1.
D
The sum of
and
is a positive even number.
The difference between
and
is zero.
The sum of
and
is a positive even number.
Which of the following best explains how symmetric encryption algorithms are typically used?
Responses
A
Symmetric encryption uses a single key that should be kept secret. The same key is used for both encryption and decryption of data.
B
Symmetric encryption uses a single key that should be made public. The same key is used for both encryption and decryption of data.
C
Symmetric encryption uses two keys that should both be kept secret. One key is used for encryption, and the other is used for decryption.
D
Symmetric encryption uses two keys. The key used for encryption should be made public, but the key used for decryption should be kept secret.
Symmetric encryption uses a single key that should be kept secret. The same key is used for both encryption and decryption of data.
A code segment is intended to transform the list utensils so that the last element of the list is moved to the beginning of the list.
For example, if utensils initially contains ["fork", "spoon", "tongs", "spatula", "whisk"], it should contain ["whisk", "fork", "spoon", "tongs", "spatula"] after executing the code segment.
Which of the following code segments transforms the list as intended?
Responses
A
len ← LENGTH(utensils)
temp ← utensils[len]
REMOVE(utensils, len)
APPEND(utensils, temp)
B
len ← LENGTH(utensils)
REMOVE(utensils, len)
temp ← utensils[len]
APPEND(utensils, temp)
C
len ← LENGTH(utensils)
temp ← utensils[len]
REMOVE(utensils, len)
INSERT(utensils, 1, temp)
D
len ← LENGTH(utensils)
REMOVE(utensils, len)
temp ← utensils[len]
INSERT(utensils, 1, temp)
len ← LENGTH(utensils)
temp ← utensils[len]
REMOVE(utensils, len)
INSERT(utensils, 1, temp)
Which of the following best explains the ability to solve problems algorithmically?
Responses
A
Any problem can be solved algorithmically, though some algorithmic solutions may require humans to validate the results.
B
Any problem can be solved algorithmically, though some algorithmic solutions must be executed on multiple devices in parallel.
C
Any problem can be solved algorithmically, though some algorithmic solutions require a very large amount of data storage to execute.
D
There exist some problems that cannot be solved algorithmically using any computer.
There exist some problems that cannot be solved algorithmically using any computer.
A program developed for a Web store represents customer account balances using a format that approximates real numbers. While testing the program, a software developer discovers that some values appear to be mathematically imprecise. Which of the following is the most likely cause of the imprecision?
Responses
A
The account balances are represented using a fixed number of bits, resulting in overflow errors.
B
The account balances are represented using a fixed number of bits, resulting in round-off errors.
C
The account balances are represented using an unlimited number of bits, resulting in overflow errors.
D
The account balances are represented using an unlimited number of bits, resulting in round-off errors.
The account balances are represented using a fixed number of bits, resulting in round-off errors.
Each student at a school has a unique student ID number. A teacher has the following spreadsheets available.
Spreadsheet I contains information on all students at the school. For each entry in this spreadsheet, the student name, the student ID, and the student’s grade point average are included.
Spreadsheet II contains information on only students who play at least one sport. For each entry in this spreadsheet, the student ID and the names of the sports the student plays are included.
Spreadsheet III contains information on only students whose grade point average is greater than 3.5. For each entry in this spreadsheet, the student name and the student ID are included.
Spreadsheet IV contains information on only students who play more than one sport. For each entry in this spreadsheet, the student name and the student ID are included.
The teacher wants to determine whether students who play a sport are more or less likely to have higher grade point averages than students who do not play any sports. Which of the following pairs of spreadsheets can be combined and analyzed to determine the desired information?
Responses
A
Spreadsheets I and II
B
Spreadsheets I and IV
C
Spreadsheets II and III
D
Spreadsheets III and IV
Spreadsheets I and II
The following question uses a robot in a grid of squares. The robot is represented by a triangle, which is initially facing right.
Consider the following procedure.
Which of the following code segments will move the robot to the gray square along the path indicated by the arrows?
Responses
A
B
C
D
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?
Responses
A
Step 3
Increase the value of position by 1.
Step 4
Repeat steps 2 and 3 until the value of count is greater than 100.
B
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.
C
Step 3
Repeat step 2 until the value of count is greater than 100.
Step 4
Increase the value of position by 1.
D
Step 3
Repeat step 2 until the value of position is greater than n.
Step 4
Increase the value of count by 1.
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.