Computer Science

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

63 The transmission control protocol (TCP) and Internet protocol (IP) are used in Internet communication. Which of the following best describes the purpose of these protocols?

(C) To establish a common standard for sending messages between devices on the Internet

Which of the following is NOT an advantage of using open-source software?

The original developer of open-source software provides free or low-cost support for users installing and running the software.

Consider the following procedure. Procedure Call Explanation DrawLine (x1, y1, x2, y2) Draws a line segment on a coordinate grid with endpoints at coordinates (x1, y1) and (x2, y2) The DrawLine procedure is to be used to draw the following figure on a coordinate grid.

(A) DrawLine (startX, startY, endX, endY) endY ← endY - 2

In configuration I, what is the minimum number of connections that must be broken or removed before device T can no longer communicate with device U?

(B) Two

Let an original file name be stored in the string variable original. Which of the following statements will correctly extract the description and store it in the string variable descr ? I. descr ← TrimLeft (TrimRight (original, 4), 11) II. descr ← TrimLeft (TrimRight (original, 11), 4) III. descr ← TrimRight (TrimLeft (original, 11), 4)

(C) I and III

Assume that the list of numbers nums has more than 10 elements. The program below is intended to compute and display the sum of the first 10 elements of nums. Line 1: i ← 1 Line 2: sum ← 0 Line 3: REPEAT UNTIL (i > 10) Line 4: { Line 5: i ← i+1 Line 6: sum ← sum + nums[i] Line 7: } Line 8: DISPLAY (sum)

(C) Lines 5 and 6 should be interchanged.

The procedure NumOccurrences is intended to count and return the number of times targetWord appears in the list wordList. The procedure does not work as intended. For which of the following code segments will the call to NumOccurrences NOT return the intended value?

treeList <---- "Birch, Maple, Birch" NumOccurences TreeList, "Birch" TreeList <---- "Birch, maple, Oak" NumOccurences treelist , "Maple"

Which of the following actions are likely to be helpful in reducing the digital divide?

(B) Designing new technologies to be accessible to individuals with different physical abilities (D) Having world governments support the construction of network infrastructure

Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer. I. An algorithm that accesses each element in the list twice II. An algorithm that accesses each element in the list n times III. An algorithm that accesses only the first 10 elements in the list, regardless of the size of the list Which of the algorithms run in reasonable time?

(D) I, II, and III Correct. For an algorithm to run in reasonable time, it must take a number of steps less than or equal to a polynomial function. Algorithm I accesses elements 2n times (twice for each of n elements), which is considered reasonable time. Algorithm II accesses n2 elements (n times for each of n elements), which is considered reasonable time. Algorithm III accesses 10 elements, which is considered reasonable time.

The following question uses a robot in a grid of squares. The robot is represented by a triangle, which is initially facing toward the top of the grid.

Bot Mover 1. 3. 0 Correct. In this code segment, the first call to BotMover moves the robot forward one square, rotates it right one time so that it faces right, and moves it forward one square. The second call to BotMover moves the robot forward one square, rotates it right 3 times so that it faces toward the top of the grid, then moves it forward one square. The third call to BotMover moves the robot forward one square, does not rotate it, then moves it forward to the gray square.

The figure below shows two possible network configurations for devices P through V. A line between two devices indicates a connection. Devices can communicate only through the connections shown. In which of the configurations is it possible to have redundant routing between devices Q and V?

Both configuration I and configuration II

The following algorithm is intended to determine the average height, in centimeters, of a group of people in a room. Each person has a card, a pencil, and an eraser. Step 2 of the algorithm is missing. Step 1: All people stand up. Step 2: (missing step) Step 3: Each standing person finds another standing person and they form a pair. If a person cannot find an unpaired standing person, that person remains standing and waits until the next opportunity to form pairs. Step 4: In each pair, one person hands their card to the other person and sits down. Step 5: At this point, the standing person in each pair is holding two cards.

Step 2: Each person writes their height, in centimeters, at the top of the card and writes the number 1 at the bottom of the card.

Consider a game in which a player flips a fair coin three times. If all three coin flips have the same result (either all heads or all tails) the player wins. Otherwise, the player loses. Which of the following code segments best simulates the behavior of the game?

