APCSP Final

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

["The', "right', 'red', 'box', 'is', back']

Given the following, what is printed?

float

The Python numeric type for representing numbers containing fractional values is?

4

The list wordList contains a list of 10 string values. Which of the following is a valid index for the list?

Keeping the numeric values in a list makes it easier to apply the same computation to every data element.

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?

['The', 'ight', 'ed box is back']

Given the following, what is printed?

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.

After clicking the link, a Web page opens that prompts the recipient for personal information.

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?

A database of information about shows at a concert venue contains the following information. Which of the following additional pieces of information would be most useful in determining the artist with the greatest attendance during a particular month? 2/22 for pic

Average ticket price

picture C see quiz 4/15 for pictures

Consider the following code segment. Assume that index1 is a number between 1 and LENGTH(theList), inclusive. What is the largest possible value that the variable x can have after the code segment executes? See quiz 4/15 for picture

Decimal 5, binary 1011, decimal 12, binary 1101

Consider the following numeric values. Which of the following lists the values in order from least to greatest? See 2/16 for picture

c

Consider the following procedures for string manipulation. Which of the following code segments can be used to store "noon" in the string variable word ? see pic on 3/31

Four bits are enough to store the eight directions.

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?

Providing free community access to computers at schools, libraries, and community centers

Which of the following actions is most likely to be effective in reducing the digital divide at a local level?

5

Consider the following code segment. 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? see pic on 4/6

100 300 500

Consider the following code segment. What is displayed as a result of executing the code segment?

1 3 2 4

Consider the following code segment. Which of the following CANNOT be displayed as a result of executing the code segment?

Investigating ways to reduce the amount of trash in the ocean and Studying the effect of a genetic change in a population

In which of the following scenarios is using a simulation more beneficial than performing a calculation?

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 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 best exemplifies the use of multifactor authentication?

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 uses the following data files. 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?

The programmer can specify the ways that other people are legally allowed to use and distribute the software.

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?

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.

Some parents prefer to limit the amount of time their children spend using computing devices or the Internet.

Which of the following is LEAST likely to be a contributing factor to the digital divide?

for i in range(5)

Which of the following is a counted loop that executes 5 times?

[10, 30, 50, 70]

refer to 4th picture, march 24&25th

The list must be sorted based on the genetic code values.

A large number of genetic codes are stored as binary values in a list. Which one of the following conditions must be true in order for a researcher to obtain the correct result when using a binary search algorithm to determine if a given genetic code is in the list?

sum ← RANDOM(1, 12) + RANDOM(1, 12) + RANDOM(1, 12)

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?

I, II, and III

For which of the following lists can a binary search be used to search for an item in the list? I. ["blue", "green", "jade", "mauve", "pink"] II. [5, 5, 5, 5, 6, 7, 8, 8, 8] III. [10, 5, 3, 2, -4, -8, -9, -12]

False

What does the following code print?

19

What is printed when the following statements execute?

The model used by the simulation software cannot be modified once the simulation has been used

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?

It prevents users from accessing infrequently used files when there is no Internet connectivity.

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?

[0,1,2,3,4]

What is the result of evaluating the expression list(range(5))?

9

Consider the 4-bit binary numbers 0011, 0110, and 1111. Which of the following decimal values is NOT equal to one of these binary numbers?

to you happy birthday

Consider the following procedures. What is displayed as a result of the procedure call proc2("birthday", "to you") ? (See code picture in quiz 4/21)

By providing multiple paths between devices, enabling routing to occur even in the presence of a failed component

Which of the following best explains how fault tolerance in a network is achieved?

val1 = false, val2 = false

the following code segment is used to determine whether a customer is eligible for a discount on a movie ticket. If category is "new" and age is 20, what are the values of val1 and val2 as a result of executing the code segment?

a

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? see pic on 4/6

I, II, and III

Which of the following are true statements about the data that can be represented using binary sequences? See 2/16 for picture

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.

