P1 & P2 Quiz 10.4.19

Ace your homework & exams now with Quizwiz!

The figure below represents a network of physically linked computers labeled A through G. A line between two computers indicates that the computers can communicate directly with each other. Any information sent between two computers that are not directly connected must go through at least one other computer. For example, information can be sent directly between computers A and B, but information sent between computers A and C must go through other computers. A diagram of a network is shown. The letters A through G are shown, each in a circle. A is in the lower left. B is to the right of A, and connected to it by a straight line. C is to the right and up from B, and connected to it by a straight line. D is to the right and up from C, and it is connected to C by a straight line and to B by a curved line that goes around C from below. E is to the left and down from D, directly above B. E is connected to D, C, and A by straight lines. F is to the right of E, above and to the left of A. F is connected to E and A by straight lines. G is to the right and up from F, directly above A and to the left of D. G is connected to F and D by straight lines. Which of the following statements about security in the network is true? Computers A and D need to communicate with at least two additional computers in the network in order to communicate with each other. Computers B and C can communicate with each other without additional computers being aware of the communication.

II only

e 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. text... Which of the following best describes the contents of resultList after the code segment is executed?

Only elements that appear in both inputList1 and inputList2

A city government is attempting to reduce the digital divide between groups with differing access to computing and the Internet. Which of the following activities is LEAST likely to be effective in this purpose?

Putting all government forms on the city Web site

Which of the following activities poses the greatest personal cybersecurity risk?

Reserving a hotel room by e-mailing a credit card number to a hotel

An algorithm has been developed to compute the sum of all the elements in a list of integers. Which of the following programming structures must be added to the existing algorithm so that the new algorithm computes the sum of only the even integers in the list?

Selection

Historically, it has been observed that computer processing speeds tend to double every two years. Which of the following best describes how technology companies can use this observation for planning purposes?

Technology companies can set research and development goals based on anticipated processing speeds.

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

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.

nsider the following program, which is intended to display the number of times a number target appears in a list. A segment of code is shown. At the top is a white box that reads count left arrow 1. This is at the top left corner of a larger grey box, at the top of which it reads FOR EACH n IN list. Below this in the grey box and indented is another grey box with a white border that reads IF, then n equals target, which is encircled. Below this in the smaller grey box is a white box, in which it reads count left arrow count plus 1. Below the larger grey box at its lower left corner is a white box that reads DISPLAY, then count, which is in a rectangle. Which of the following best describes the behavior of the program?

The program correctly displays the number of times target appears in the list.

Which of the following statements is true?

There exist problems that no algorithm will ever be able to solve for all possible inputs. Answer A

A certain social media Web site allows users to post messages and to comment on other messages that have been posted. When a user posts a message, the message itself is considered data. In addition to the data, the site stores the following metadata. The time the message was posted The name of the user who posted the message The names of any users who comment on the message and the times the comments were made For which of the following goals would it be more useful to analyze the data instead of the metadata?

To determine the topics that many users are posting about

Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?

When the problem cannot be solved in a reasonable time and an approximate solution is acceptable

retailer that sells footwear maintains a single database containing records with the following information about each item for sale in the retailer's store. Item identification number Footwear type (sneakers, boots, sandals, etc.) Selling price (in dollars) Size Color Quantity available Using only the database, which of the following can be determined?

Which items listed in the database are not currently in the store

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

head_counter = 2

Consider the following code segment. A segment of code is shown. At the top is a white box that reads j left arrow 1. This is at the top left corner of a larger grey box, at the top of which it reads REPEAT UNTIL, the left angle bracket MISSING CONDITION right angle bracket, which is encircled. Below this in the grey box and indented is a white box that reads j left arrow j plus 2. Which of the following replacements for <MISSING CONDITION> will result in an infinite loop?

j = 6

The code fragment below is intended to display "odd" if the positive number num is odd. A segment of code is shown in a grey box. At the top it reads IF, then open angle bracket MISSING CONDITION close angle bracket, which is encircled. Below this and indented is a white box that reads DISPLAY, then "odd", which is in a rectangle. Which of the following can be used to replace <MISSING CONDITION> so that the code fragment will work as intended?

(num MOD 2) = 1

What is displayed as a result of executing the algorithm in the flowchart?

15

Which of the following programs is most likely to benefit from the use of a heuristic?

A program that finds the shortest driving route between two locations on a map

Which of the following best describes a Distributed Denial of Service (DDoS) attack? A