Sum <-- 0 Repeat three times sum<---- sum + random [0,1 ] if { sum=3 } OR { sum=0 } display ["You Win"] Else display ["You Lose"]

Which of the following are examples of DDoS attacks?

(A) A coordinated group of devices sends thousands of simultaneous requests to an online store in an attempt to make it difficult for customers to complete their purchases. (C) A hacking group, using thousands of bots, sends an overwhelming number of payment requests to a donation site in an attempt to disrupt services over a dispute about how customers' donations are being handled.

Which of the following best explains how IP addresses are assigned?

(A) As a new device is connected to the Internet, it is assigned an IP address to enable communication on the network.

A bookstore has a database containing information about each book for sale in the store. A sample portion of the database is shown below.

(A) Author (B) Title

A program contains the following procedures for string manipulation.

(B) animal ← Substring ("antelope", 5, 4) animal ← Concat ("a", animal) animal ← Concat (Substring ("jackrabbit", 1, 4), animal) (C) animal ← Substring ("jackrabbit", 1, 4) animal ← Concat (animal, "a") animal ← Concat (animal, Substring ("antelope", 5, 4))

An office uses an application to assign work to its staff members. The application uses a binary sequence to represent each of 100 staff members. What is the minimum number of bits needed to assign a unique bit sequence to each staff member?

(C) 7

Which of the following scenarios best exemplifies a phishing attack?

(C) A user receives an e-mail from a sender offering technical help with the user's computer. The e-mail prompts the user to start a help session by clicking a provided link and entering the username and password associated with the user's computer.

A system is being developed to help pet owners locate lost pets. Which of the following best describes a system that uses crowdsourcing?

A mobile application that allows users to report the location of a pet that appears to be lost and upload a photo that is made available to other users of the application

Assume that the Boolean variable x is assigned the value true and the Boolean variable y is assigned the value false. Which of the following will display the value true ?

If X Display [x or y] If X or Y Display [x]

The following procedure is intended to return the value of x times y, where x and y are integers. Multiplication is implemented using repeated additions.

Multiply 2, -5 Multiply -2,-5

Which of the following best describes the impact of Creative Commons?

(A) Creative Commons gives creators of digital content the ability to indicate how their works can be legally used and distributed, enabling broad access to digital information.

An administrator at the school has data about hundreds of students in a particular course. While the administrator does not know the values of each student's individual assignment scores, the administrator does have the following information for each student. • The student name • A unique student ID number • The number of assignments for the course • The average assignment score before the lowest score was dropped • The course grade after the lowest score was dropped Which of the following CANNOT be determined from this data alone?

(A) For a given student, the value of the highest assignment score Correct. Without knowing the individual assignment scores, the administrator is unable to determine any of the student's individual scores other than the lowest score.

Which of the following best describes the purpose of the domain name system (DNS)

(A) To allow users to refer to Web sites using names (such as example.com) rather than IP addresses (such as 156.33.241.5)

The following code segment is intended to copy all even numbers from originalList to newList so that the numbers in newList appear in the same relative order as in originalList. The code segment may or may not work as intended. Line 1: FOR EACH number IN originalList Line 2: { Line 3: IF (number MOD 2 = 0) Line 4: { Line 5: INSERT (newList, 1, number) Line 6: } Line 7: }

(C) Changing line 5 to APPEND (newList, number)

A group of planners are using a simulation to examine whether or not a park that they are designing is going to affect foot traffic in the area. The simulation uses a model that includes input variables for the park such as the number of entrances, sidewalks, and bike trails and the square footage of open space (grassy areas). The simulation can then be run multiple times using different values for the input variables to represent different park designs. However, the simulation takes a very long time to run. The planners update the model by removing some variables they consider less important than others. Of the following, which is the most likely effect the updated model will have on the simulation?

The updated model is likely to decrease the runtime of the simulation because the time required for simulations generally depends on the complexity of the model used.

A biologist wrote a program to simulate the population of a sample of bacteria. The program uses the following procedures. hours ← 0 startPop ← InitialPopulation () currentPop ← startPop REPEAT UNTIL ((hours ≥ 24) OR (currentPop ≤ 0)) { currentPop ← NextPopulation (currentPop) hours ← hours + 1 } DISPLAY (currentPop - startPop) Which of the following are true statements about the simulation? I. The simulation continues until either 24 hours pass or the population reaches 0. II. The simulation displays the average change in population per hour over the course of the simulation. III. The simulation displays the total population at the end of the simulation.