Show that for one instance of the problem, no algorithm can be written that is capable of providing a correct yes-or-no answer.

A student wants to determine whether a certain problem is undecidable. Which of the following will demonstrate that the problem is undecidable?

14

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. Which of the following can be used to replace <MISSING CODE> so that the code segment works as intended?

An overflow error will occur because 4 bits is not large enough to represent 29, the sum of 14 and 15.

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?

The vehicle location data could be used to monitor the movements of city residents.

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?

Collaboration that includes diverse backgrounds and perspectives can eliminate the need for software testing.

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?

A string variable named studentName and a Boolean variable named isAbsent

A teacher is writing a code segment that will use variables to represent a student's name and whether or not the student is currently absent. Which of the following variables are MOST appropriate for the code segment?

There is no possible algorithm that can be used to solve all instances of the problem.

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?

When the value of exam is 80 and the value of presentation is 60

Consider the following code segment, where exam and presentation are integer variables and grade is a string variable. Under which of the following conditions will the value "C" be assigned to the variable grade ?see pic on 4/6

Determining the longest word in a textbook

For which of the following problems is using a simulation LEAST likely to be beneficial?

["The', "right', 'red', 'box', 'is', back']

Given the following, what is printed? s = "The right red box is back" s.split ( )

The player had 3 bonus round attempts and 7 of them earned extra points

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?

3

The figure to the left 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?

Having all three students write code independently and then having one student combine the code into a program.

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?

Some problems cannot be solved by an algorithm.

Which of the following best explains how algorithms that run on a computer can be used to solve problems?

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. The researcher also has access to another database with the following information about each student. 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? Refer to 2/22 for pic

Students who have the same name may be confused with each other.

Users can submit updates on local traffic conditions in real time.

A mobile application is used to display local traffic conditions. Which of the following features of the application best exemplifies the use of crowdsourcing?

8

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?

"h"

