HM 4/5/21

Ace your homework & exams now with Quizwiz!

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

A

Which of the following best explains how symmetric encryption algorithms are typically used? 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.

A

The following procedures are available for string manipulation. Procedure CallExplanationsubstring(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. A left ←\leftarrow← substring (oldStr, 1, n - 1) right ←\leftarrow← substring (oldStr, n + 1, len(oldStr)) newStr ←\leftarrow← concat (left, right) B left ←\leftarrow← substring (oldStr, 1, n + 1) right ←\leftarrow← substring (oldStr, n - 1, len(oldStr)) newStr ←\leftarrow← concat (left, right) C newStr ←\leftarrow← substring (oldStr, 1, n - 1) newStr ←\leftarrow← concat (newStr, substring (oldStr, n + 1, len (oldStr))) D newStr ←\leftarrow← substring (oldStr, n + 1, len (oldStr)) newStr ←\leftarrow← concat (newStr, substring (oldStr, 1, n - 1))

A&C

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. A B C D

A&D

The following spinner is used in a game. The region labeled "blue" represents 1/4 or 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. A B C D

A&D

The following table shows the value of expression based on the values of input1 and input2. Value of input1Value of input2Value of expressiontruetruefalsetruefalsetruefalsetruetruefalsefalsetrue Which of the following expressions are equivalent to the value of expression as shown in the table? Select TWO answers. A (NOT input1) OR (NOT input2) B (NOT input1) AND (NOT input2) C NOT (input1 OR input2) D NOT (input1 AND input2)

A&D

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? A 2 B 8 C 64 D 128

B

A company delivers packages by truck and would like to minimize the length of the route that each driver must travel in order to reach n delivery locations. The company is considering two different algorithms for determining delivery routes. Algorithm I Generate all possible routes, compute their lengths, and then select the shortest possible route. This algorithm does not run in reasonable time. Algorithm II Starting from an arbitrary delivery location, find the nearest unvisited delivery location. Continue creating the route by selecting the nearest unvisited location until all locations have been visited. This algorithm does not guarantee the shortest possible route and runs in time proportional to n2. Which of the following best categorizes algorithm II? A Algorithm II attempts to use an algorithmic approach to solve an otherwise undecidable problem. B Algorithm II uses a heuristic approach to provide an approximate solution in reasonable time. C Algorithm II provides no improvement over Algorithm I because neither algorithm runs in reasonable time. D Algorithm II requires a much faster computer in order to provide an improvement over Algorithm I.

B Algorithm II uses a heuristic approach to provide an approximate solution in reasonable time.

Which of the following best explains how an analog audio signal is typically represented by a computer? A An analog audio signal is measured as input parameters to a program or procedure. The inputs are represented at the lowest level as a collection of variables. B An analog audio signal is measured at regular intervals. Each measurement is stored as a sample, which is represented at the lowest level as a sequence of bits. C An analog audio signal is measured as a sequence of operations that describe how the sound can be reproduced. The operations are represented at the lowest level as programming instructions. D An analog audio signal is measured as text that describes the attributes of the sound. The text is represented at the lowest level as a string.

B An analog audio signal is measured at regular intervals. Each measurement is stored as a sample, which is represented at the lowest level as a sequence of bits.

Assume that the Boolean variable hot is assigned the value true and the Boolean variable humid is assigned the value false. Which of the following will display the value true? Select TWO answers. A B C D

B&C

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 A Line 3 B Line 8 C Line 10 D Line 15

B&C

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? A Spreadsheets I and II B Spreadsheets I and IV C Spreadsheets II and III D Spreadsheets III and IV

C

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

C

Which of the following is an example of an attack using a rogue access point? 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.

C

A store uses binary numbers to assign a unique binary sequence to each item in its inventory. What is the minimum number of bits required for each binary sequence if the store has between 75 and 100 items in its inventory? A 5 B 6 C 7 D 8

C 7

A list of numbers is considered increasing if each value after the first is greater than or equal to the preceding value. The following procedure is intended to return true if numberList is increasing and return false otherwise. Assume that numberList contains at least two elements. Line 1: PROCEDURE isIncreasing(numberList) Line 2: { Line 3: count ← 2 Line 4: REPEAT UNTIL(count > LENGTH(numberList)) Line 5: { Line 6: IF(numberList[count] < numberList[count - 1]) Line 7: { Line 8: RETURN(true) Line 9: } Line 10: count ← count + 1 Line 11: } Line 12: RETURN(false) Line 13: } Which of the following changes is needed for the program to work as intended? A In line 3, 2 should be changed to 1. B In line 6, < should be changed to ≥. C Line 8 and 12 should be interchanged. D Lines 10 and 11 should be interchanged.

C Line 8 and 12 should be interchanged.

Which of the following best describes a direct benefit in using redundant routing on the Internet? A Redundancy enables messages to be transmitted with as few packets as possible. B Redundancy enables network devices to communicate with as few network connections as possible. C Redundancy often allows messages to be sent on the network even if some network devices or connections have failed. D Redundancy prevents network communications from being intercepted by unauthorized individuals.

C Redundancy often allows messages to be sent on the network even if some network devices or connections have failed.

A local router is configured to limit the bandwidth of guest users connecting to the Internet. Which of the following best explains the result of this configuration as compared to a configuration in which the router does not limit the bandwidth? A The amount of time it takes guest users to send and receive large files is likely to decrease. B The number of packets required for guest users to send and receive data is likely to decrease. C Guest users will be prevented from having fault-tolerant routing on the Internet. D Guest users will be restricted in the maximum amount of data that they can receive per second.

D Guest users will be restricted in the maximum amount of data that they can receive per second.

Which of the following best explains how devices and information can be susceptible to unauthorized access in weak passwords are used? A Un authorized individuals can deny services to a computing system by overwhelming the system with login attempts. B Unauthorized individuals can exploit vulnerabilities in compression algorithms to determine a user's password from their decompressed data. C Unauthorized individuals can exploit vulnerabilities in encryption algorithms to determine a user's password from their encryption key. D Unauthorized individuals can use data mining and other techniques to guess a user's password.

D Unauthorized individuals can use data mining and other techniques to guess a user's password.

A flowchart provides a way to visually represent an algorithm and uses the following building blocks. BlockExplanationOvalThe start or end of the algorithmRectangleOne or more processing steps, such as a statement that assigns a value to a variableDiamondA conditional or decision step, where execution proceeds to the side labeled true if the condition is true and to the side labeled false otherwiseParallelogramDisplays a message In the flowchart below, assume that j and k are assigned integer values. Which of the following initial values of j and k will cause the algorithm represented in the flowchart to result in an infinite loop? A j = -5, k = 5 B j = 0, k = 5 C j = 5, k = 0 D j = 5, k = -5

D j = 5, k = -5


Related study sets

Chapter 7 - Prioritization, Delegation, and Assignment

View Set

Óxidos - Nomenclatura Tradicional

View Set

FBLA Banking and Financial Systems

View Set

Géométrie analytique - définitions et formules

View Set