Comp Sci Unit 6

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Based on a binary search algorithm - how do you find the maximum number of iterations for a list of 5 numbers? 7? 9?

5- 3 iterations. 7- 3 iterations. 9- 4 iterations. However many bits you would need to display information. See flippy do

A certain computer has two identical processors that are able to run in parallel. Each processor can run only one process at a time, and each process must be executed on a single processor. The following table indicates the amount of time it takes to execute each of three processes on a single processor. Assume that none of the processes are dependent on any of the other processes. Process Execution Time on Either Processor X 60 seconds Y 30 seconds Z 50 seconds Which of the following best approximates the minimum possible time to execute all three processes when the two processors are run in parallel?

80 seconds

Which of the following best describes a challenge involved in using a parallel computing solution?

A parallel computing solution may not be appropriate for an algorithm in which each step requires the output from the preceding step.

What is an undecidable problem?

A problem for which no algorithm can be constructed that always produces a correct response

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

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?

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

Which algorithm is more efficient

Different efficiencies based on the input size

A sequential algorithm is broken into three stages

Divide part 1 by part 2. A parallel version of the algorithm completes the sorting stage in parallel leading to a new set of times

When and why do we use heuristics?

Good enough when a reasonable algorithm does not exist

Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer. An algorithm that accesses each element in the list twice An algorithm that accesses each element in the list n times 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?

I, II, and III

What are the impacts of running a parallel algorithm on a large number of computers?

Likely take less time however the efficiency will not be as significant

What type of search algorithm needs to be used if a data set is not sorted?

Linear

Write an algorithm that is the same as the flowchart below

My num < random (1,10) Repeat until my num>8 display(myNum) myNum<random(1,10) Display ("done")

A computer has two processors that are able to run in parallel. The table below indicates the amount of time it takes either processor to execute four different processes. Assume that none of the processes is dependent on any of the other processes. Process Execution Time W 20 seconds X 30 seconds Y 45 seconds Z 50 seconds A program is used to assign processes to each of the processors. Which of the following describes how the program should assign the four processes to optimize execution time?

Processes W and Z should be assigned to one processor, and processes X and Y should be assigned to the other processor.

Give an example of each of the following in an algorithm:

Sequencing- putting steps in order Selection- deciding what steps to do next: boolean, if statement, conditional Iteration- repeating some steps: loop

Give an example of an optimization problem

Set number of spots have to find the shortest distance between

A graphic artist uses a program to draw geometric shapes in a given pattern. The program uses an algorithm that draws the shapes based on input from the artist. The table shows the approximate number of steps the algorithm takes to draw different numbers of shapes. Number of Shapes Drawn Number of Steps 4 17 5 24 6 35 7 50 Based on the values in the table, which of the following best characterizes the algorithm for drawing n shapes, where n is a very large number?

The algorithm runs in a reasonable amount of time because it will use approximately n2 steps to draw n shapes.

Which of the following best describes the ability of parallel computing solutions to improve efficiency?

The efficiency of a solution that can be broken down into parallel portions is still limited by a sequential portion.

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.

Which of the following best explains why it is not possible to use computers to solve every problem?

There exist some problems that cannot be solved using any algorithm.

Which type of algorithm is the LEAST efficient?

Exponential

How can you modify the code below to find the smallest element in the list?

Line 4 would become IF num < target

Write an algorithm that would take the turtle along the same path as the one below

Repeat 2 times, move forward, move forward, move forward, rotate left, move forward, rotate right

What methods can be used to construct algorithms

Sequencing, selection, iteration

Which of the following best explains how algorithms that run on a computer can be used to solve problems?

Some problems cannot be solved by an algorithm.

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

For which of the following situations would it be best to use a heuristic in order to find a solution that runs in a reasonable amount of time?

Finding the fastest route that visits every location among n locations, which requires n! possible routes be examined.

Three different numbers need to be placed in order from least to greatest. For example, if the numbers are ordered 9, 16, 4, they should be reordered as 4, 9, 16. Which of the following algorithms can be used to place any three numbers in the correct order?

If the first number is greater than the middle number, swap them. Then, if the middle number is greater than the last number, swap them. Then, if the first number is greater than the middle number, swap them.

What is the benefit of parallel and distributed computing?

Scales more effectively than sequential computing

A student wants to determine whether a certain problem is undecidable. Which of the following will demonstrate that the problem is undecidable?

Show that for one instance of the problem, no algorithm can be written that is capable of providing a correct yes-or-no answer.

A team of programmers is designing software. One portion of the project presents a problem for which there is not an obvious solution. After some research, the team determines that the problem is undecidable. Which of the following best explains the consequence of the problem being undecidable?

There is no possible algorithm that can be used to solve all instances of the problem.


संबंधित स्टडी सेट्स

Chapter 10 - Colorado Laws and Rules Pertinent to Insurance

View Set

Maternal Newborn Success - Normal Postpartum & High Risk Postpartum

View Set

California Real Estate Salesperson Practice Exam 1 - EBSCO 2022/11/12

View Set

APUSH Chapter 12 - The South Expands: Slavery and Society

View Set

ACC 201 Chapter 9 MC Without Math

View Set