(A) I only

Internet protocol version 6 (IPv6) has been introduced to replace the previous version (IPv4). Which of the following best describes a benefit of IPv6 over IPv4

(B) IPv6 allows for a greater number of addresses than IPv4, which allows more devices to be connected to the Internet.

The following procedure is intended to return true if at least two of the three parameters are equal in value and is intended to return false otherwise. PROCEDURE AnyPairs (x, y, z) { IF (x = y) { RETURN (true) } ELSE { RETURN (y = z) } }

(C) AnyPairs ("bat", "cat", "bat")

The GetPrediction procedure takes approximately 1 minute to return a result. All other operations happen nearly instantaneously. Version I topScore ← 0 idList ← [1298702, 1356846, 8848491, 8675309] FOR EACH id IN idList { score ← GetPrediction (id) IF (score > topScore) { topScore ← score } } DISPLAY (topScore) Version II idList ← [1298702, 1356846, 8848491, 8675309] topID ← idList[1] FOR EACH id IN idList { IF (GetPrediction (id) > GetPrediction (topID)) { topID ← id } } DISPLAY (GetPrediction (topID))

(D) Version II requires approximately 5 more minutes to execute than version I.

In mathematics, a perfect number is a type of integer. The procedure IsPerfect (num) returns true if num is a perfect number and returns false otherwise. The following program is intended to count and display the number of perfect numbers between the integers start and end, inclusive. Assume that start is less than end. The program does not work as intended. Line 1: currentNum ← start Line 2: count ← 0 Line 3: REPEAT UNTIL (currentNum > end) Line 4: { Line 5: count ← count + 1 Line 6: IF (IsPerfect (currentNum)) Line 7: { Line 8: count ← count + 1 Line 9: currentNum ← currentNum + 1 Line 10: } Line 11: currentNum ← currentNum + 1 Line 12: } Line 13: DISPLAY (count) Which two lines of code should be removed so that the program will work as intended?

(A) Line 5 (C) Line 9

A programmer notices the following two procedures in a library. The procedures do similar, but not identical, things. • Procedure MaxTwo (x, y) returns the greater of its two integer parameters. • Procedure MaxThree (x, y, z) returns the greatest of its three integer parameters. Which of the following procedures is a generalization of the MaxTwo and MaxThree procedures?

(B) Procedure Max (numList), which returns the maximum value in the list of integers numList . Correct. The procedures MaxTwo and MaxThree are each used to determine the maximum among a group of given values. A generalization of this procedure is Max, which takes a list parameter as input to determine the maximum of any number of values.

The procedure BinarySearch (numList, target) correctly implements a binary search algorithm on the list of numbers numList. The procedure returns an index where target occurs in numList, or -1 if target does not occur in numList. Which of the following conditions must be met in order for the procedure to work as intended?

(C) The values in numList must be in sorted order.

A programmer wants to determine whether a score is within 10 points of a given target. For example, if the target is 50, then the scores 40, 44, 50, 58, and 60 are all within 10 points of the target, while 38 and 61 are not. Which of the following Boolean expressions will evaluate to true if and only if score is within 10 points of target ?

(D) (target - 10 ≤ score) AND (score ≤ target + 10)

Which of the following best explains how a certificate authority is used in protecting data?

(D) A certificate authority verifies the authenticity of encryption keys used in secured communications.

Consider two lists of numbers called list1 and list2. A programmer wants to determine how many different values appear in both lists. For example, if list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80], then there are three different values that appear in both lists (20, 40, and 60). The programmer has the following procedures available.

(D) newList1 ← RemoveAllDups (list1) newList2 ← RemoveAllDups (list2) bothList ← Combine (newList1, newList2) uniqueList ← RemoveAllDups (bothList) count ← LENGTH (bothList) - LENGTH (uniqueList)


Ensembles d'études connexes

Week 5 Sherpath Lesson Assessments

View Set

CHAPTER 1: Thinking like an Economist Podcast

View Set

¡HACE FRÍO Y LLUEVE, PERO NO NIEVA!

View Set