Mock Exam - April 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

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? A len ←\leftarrow← LENGTH (utensils) temp ←\leftarrow← utensils [len] REMOVE (utensils, len) APPEND (utensils, temp) B len ←\leftarrow← LENGTH (utensils) REMOVE (utensils, len) temp ←\leftarrow← utensils [len] APPEND (utensils, temp) C len ←\leftarrow← LENGTH (utensils) temp ←\leftarrow← utensils [len] REMOVE (utensils, len) INSERT (utensils, 1, temp) D len ←\leftarrow← LENGTH (utensils) REMOVE (utensils, len) temp ←\leftarrow← utensils [len] INSERT (utensils, 1, temp)

A len ←\leftarrow← LENGTH (utensils) temp ←\leftarrow← utensils [len] REMOVE (utensils, len) APPEND (utensils, temp)

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 (NOT input1) OR (NOT input2) D NOT (input1 AND input2)

To be eligible for a particular ride at an amusement park, a person must be at least 12 years old and must be between 50 and 80 inches tall, inclusive. Let age represent a person's age, in years, and let height represent the person's height, in inches. Which of the following expressions evaluates to true if only if the person is eligible for the ride? A (age ≥\ge≥ 12) AND ((height ≥\ge≥ 50) AND (height ≤\le≤ 80)) B (age ≥\ge≥ 12) AND ((height ≤\le≤ 50) AND (height ≥\ge≥ 80)) C (age ≥\ge≥ 12) AND ((height ≤\le≤ 50) OR (height ≥\ge≥ 80)) D (age ≥\ge≥ 12) OR ((height ≥\ge≥ 50) AND (height ≤\le≤ 80))

A (age ≥\ge≥ 12) AND ((height ≥\ge≥ 50) AND (height ≤\le≤ 80))

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

A Spreadsheets I and II

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 Symmetric encryption uses a single key that should be kept secret. The same key is used for both encryption and decryption of data.

The following code segment is intended to remove all duplicate elements in the list myList. The procedure does not work as intended. j \leftarrow← 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. 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]

A [10, 10, 20, 20, 10, 10] C [30, 50, 40, 10, 20, 40]

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

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

B Line 8 C Line 10

Which of the following statements about the Internet is true? A The Internet is a computer network that uses proprietary communication protocols. B The Internet is designed to scale to support an increasing number of users. C The Internet requires all communications to use encryption protocols. D The Internet uses a centralized system to demine how packets are routed.

B The Internet is designed to scale to support an increasing number of users.

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.

A city maintains a database of all traffic tickets that were issued over the past ten years. The tickets are divided into the following two categories. Moving violations Nonmoving violation The data recorded for each ticket include only the following information. The month and year in which the ticket was issued The category of the ticket Which of the following questions CANNOT be answered using only the information in the database? A Have the total number of traffic tickets per year increased each year over the past ten years? B In the past ten years, were nonmoving violations more likely to occur on a weekend than on a weekday? C In the past ten years, were there any months when moving violations occurred more often than nonmoving violations? D In how many of the past ten years were there more than one million moving violations?

B-In the past ten years, were nonmoving violations more likely to occur on a weekend than on a weekday?

Which of the following is NOT a benefit of collaborating to develop a computing innovation? A Collaboration can decrease the size and complexity of tasks required of individual team members. B Collaboration can make it easier to find and correct errors during the development process. C Collaboration eliminates the need to resolve differences of opinion. D Collaboration facilitates multiple perspectives in developing ideas.

C Collaboration eliminates the need to resolve differences of opinion.

In which of the following situations would it be most appropriate to choose lossy compression over lossless compression? A Storing digital photographs to be printed and displayed in a large format in an art gallery. B Storing a formatted text document to be restored to its original version for a print publication. C Storing music files on a smartphone in order to maximize the number of songs that can be stored D Storing a video file on an external device in order to preserve the highest possible video quality.

C Storing music files on a smartphone in order to maximize the number of songs that can be stored

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: } A-In line 3, 2 should be changed to 1. B-In line 6, < \lt< should be changed to ≥\ge≥ . C-Line 8 and 12 should be interchanged. D-lines 10 and 11 should be interchanged.

C-Line 8 and 12 should be interchanged.

A large spreadsheet contains the following information about local restaurants. A sample portion of the spreadsheet is shown below. ARestaurant Name BPrice Range CNumber of Customer Ratings DAverage Customer Rating EAccepts Credit Cards 1 Joey Calzone's Pizzeria lo 182 3.5 false 2 78th Street Bistro med 41 4.5 false 3 Seaside Taqueria med 214 4.5 true 4 Delicious Sub Shop II lo 202 4.0 false 5 Rustic Farm Tavern hi 116 4.5 true 6 ABC Downtown Diner med 0 -1.0 true In column B, the price range represents the typical cost of a meal, where "lo" indicates under $10, "med" indicates $11 to $30, and "hi" indicates over $30. In column D, the average customer rating is set to -1.0 for restaurants that have no customer ratings. A student is developing an algorithm to determine which of the restaurants that accept credit cards has the greatest average customer rating. Restaurants that have not yet received any customer ratings and restaurants that do not accept credit card are to be ignored. Once the algorithm is complete, the desired restaurant will appear in the first row of the spreadsheet. If there are multiple entries that fit the desired criteria, it does not matter which of them appears in the first row. The student has the following actions available but is not sure of the order in which they should be executed. Action Explanation Filter by number of ratings Remove entries for restaurants with no customer ratings Filter by payment type Remove entries for restaurants that do not accept credit cards Sort by rating Sort the rows in the spreadsheet on column D from greatest to least 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 restaurant? Filter by number of ratings, then filter by payment type, then sort by rating Filter by number of ratings, then sort by rating, then filter by payment type Sort by rating, then filter by number of ratings, then filter by payment type A 1 and 2 only B 1 and 3 only C 2 and 3 only D 1, 2, and 3

D 1, 2, and 3

Which of the following best explains the relationship between the Internet and the World Wide Web? A Both the Internet and the World Wide Web refer to the same interconnected network of devices. B The Internet is an interconnected network of data servers, and the World Wide Web is a network of user devices that communicates with the data servers. C The Internet is a local network of interconnected devices, and the World Wide Web is a global network that connects the local networks with each other. D The Internet is a network of interconnected networks, and the World Wide Web is a system of linked pages, programs, and files that are accessed via the Internet.

D The Internet is a network of interconnected networks, and the World Wide Web is a system of linked pages, programs, and files that are accessed via the Internet.

In the following procedure, the parameter n is an integer greater than 2. Which of the following best describes the value returned by the procedure? A The procedure returns nothing because it will not terminate. B The procedure returns the value of 2 * n. C The procedure returns the value of n * n D The procedure returns the sum of the integers from 1 to n.

D The procedure returns the sum of the integers from 1 to n.

Which of the following best explains the ability to solve problems algorithmically? A Any problem can be solved algorithmically, through 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, through 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.

D There exist some problems that cannot be solved algorithmically using any computer.

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


Ensembles d'études connexes

A Good Man is Hard to Find - Flannery O'Connor

View Set

Chapter 5: Biomes and Biodiversity

View Set

Law of Commercial Transactions Midterm

View Set

Econ 2: Chapter 16 Inflation, Disinflation, Deinflation

View Set