P1 & P2 Review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Digital Certificates

Technique used to authenticate remote users, such as online shopping businesses.

Boolean variables.

True or False

Heuristic Approach

Uses know-how and experience to make informed guesses to find a tractable solution

Heuristic

a simple thinking strategy that often allows us to make judgments and solve problems efficiently; usually speedier but also more error-prone than algorithms

Physically linked

genes that are on the same chromosome as one another

otherwise

in a different way or in all ways except the one mentioned

Which of the following is LEAST likely to indicate a phishing attack? A An e-mail from your bank asks you to call the number on your card to verify a transaction B An e-mail from a merchant asks that you click on a link to reset your password C An e-mail from a utility company asks you to enter your date of birth and social security number for verification purposes D An e-mail indicates that you have won a large sum of money and asks you to enter your bank account number so that the money can be transferred to you

A An e-mail from your bank asks you to call the number on your card to verify a transaction - Emails that request the user to click on an unknown link, as well as requests to share password information, are indicative of a phishing attack.

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? A 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. B Choice B is a five by five square grid with a triangle in one of the squares. In choice B, the triangle pointing down and is in the fourth column and second row. C Choice C is a five by five square grid with a triangle in one of the squares. In choice C, the triangle is pointing down and in the first column and fifth row. D Choice D is a five by five square grid with a triangle in one of the squares. In choice D, the triangle is pointing up and is in the center square, in the third column and third row.

A 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. - The robot moves in repeated segments of two MOVE_FORWARD and one ROTATE_RIGHT. After three of these segments, the robot would end up in the position shown by this response.

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. A I only B II only C I and II D Neither I nor II

A I only

Consider 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? A The program correctly displays the number of times target appears in the list. B The program does not work as intended when target does not appear in the list. C The program does not work as intended when target appears in the list more than once. D The program does not work as intended when target appears as the last element of the list.

A The program correctly displays the number of times target appears in the list. - This option is correct. The variable count is initially set to 0 and is incremented only when the current item in the list (represented by the variable n) equals the value of the variable target.

A 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? A Which items listed in the database are not currently in the store B Which colors are more popular among men than women C Which type of footwear is most popular among adults D The total number of shoes sold in a particular month

A Which items listed in the database are not currently in the store - The database does not store information about individual sales, nor does it store information about gender. Related Content & Skills Big Idea BI 3 EK 3.2.1.B EU 3.2 LO 3.2.1 Computational Thinking Practices P1

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? A j = 6 B j ≥ 6 C j = 7 D j > 7

A j = 6 - The value of the variable j starts at 1 and increases by 2. If <MISSING CONDITION> is replaced with the expression j ≥ 6, the expression will evaluate to true when j is 7 and the loop will end.

Two 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 ? A newList ← Combine (list1, list2) newList ← Sort (newList) newList ← RemoveDuplicates (newList) B list1 ← Sort (list1) list2 ← Sort (list2) newList ← Combine (list1, list2) newList ← RemoveDuplicates (newList) C list1 ← RemoveDuplicates (list1) list2 ← RemoveDuplicates (list2) newList ← Combine (list1, list2) newList ← Sort (newList) D list1 ← RemoveDuplicates (list1) list1 ← Sort (list1) list2 ← RemoveDuplicates (list2) list2 ← Sort (list2) newList ← Combine (list1, list2)

A newList ← Combine (list1, list2) newList ← Sort (newList) newList ← RemoveDuplicates (newList) If each list is sorted separately and then combined, the combined list will not necessarily be sorted. Related Content & Skills Big Idea BI 4 EK 4.1.1.A EK 4.1.1.B EU 4.1 LO 4.1.1 Computational Thinking Practices

index

A group of similar stocks and bonds

Algorithm

A methodical, logical rule or procedure that guarantees solving a particular problem.

A flowchart is a way to visually represent an algorithm. The flowchart below uses the following building blocks. A table is shown with two columns titled Block and Explanation. In the first row it reads oval then a picture of an oval in the left column, and The start or end of the algorithm in the right column. In the second row it reads rectangle then a picture of a rectangle in the left column, and One or more processing steps, such as a statement that assigns a value to a variable in the right column. In the third row it reads Diamond then a picture of a diamond in the left column, and A conditional or decision step, where execution proceeds to the side labeled true if the condition is true and to the side labeled false otherwise in the right column. In the fourth row it reads parallelogram and a picture of a parallelogram in the left column, and Displays a message in the right column. A flowchart of an algorithm is shown. At the top is an oval with the word Start in it. An arrow points down from Start to a rectangle in which it reads count left arrow 1. An arrow points down from this rectangle to the top of a diamond in which it reads count less than 5. An arrow points down from the count less than 5 diamond to a rectangle in which it reads count left arrow count plus 1, and the word true is written next to the arrow pointing down to this rectangle. An arrow points down from the bottom of this last rectangle, and the arrow turns to the left then up then right until it meets the left side of the count less than 5 diamond. An arrow points to the right from the right corner of the count less than 5 diamond to a parallelogram in which it reads Display open parentheses count close parentheses, and the word false is written next to the arrow pointing to this parallelogram. Another arrow points down from the bottom of this parallelogram to an oval in which it reads End. What is displayed as a result of executing the algorithm in the flowchart? A 5 B 15 C 1 2 3 4 D 1 2 3 4 5

