UNIT 5 CSP

Ace your homework & exams now with Quizwiz!

Parameters, or arguments, are: (choose 2) A constants that never change B only used to draw shapes C used to make procedures more useful D variables used to pass data to a procedure

CD

A sort algorithm's efficiency refers to ______________________. A how many swaps are needed to sort the values. B whether the algorithm correctly arranges the values in order. C how many comparisons are needed to sort the values. D how long it takes to arrange the values in order.

D

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? A Ankita B Annika C Kaya D Zyven

D

Multiple lists, where the first items from each list are related, the second items from each list are related, and so on for every item in each list, are called __________ lists. A Lists of B Refactored C Linear D Parallel

D

To create any closed shape using Android Logo, the sum of all turns must equal _____________. A 90 degrees B 180 degrees C 270 degrees D 360 degrees

D

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

As the number of items to be sorted grows larger, which algorithm becomes more and more INEFFICIENT? A Bubble Sort B Merge Sort C Bucket Sort D Radix Sort

A

Logo 2 introduces the use of parameters into the programming language. What do these parameters allow us to do, that we could NOT do with the original Logo? [Choose all that apply] A Draw a triangle B Draw a decagon C Rotate to the left, instead of right D Draw a quadrilateral E Rotate 30 degrees F Move backwards

ABE

The Binary Search Algorithm is the most efficient way to search through: A Any data B Ordered data C Unordered data D Random data

B

What is an advantage of using a linear search over a binary search? A It's usually faster B It can be used with unsorted data C It often takes longer D It is most efficient with sorted data

B

Which abstraction returns a value in MIT App Inventor? A Variable B Function C Procedure D Sort

B

You are using Bubble Sort to sort the following list of numbers in ascending order (low to high): [8, 3, 10, 5, 9]. After the first pass through the numbers, what value would appear on the LEFT of the list? A 8 B 3 C 10 D 5 E 9

B

______________ is used to make sure that a particular question is matched with its correct answer and correct picture in the Quiz App. A A constant B Indexing C A variable D An event

B

For which of the problems COULD the sequential (linear) search algorithm be used? [Choose all that apply] A Arranging a deck of cards from the lowest to the highest value cards. B Looking up a person's name in the phone book, given the person's phone number. C Lining up 10 students by height (shortest to tallest) D Looking up a phone number in the phone book given the person's full (unique) name. E Guessing a secret number between 1 and 100.

BDE

A programmer is deciding between using a linear or binary search to find a target value in a sorted list. Which of the following is true? A In all cases, a binary search of a sorted list requires fewer comparisons than a linear search. B A linear search will generally run faster than a binary search because a linear search requires fewer lines of code to implement. C Generally, the advantage of using a binary search over a linear search increases as the size of the list increases. D Using a linear search is preferable to using a binary search if there is a chance that the target may not be found in the list.

C

Problems for which no algorithm can be written to solve are called ______________. A Intractable B Heuristic C Undecidable D Undefined

C

Procedural abstraction, with or without parameters, makes it easier to express algorithms because the new procedures effectively: A Make our programs more complicated and harder to use B Make our programs more restricted and reduce functionality C Extend our language to higher levels of functionality D Extend our language usability in a limited manner

C

Select the type of search which reduces the range to be searched by approximately one-half after each comparison. A Merge B Linear C Binary D Quick

C

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? A Binary search B Binary sort C Linear search D Randomly scan the titles

C

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 number in order from least to greatest

C

You are going to sort 17 playing cards from low to high, using Bucket Sort. How many total moves (not passes through) will you need to make, in order to be holding the properly sorted deck of cards in your hand? A 15 B 16 C 17 D 18

C

You need to sort a large stack of graded papers by score as quickly as possible. Which sort method should you use? A Binary sort B Bubble sort C Bucket sort D Merge sort

C

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? A 24 B 25 C 30 D 50

D

Which of the following characteristics is true of Bucket Sort? [Choose all that apply] A A comparison-based algorithm B Useful only for sorting numbers C A quadratic algorithm D More efficient than bubble sort E A linear algorithm

DE


Related study sets

CH 5 Activity-based costing (ABC) and Activity-based Management (ABM) (SU3)

View Set

Chemistry module 4 -- organic chemistry (Chapter 14 'Alcohols')

View Set

Chapter 11: Network Performance and Recovery

View Set

FMSC330 Exam Two Single Parent Families

View Set

Fundamentals of KIN Exam - Ch 11-15

View Set

Pathopharm Test 2 - review questions

View Set