Unit 5 Review

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Problems that are practically impossible to solve in a reasonable amount of time are called _____________ problems.

Intractable

Using Android Logo, the turn(20) command, rotates the robot _____________ by _________ degrees.

Right, 20

Loops are used to implement which component of an algorithm?

Repetition

You want to add some additional values to the end of your list. Which list operation should you use?

APPEND(list, value)

Select the type of search which reduces the range to be searched by approximately one-half after each comparison.

Binary

You are playing a guessing game with your friend where you must guess the secret number. You always choose the number at the half-way point between the highest and lowest number. This search method is known as:

Binary search

Select the algorithm that repeatedly steps through the list to be sorted and compares each pair of adjacent items and swaps them if they are in the wrong order.

Bubble Sort

In which of these situations would you likely employ a heuristic algorithm in your program? (Choose 2)

Deciding the best route for your multi-stop vacation Determining the bus routes for a school

The Binary Search Algorithm is the most efficient way to search through:

Ordered data

What is the parameter being called in this block of code?

L

When the first question in a question list corresponds to the first answer in an answer list and they both also go with the first picture in a picture list, and that format is used throughout the lists, this is known as a:

Parallel list

What is "N" when referencing the efficiency of an algorithm?

The size of the list.

Select the reasons to use parameter in a procedure. (Choose all that apply)

To make the code more versatile To make the code abstract

Problems that are theoretically impossible to solve by any algorithm are called _______________ problems.

Undecidable

Which of these segments of code does NOT use a parameter?

(b) the variable number, not a parameter, is being called (d) the global variable is being called, not a parameter. There is no parameter in this procedure."

Consider an algorithm to solve a problem that takes 160 seconds to run on 1 processor. This algorithm can be divided among two processors to solve the same problem in 100 seconds. What is the speedup for this parallel algorithm?

1.6

For a list of 20,000 sorted numbers, what is the maximum number of guesses it would take using the binary search method for you to guess the secret number if you were told after each guess whether it was too low or too high?

15

A certain computer has two identical processors that are able to run in parallel. The table below indicates the amount of time it takes each processor to execute each of two processes. Assume that neither process is dependent on the other. Which of the following best approximates the difference in execution time between running the two processes in parallel instead of running them one after the other on a single processor? (Answers are in seconds.)

30

If you wanted to draw a regular polygon using logo, which formula would you use to find the measure of the angle of your turn?

360 / n

To create any closed shape using Android Logo, the sum of all turns must equal _____________.

360 degrees

You have a stack of money that you want to put in order from 1s to 100s. There are 50 bills in the stack. If you are using the bubble sort, how many passes through the stack would you need to make to put all the bills in order?

50

What is the length of this list?

6

In this code, how many degrees must you turn to draw a pentagon?

72 degrees

Given this list, procedure, and the procedure call what is the value returned?

8

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. Which of the following best approximates the minimum possible time to execute all three processes when the two processors are run in parallel? Answers are in seconds.

80

Given this procedure with the missing code, select the proper code to replace the <missing code> statement for the procedure that calculates the cube of a number. (Choose 2)

A, C

You are working on a complex portion of a program, but you are interrupted to go do something else. You are unsure when or if you will be able to return to finish it or if someone else will need to complete it. What should you do so that you or your colleague will know what you were working on?

Add detailed comments within your code to remind yourself and your colleague what you were working on.

33)

Algorithm II always work correctly, but Algorithm I only works correctly when the date data is sorted.

Assume that you need to put the following colors in alphabetical order using bubble sort [black, brown, green, yellow, purple, orange, pink, white, gray]. After four passes, what would be the correct order?

Black, brown, green, orange, gray, pink, purple, white, yellow

What kind of sort is represented in the pseudocode shown here?

Bubble sort

Select the sorting algorithm that distributes the elements of a list into a number of groups.

Bucket Sort

You need to sort a large stack of graded papers by score as quickly as possible. Which sort method should you use?

Bucket sort

Which item reflects the order of most to least efficient sort assuming a large number of items to be sorted.

Bucket, Merge, Bubble

Which block of code correctly increments global variable x by i?

D

Procedural abstraction, with or without parameters, makes it easier to express algorithms because the new procedures effectively:

Extend our language to higher levels of functionality

For which of the following would a binary search be useful?

Finding a book in the library

Which abstraction returns a value in MIT App Inventor?

Function

You want to add some additional items to the middle of your list. Which list operation should you use?

INSERT(list, I, value)

______________ is used to make sure that a particular question is matched with its correct answer and correct picture in the Quiz App.

Indexing

What is an advantage of using a linear search over a binary search?

It can be used with unsorted data

Select the type of search that starts at the beginning of a list and checks each element in the list in order.

Linear

The books in your home are randomly placed on a bookshelf. Your younger brother wants you to read "The Three Little Pigs" to him. Which would be the most efficient way for you to find the book?

Linear search

The "for each" segment in the following block of code is called a/an:

Loop

What movie occurs at index 4 in this list?

Mama Mia

In what drawer would you find the TextToSpeech component?

Media

Select the sorting algorithm that divides the unsorted list into n sublists, each containing 1 element, then repeatedly combines sublists to produce new-sorted sublists until there is only 1-sorted list remaining.

Merge Sort

A bubble sort has what order of efficiency?

N^2

"Length" and "sides" in the following block of code are called:

Parameters

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.

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

Given this procedure, select the proper statement to replace the <missing code> statement for the procedure that calculates a number raised to a power.

RETURN num

Iteration is another name for:

Repetition

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.

Assume that you needed to put all your classmates' folders in alphabetical order for your instructor. Student names are: Gwen, Joseph, Israel, Javier, Ankita, Annika, Jerry, Kaya, Zyven, and Natasha. After the first pass through, whose name will be on the far right of the list when using a bubble sort?

Zyven

Given this code, what values are stored in newList after execution of the code segment?

[1, 3, 5]

Given this code fragment, what does listA contain after the code is executed?

[1, 6, 2, 3, 8, 7, 5]

Using Android Logo, you have a procedure with the commands forward(30) and turn(45) which repeats 8 times. What would be the best name for this procedure?

drawOctagon

A linear search only works if the data is sorted

false

A list is a type of procedural abstraction.

false

A parameter is a global variable.

false

Screen1.Initialize is used to reset your screen back to the original content when a button is pressed.

false

The more specific a procedure is, the better.

false

The more specific the abstraction is, the better it is.

false

What is list1 after the INSERT block is run?

list1 ← [2, 3, A, 4, a, b, c]

A brute force attack is a trial and error method of obtaining information such as a password or pin.

true

A parameter and an argument are referring to the same thing within a procedure.

true

Parameters, or arguments, are: (choose 2)

used to make procedures more useful variables used to pass data to a procedure


Set pelajaran terkait

Unit 5 Module 12 Monetary Policy in Theory and Practice

View Set

Chapter 14: Nature of Personal Property

View Set

Chapter 4: Growth and Development of the Toddler Q's

View Set

Speeches: Informative & Persuasive Presentations II

View Set

Chapter 12: Dwarf Planets and Small Solar System Bodies

View Set