A. 5 - The value of count starts at 1 and increases by 1. When the value of count reaches 5, the loop terminates and the value of count is displayed.

Distributed Denial of Service (DDoS)

An attack that uses many computers to perform a DoS attack.

procedure

An established or official way of doing something

Which of the following best describes a Distributed Denial of Service (DDoS) attack? A An attempt by a country to deny its citizens access to the Internet B An attempt to deny users access to a Web site's resources by flooding the Web site with requests from multiple systems C An attempt by one user to deny service to another user by posting material on a social network D An attempt by a user of the Internet to get private information from a secure database

B An attempt to deny users access to a Web site's resources by flooding the Web site with requests from multiple systems - This option is correct. DDoS attacks compromise a target by flooding it with requests from multiple systems.

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? A Is anyone there? B Better late than never. C Hello. Is anyone there? D Hello. Better late than never.

B Better late than never.

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. A I only B II only C I and II D Neither I nor II

B II only - This option is correct. Statement I is false because computers A and D can communicate with each other through one computer, E. Statement II is true because there is a direct link between computers B and C.

The code segment below uses the procedure IsFound (list, item), which returns true if item appears in list and returns false otherwise. The list resultList is initially empty. text... Which of the following best describes the contents of resultList after the code segment is executed? A All elements in inputList1 followed by all elements in inputList2 B Only elements that appear in both inputList1 and inputList2 C Only elements that appear in either inputList1 or inputList2 but not in both lists D Only elements that appear in inputList1 but not in inputList2

B Only elements that appear in both inputList1 and inputList2 - This option is correct. Each item in inputList1 is checked to see if it appears in inputList2. If the item appears in inputList2, the item is appended to resultList. Since resultList is initially empty, at the end of the FOR EACH loop resultList will contain precisely the elements that appear in both initial lists.

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? A The game's running speed can only be improved if the game is played between two human players instead of with the computer-controlled player. B The game's running speed might be improved by using a process that finds approximate solutions every time the computer-controlled player has a turn. C The game's running speed cannot be improved because computers can only be programmed to find the best possible solution. D The game's running speed cannot be improved because the game is an example of an algorithm that does not run in a reasonable time.

B The game's running speed might be improved by using a process that finds approximate solutions every time the computer-controlled player has a turn. - This option is correct. Selecting the best move is an optimization problem that cannot be solved in a reasonable time based on the information that the game runs slowly. If the algorithm for selecting the best move is running too slowly, the game may run more quickly if a heuristic is used to find approximate solutions.

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? A numberOfAbsences = 3, gradePointAverage = 3.5 B numberOfAbsences = 5, gradePointAverage = 3.8 C numberOfAbsences = 6, gradePointAverage = 3.4 D numberOfAbsences = 6, gradePointAverage = 3.6

B numberOfAbsences = 5, gradePointAverage = 3.8 - An AND expression evaluates to true only if both conditions are true. Both the first condition and the second condition evaluate to false.

Which of the following programs is most likely to benefit from the use of a heuristic? A A program that calculates a student's grade based on the student's quiz and homework scores B A program that encrypts a folder of digital files C A program that finds the shortest driving route between two locations on a map D A program that sorts a list of numbers in order from least to greatest

C A program that finds the shortest driving route between two locations on a map - This option is correct. Finding the shortest driving route is an optimization problem that cannot be solved in a reasonable time, and a heuristic is a technique that can find an approximate solution more quickly when exact methods are too slow.

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? A First, change all occurrences of "goats" to "sheep." Then, change all occurrences of "sheep" to "goats." B First, change all occurrences of "goats" to "sheep." Then, change all occurrences of "sheep" to "goats." Last, change all occurrences of "foxes" to "sheep." C First, change all occurrences of "goats" to "foxes." Then, change all occurrences of "sheep" to "goats." Last, change all occurrences of "foxes" to "sheep." D First, change all occurrences of "goats" to "foxes." Then, change all occurrences of "foxes" to "sheep." Last, change all occurrences of "sheep" to "goats."

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

When a cellular telephone user places a call, the carrier transmits the caller's voice as well as the voice of the person who is called. The encoded voices are the data of the call. In addition to transmitting the data, the carrier also stores metadata. The metadata of the call includes information such as the time the call is placed and the phone numbers of both participants. For which of the following goals would it be more useful to computationally analyze the metadata instead of the data? I.) To determine if a caller frequently uses a specific word II.) To estimate the number of phone calls that will be placed next Monday between 10:30 A.M. and noon. III.) To generate a list of criminal suspects when given the telephone number of a known criminal A I only B II only C II and III only D I, II, and III