An attempt to deny users access to a Web site's resources by flooding the Web site with requests from multiple systems

Which of the following is LEAST likely to indicate a phishing attack?

An e-mail from your bank asks you to call the number on your card to verify a transaction

Consider the code segment below. The code consists of seven lines. Some of the lines of code are indented. Begin block Line one: IF, begin block, on Time closed up with initial capital T, end block. Line two is indented one tab: begin block, DISPLAY, begin block open quote, Hello period, close quote, end block, end block. Line three: ELSE Begin block Line four is indented one tab: IF, begin block absent end block. Line five is indented two tabs: begin block, DISPLAY, begin block open quote, Is anyone there, question mark, close quote, end block, end block. Line six is indented one tab: ELSE Line seven is indented two tabs: begin block, DISPLAY, begin block open quote, Better late than never, period, close quote, end block, end block. End block. End block. If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment?

Better late than never.

The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the bottom-left square of the grid and facing toward the top of the grid. A five by five square grid is shown with a triangle pointing up in the square in the lower left corner, in the first column and fifth row. Code for the procedure Mystery is shown below. Assume that the parameter p has been assigned a positive integer value (e.g., 1, 2, 3, ...). A segment of code is shown in a grey box. In the upper left of the box it reads PROCEDURE Mystery, the p, which is written in a square. Below this and indented is a smaller grey box that has a white border. In the upper left of this smaller grey box it reads REPEAT p times. Below this an indented is a white box, in which there are three smaller white boxes in a column. The top box reads MOVE_FORWARD, the middle box reads MOVE_FORWARD, and the bottom box reads ROTATE_RIGHT. Which of the following shows a possible result of calling the procedure?

Choice A is a five by five square grid with a triangle in one of the squares. In choice A, the triangle is pointing to the left and is in the third column and fifth row.

A programmer completes the user manual for a video game she has developed and realizes she has reversed the roles of goats and sheep throughout the text. Consider the programmer's goal of changing all occurrences of "goats" to "sheep" and all occurrences of "sheep" to "goats." The programmer will use the fact that the word "foxes" does not appear anywhere in the original text. Which of the following algorithms can be used to accomplish the programmer's goal?

First, change all occurrences of "goats" to "foxes." Then, change all occurrences of "sheep" to "goats." Last, change all occurrences of "foxes" to "sheep."

Which of the following are true statements about digital certificates in Web browsers? Digital certificates are used to verify the ownership of encrypted keys used in secured communication. Digital certificates are used to verify that the connection to a Web site is fault tolerant.

I only

wo lists, list1 and list2, contain the names of books found in two different collections. A librarian wants to create newList, which will contain the names of all books found in either list, in alphabetical order, with duplicate entries removed. For example, if list1 contains ["Macbeth", "Frankenstein", "Jane Eyre"] and list2 contains ["Frankenstein", "Dracula", "Macbeth", "Hamlet"], then newList will contain ["Dracula", "Frankenstein", "Hamlet", "Jane Eyre", "Macbeth"]. The following procedures are available to create newList. A table is shown with two columns, Procedure on the left and Explanation on the right. The first row reads Sort open parentheses list close parentheses, and Sorts list in alphabetical order and returns the resulting list. The second row reads Combine open parentheses list1, list2 close parentheses, and Creates a new list consisting of the entries from list1 followed by the entries from list2. The resulting list is returned. The third row reads RemoveDuplicates open parentheses list close parentheses, and Iterates through list. If any two or more entries have the same value, the duplicate entries are removed so that any entry appears at most once. The resulting list is returned. Which of the following code segments will correctly create newList ?

newList ← Combine (list1, list2) newList ← Sort (newList) newList ← RemoveDuplicates (newList)

Central High School keeps a database of information about each student, including the numeric variables numberOfAbsences and gradePointAverage. The expression below is used to determine whether a student is eligible to receive an academic award. (numberOfAbsences ≤ 5) AND (gradePointAverage > 3.5) Which of the following pairs of values indicates that a student is eligible to receive an academic award?

numberOfAbsences = 5, gradePointAverage = 3.8


Related study sets

PADI, Open Water Diver, Final Exam Review

View Set

Psalm 117 - Flashcard MC questions - Ted Hildebrandt

View Set

Milady chapter 10 skin physiology and histology

View Set

Instrumentation: Measurement System

View Set

Legal environment of business chapter 1

View Set

Fundamentals Final Exam Practice FINAL

View Set