Assume that both lists and strings are indexed starting with index 1. The list wordList has the following contents. Let myWord be the element at index 3 of wordList. Let myChar be the character at index 2 of myWord. What is the value of myChar ? ["abc", "def:, "ghi", "jkl"]

True

What does this expression evaluate to 3==3

An application that allows users to view descriptions and photographs of local landmarks

Which of the following applications is most likely to benefit from the use of crowdsourcing?

The efficiency of a solution that can be broken down into parallel portions is still limited by a sequential portion.

Which of the following best describes the ability of parallel computing solutions to improve efficiency?

For which of the following situations would it be best to use a heuristic in order to find a solution that runs in a reasonable amount of time?

Finding the fastest route that visits every location among n locations, which requires n! possible routes be examined.

['The', 'ight', 'ed box is back']

Given the following, what is printed? s = "The right red box is back" s.split ("r")

If one component of the system fails, users of the system can often still access it.

Which of the following is a primary benefit of making a computing system fault-tolerant?

Open protocols provide a way to standardize data transmission between different devices.

Which of the following is a primary reason for the use of open protocols on the Internet?

x and z only

Consider the following code segment. Which of the variables have the value 50 after executing the code segment? x-- 25 y--50 z--75 x--y y--z z--x

initials ← concat(prefix(firstName, 1), prefix(lastName, 1))

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 ? see pic on 3/31

Collaboration that includes diverse backgrounds and perspectives can eliminate the need for software testing.

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. Collaboration that includes diverse backgrounds and perspectives can help the team anticipate the needs of a variety of software users. Collaboration that includes diverse backgrounds and perspectives can help the team avoid bias. Collaboration that includes diverse backgrounds and perspectives can reflect the strengths of the individual team members.

Users can provide feedback that can be used to incorporate a variety of perspectives into the software.

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 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 identify and correct errors they encounter when using released versions of the software. Users can review the algorithms used in the software to help improve their efficiency. Users can provide documentation for program code at the end of the software development process. Users can provide feedback that can be used to incorporate a variety of perspectives into the software.

Points of interest may be more densely located in cities, favoring players in urban areas over players in rural areas.

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?

Picture B

Consider the following code segment with an integer variable num. Which of the following code segments is equivalent to the code segment above?

three

Consider the following code segment with integer variables x and y. If x has a value of 7 and y has a value of 20, what is displayed as a result of executing the code segment? see pic on 4/6

The value of first is true, and the value of second is true.

Consider the following code segment. What are the values of first and second as a result of executing the code segment? first--- true second-- false second--first first--second

true true true

Consider the following code segment. What is displayed as a result of executing the code segment? See quiz 4/8 for picture

Lists often allow size to be easily updated to hold as many data values as needed

What is a benefit of using a list as a data abstraction in a program

19

What is printed when the following statements execute? day = "Thursday" day = 23.5 day = 19 print(day)

The elements of the list are not sorted.

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?

REPEAT 2 TIMES

The following grid contains a robot represented as a triangle, which is initially facing right. The following code segment is intended to move the robot to the gray square. Which of the following can be used as a replacement for <MISSING STATEMENT> so that the code segment works as intended? See quiz 4/8 for picture

Picture D

The following grid contains a robot represented as a triangle, which is initially facing toward the top of the grid. The robot can move into a white or gray square but cannot move into a black region. Which of the following code segments can be used to move the robot to the gray square? See picture 4/8 for picture

[-1, 0, 1]

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. For which of the following contents of myList does the procedure NOT return the intended result? * refer to feb 8th quiz for picture [-3, -2, -1] [-2, -1, 0] [-1, 0, 1] [1, 2, 3]

FOR EACH vote IN voteList

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?

Deploying satellites and other infrastructure to provide inexpensive Internet access to remote areas of Earth

Which of the following actions is most likely to help reduce the digital divide?

A musician creates a song using samples of a copyrighted work and then uses a Creative Commons license to publish the song.

Which of the following actions is most likely to raise legal or ethical concerns?

Collecting pictures of plants from around the world that can be analyzed to look for regional differences in plant growth.

Which of the following activities is most likely to be successful as a citizen science project?

The message is broken into packets. The packets can be received in any order and still be reassembled by the recipient's device.

Which of the following best explains how messages are typically transmitted over the Internet?

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

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-world position, and a sequence of bits is used to represent each sample.

The developers can analyze the data to make improvements to the application based on user behavior.

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. 1. Screen brightness and contrast 2. Choice of typeface and font size 3. Amount of spacing between lines of text 4. 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. 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 World Wide Web is a system of linked pages, programs, and files that is accessed via a network called the Internet.

Which of the following best describes the relationship between the World Wide Web and the Internet?

A procedure isFound, which takes a word and a text file as input and returns true if the word appears in the text file

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?

6 and 8

A homework assignment consists of 10 questions. The assignment is graded as follows. 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? * refer to February 8th quiz for picture 6 and 8 7 and 8 8 and 9 Option 4

Filter by photographer, then filter by year, then sort by year. Sort by subject, then sort by year, then filter by photographer.

A large spreadsheet contains information about the photographs in a museum's collection. A sample portion of the spreadsheet is shown below. In column A, each unknown photographer is set to "(unknown)". In column C, each unknown year is set to -1. A student is developing an algorithm to determine the name of the photographer who took the oldest photograph in the collection. Photographs whose photographer or year are unknown are to be ignored. Once the algorithm is complete, the desired entry will appear in the first row of the spreadsheet. If there are multiple entries that meet the desired criteria, then any of them can appear in the first row. The student has the following actions available. Assume that applying either of the filters will not change the relative order of the rows remaining in the spreadsheet. Which of the following sequences of steps can be used to identify the desired entry?

(genre = "mystery") AND ((1 ≤ num) AND (cost < 10.00))

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

The researcher can allow the results to be easily obtained by other researchers and members of the general public.

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?

Testing the system with people of different ages, genders, and ethnicities

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?

A procedure that returns the sum of the values in the 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?

Step 1: Subtract num1 from num2 and store the result in the variable diff. Step 2: Take the absolute value of diff and display the result.

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 ? Picture on 3/29

The cost of a food item currently available for order

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

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 address where the order should be delivered The cost of a food item currently available for order The credit card or payment information for the purchaser The name of a food item to be included in the delivery

The student is reusing the computer scientist's procedural abstraction by knowing what the procedure does without knowing how it does it.

A student is developing a program that allows users to look up the definitions of words that appear in a book. The student plans to perform a large number of searches through a dictionary containing words and their definitions. The student will use a procedure written by a computer scientist to quickly search the dictionary (and knows that the procedure will return a definition if one is available). The student cannot modify the search procedure written by the computer scientist but can call the procedure by supplying a word. Which of the following is a true statement about the student's use of the computer scientist's search procedure?

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

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?

I and II

A student wrote the following procedure to calculate the sum of the integers from 1 to 5. The student later decides to modify the procedure to calculate the sum of the integers from 1 to max, which represents any positive integer greater than 1. Which of the following changes should be made to the procedure to meet the student's goal? (See picture on quiz 4/23)

picture A

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?

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

Both databases are needed. Each database can be searched by animal name to find all information to be displayed.

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. For example, if a guest selects the animal name "wolf," the exhibit is intended to display the following information. 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?

The algorithm runs in a reasonable amount of time because it will use approximately n2 steps to draw n shapes.

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?

Processes W and Z should be assigned to one processor, and processes X and Y should be assigned to the other processor.

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

D. (See picture of code on quiz 4/23)

A computer program contains code in several places that asks a user to enter an integer within a specified range of values. The code repeats the input request if the value that the user enters is not within the specified range. A programmer would like to create a procedure that will generalize this functionality and can be used throughout the program. The correct use of the procedure is shown below, where min is the least acceptable value, max is the greatest acceptable value, and promptString is the string that should be printed to prompt the user enter a value. Which of the following is a correct implementation of the getRange procedure? (See code on quiz 4/23)

Making the code run faster

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?

Algorithm B and Algorithm C

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?

C. (See picture of code on quiz 4/23)

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. 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. Which of the following is a correct implementation of updateScore ? (See picture of code on quiz 4/23)

["guitar", "drums", "bass"]

Consider the following code segment. What are the contents of secondList after the code segment is executed? first list -- ["guitar", "drums", "bass"] secondlist-- ["flute", "violin"] thirdlist -- [] thirdlist-- firstlist firstlist-- secondlist secondlist -- thirdlist

count1 = 2, count2 = 3

Consider the following code segment. What are the values of count1 and count2 as a result of executing the code segment?

21 40 30 50

Consider the following code segment. What is displayed as a result of executing the code segment? see picture on 3/29

Any integer value from 7 to 16, inclusive

Consider the following code segment. Which of the following describes the possible values of ans as a result of executing the code segment?

10 10

Consider the following procedure. Consider the following statement. DISPLAY(doSomething(10, 20)) What is displayed as a result of executing the statement above? (See picture of code in quiz 4/21)

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 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? (See picture in quiz 4/21)

drawLine(1, 5, xVal, yVal) drawLine(1, 5, xVal, yVal + 2) drawLine(1, 5, xVal, yVal - 2)

Consider the following procedure. The drawLine procedure is to be used to draw the following figure on a coordinate grid. The drawLine procedure is to be used to draw the following figure on a coordinate grid. (See picture in quiz 4/21)

III 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? * II only III only II and III only I, II and III

I and 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 are needed for DineOutHelper to recommend a restaurant for the group?

It displays true if x is negative and displays nothing otherwise.

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 nothing if x is negative and displays true otherwise. It displays nothing if x is negative and displays false otherwise. It displays true if x is negative and displays nothing otherwise. It displays true if x is negative and displays false otherwise.

Prints all positive odd integers that are less than or equal to max.

In the following procedure, the parameter max is a positive integer. Which of the following is the most appropriate documentation to appear with the printNums procedure? * feb 8th quiz for image Prints all positive even integers that are less than or equal to max. Prints all positive odd integers that are less than or equal to max. Prints all positive even integers that are greater than max. Prints all positive odd integers that are greater than max.

1**1 2*2

In the following procedure, the parameter str is a string and the parameter num is a number. Consider the following code segment. What is displayed as a result of executing the code segment? (See picture of code in quiz 4/21)

A retail company wants to determine the most popular item that was sold on the company's Web site last month

In which of the following scenarios would a simulation be the LEAST beneficial?

Users with visual impairments may be able to more easily read or listen to books and articles.

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. 1. Screen brightness and contrast 2. Choice of typeface and font size 3. Amount of spacing between lines of text 4. 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 of the basic version of StreamPal indirectly support StreamPal by allowing themselves to receive advertisements.

StreamPal is an audio-streaming application for mobile devices that allows users to listen to streaming music and connect with other users who have similar taste in music. After downloading the application, each user creates a username, personal profile, and contact list of friends who also use the application. The application uses the device's GPS unit to track a user's location. Each time a user listens to a song, the user can give it a rating from 0 to 5 stars. The user can access the following features for each song that the user has rated. 1. A list of users on the contact list who have given the song the same rating, with links to those users' profiles 2.A map showing all other users in the area who have given the song the same rating, with links to those users' profiles. A basic StreamPal account is free, but it displays advertisements that are based on data collected by the application. For example, if a user listens to a particular artist, the application may display an advertisement for concert tickets the next time the artist comes to the user's city. Users have the ability to pay a monthly fee for a premium account, which removes advertisements from the application. Which of the following statements is most likely true about the differences between the basic version and the premium version of StreamPal?

II 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? I. All the people in the room stand up. All standing people form pairs where possible, leaving at most one person not part of a pair. For each pair, the person with the earlier birthday remains standing, while the other person in the pair sits down. If there is a tie, both people sit down. Any individual not part of a pair remains standing. Continue doing this until only one person remains standing. That person has the earliest birthday. II. All the people in the room stand up. All standing people form pairs with another standing person that they have not previously been paired with where possible, leaving at most one person not part of a pair. For each pair, the person with the earlier birthday remains standing, while the other person in the pair sits down. If there is a tie, both people in the pair remain standing. Any individual not part of a pair remains standing. Continue doing this until only one person remains standing or all persons standing have the same birthday. Anyone still standing has the earliest birthday. III. Beginning with the number 1, ask if anyone was born on that day of any month. Continue with the numbers 2, 3, and so on until a positive response is received. If only one person responds, that person has the earliest birthday. If more than one person responds, determine which person was born in the earliest month, and that person or those persons have the earliest birthday. *

Step 1: 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.

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?

The network is considered fault-tolerant because there are redundant paths between each pair of devices.

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?

No change is needed; the algorithm is correct as is.

The following grid contains a robot represented as a triangle, which is initially in the bottom-left square of the grid and facing the top of the grid. The robot can move into a white or a gray square but cannot move into a black region. The following code segment implements an algorithm that moves the robot from its initial position to the gray square and facing the top of the grid. When the robot reaches the gray square, it turns around and faces the bottom of the grid. Which of the following changes, if any, should be made to the code segment to move the robot back to its original position in the bottom-left square of the grid and facing toward the bottom of the grid?

Inserting the statement count ← count + 1 between line 6 and line 7

The following question uses a robot in a grid of squares. The robot is represented as a triangle, which is initially facing toward the top of the grid. Consider the goal of modifying the code segment to count the number of squares the robot visits before execution terminates. Which of the following modifications can be made to the code segment to correctly count the number of squares the robot moves to?

Using a simulation may expose potential safety issues that can be corrected before construction begins

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?

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.

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?

Having all three students write code independently and then having one student combine the code into a program

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? Having all three students participate in frequent video chat sessions to discuss ideas about the project and to provide feedback on work done so far Having all three students use an online shared folder to contribute and discuss components to be considered for use in the application Having all three students write code independently and then having one student combine the code into a program Having all three students work in a shared document that each can edit to provide comments on the work in progress

temp<--word1 word1<---word3 word3<---temp

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? Picture on 3/29

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?

Users might enter abbreviations for the names of cities. Users might misspell the name of the city.

False

What does this expression evaluate to 3!=3

False

What does this expression evaluate to 3>=3

x > 0 and x < 5

What is a correct Python expression for checking to see if a number stored in a variable x is between 0 and 5?

53

What value is printed when the following is executed? (print(int(53.785))?

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 explains how the Internet is a fault-tolerant system?

temp<--num1 num1<---num2 num2<---temp

Which of the following code segments can be used to interchange the values of the variables num1 and num2 ?

for i in range(5):

Which of the following is a counted loop that executes 5 times? for i in 5: for i in range(6): loop 5 times: for i in range(5):

I and 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 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

Interchanging lines 3 and 7

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. Which of the following changes can be made so that the code segment works as intended? * refer to feb 8th quiz for image Changing line 1 to IF(score < 0) Changing line 1 to IF(score + penalty < 0) Changing line 7 to score ← score + penalty Interchanging lines 3 and 7

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.

In the following procedure, the parameter numList is a list of numbers and the parameters j and k are integers. Which of the following is the most appropriate documentation to appear with the swapListElements procedure? * feb 8 quiz for image Returns a copy of numList with the elements at indices j and k interchanged. The value of j must be between 0 and the value of k, inclusive. 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. Interchanges the values of the parameters j and k. The value of j must be between 0 and the value of k, inclusive. Interchanges the values of the parameters j and k. The values of j and k must both be between 1 and LENGTH(numList), inclusive.

Displays the value of (x + y) / x. The value of the parameter x must not be 0.

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. Displays the value of x + (y / x). The value of the parameter y must not be 0. Displays the value of (x + y) / x. The value of the parameter x must not be 0. Displays the value of (x + y) / x. The sum of the parameters x and y must not be 0.

Users of the application may have the ability to determine information about the locations of users that are not on their contact list.

Item 1StreamPal is an audio-streaming application for mobile devices that allows users to listen to streaming music and connect with other users who have similar taste in music. After downloading the application, each user creates a username, personal profile, and contact list of friends who also use the application. The application uses the device's GPS unit to track a user's location. Each time a user listens to a song, the user can give it a rating from 0 to 5 stars. The user can access the following features for each song that the user has rated. 1. A list of users on the contact list who have given the song the same rating, with links to those users' profiles 2. A map showing all other users in the area who have given the song the same rating, with links to those users' profiles. A basic StreamPal account is free, but it displays advertisements that are based on data collected by the application. For example, if a user listens to a particular artist, the application may display an advertisement for concert tickets the next time the artist comes to the user's city. 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 StreamPal users?

The value of x is approximately equal to the value of y.

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

The owner of a clothing store records the following information for each transaction made at the store during a 7-day period. 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?

number

The variable age is to be used to represent a person's age, in years. Which of the following is the most appropriate data type for age ?

list

The variable isOpen is to be used to indicate whether or not a store is currently open. Which of the following is the most appropriate data type for isOpen


संबंधित स्टडी सेट्स

Environmental and Energy Policy:

View Set

ASE1020103 Basic Auto Electricity

View Set

Unit 5: Cardiovascular physiology

View Set

Prep U Fundamentals of Nursing CH 45

View Set