C II and III only

In the program below, the initial value of x is 5 and the initial value of y is 10. text... What is displayed as a result of running the program? A Foxtrot B Hotel C November D Yankee

C November - This option is correct. Since variable x stores the value 5, the expression x < 0 evaluates to false and the code in the first ELSE statement is executed. Since the variable y stores the value 10, the expression x > y evaluates to false, and the code in the next ELSE statement is executed. Since the expression y > 0 evaluates to true, the statement DISPLAY("November") is executed.

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? A Holding basic computer classes at community centers B Providing free wireless Internet connections at locations in low-income neighborhoods C Putting all government forms on the city Web site D Requiring that every city school has computers that meet a minimum hardware and software standard

C Putting all government forms on the city Web site - This option is correct. Putting all government forms on the city website is least likely to be effective in reducing the digital divide because all citizens may not have equitable access to the Internet.

Which of the following activities poses the greatest personal cybersecurity risk? A Making a purchase at an online store that uses public key encryption to transmit credit card information B Paying a bill using a secure electronic payment system C Reserving a hotel room by e-mailing a credit card number to a hotel D Withdrawing money from a bank account using an automated teller machine (ATM)

C Reserving a hotel room by e-mailing a credit card number to a hotel - Public key encryption is widely used because of the functionality it provides in addressing cybersecurity issues when sending information across the Internet.

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? A Iteration B Searching C Selection D Sequencing

C Selection - Searching is not a basic program structure but rather an algorithm that uses programming structures such as sequence, selection, and iteration.

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? A Technology companies can accurately predict the dates when new computing innovations will be available to use. B Technology companies can plan to double the costs of new products each time advances in processing speed occur. C Technology companies can set research and development goals based on anticipated processing speeds. D Technology companies can spend less effort developing new processors because processing speed will always improve at the observed rate.

C Technology companies can set research and development goals based on anticipated processing speeds. - This option is correct. If it is assumed that computer processing speeds will double every two years, then companies can design new products with this assumption.

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? A To determine the users who post messages most frequently B To determine the time of day that the site is most active C To determine the topics that many users are posting about D To determine which posts from a particular user have received the greatest number of comments

C To determine the topics that many users are posting about - Answer C This option is incorrect. Some problems cannot be solved with an algorithm for all possible inputs.

Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem? A When the problem can be solved in a reasonable time and an approximate solution is acceptable B When the problem can be solved in a reasonable time and an exact solution is needed C When the problem cannot be solved in a reasonable time and an approximate solution is acceptable D When the problem cannot be solved in a reasonable time and an exact solution is needed

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

An author is considering publishing an e-book using a Creative Commons license. In which of the following situations would it be better for the author to use a Creative Commons license instead of traditional copyright? I. The author wants to make the e-book available as a free download. II. The author wants to prevent people from sharing copies of the e-book on peer-to-peer networks. III. The author wants to allow people permission to use and modify the e-book.

C. I and III because of statement III is also correct because under Creative Commons the author can stipulate what kind of modification is allowed by users.

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? A (num MOD 1) = 0 B (num MOD 1) = 1 C (num MOD 2) = 0 D (num MOD 2) = 1

D (num MOD 2) = 1 - The expression (num MOD 1) is equivalent to 0, since any number divided by 1 is itself, with a remainder of 0. This code fragment will never display "odd" no matter what the value of num is.

Which of the following statements is true? A Every problem can be solved with an algorithm for all possible inputs, in a reasonable amount of time, using a modern computer. B Every problem can be solved with an algorithm for all possible inputs, but some will take more than 100 years, even with the fastest possible computer. C Every problem can be solved with an algorithm for all possible inputs, but some of these algorithms have not been discovered yet. D There exist problems that no algorithm will ever be able to solve for all possible inputs.

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

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? A coin_flip = 1 B flip_counter = 1 C flip_counter = 2 D head_counter = 2

D head_counter = 2 - This option is incorrect. In the simulation, the variable flip_counter represents the number of times a coin was flipped. When flip_counter equals 1, only one coin has been flipped. This information does not lead to knowledge about the result of the simulation. Related Content & Skills Big Idea BI 4 EK 4.1.1.B EK 4.1.1.D EU 4.1 LO 2.3.1 LO 4.1.1 Computational Thinking Practices P2 - Creating Computational Artifacts

potential

possible, able to happen; something that can develop or become a reality

Evaluates

to judge or determine the significance, worth, or quality of; assess


Kaugnay na mga set ng pag-aaral

BIO 345 Evolution Prof Maley & Sterner: Exam 1

View Set

POLS 2305-25: Ch. 9: Political Parties

View Set

React Native Interview Questions

View Set