Chapter 5 Test (CSP)

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

According to the following table, how many lookups would be required in the worst case to find a number in list of 10,000 elements using linear search? Type your answer in the text box. (refer to screenshot 3)

10,000

In the bubble sort demo, 13 cards are being sorted. How many passes does this version of the algorithm require to sort the cards?

13

According to the following table, how many lookups would be required in the worst case to find a number in a sorted list of 10000 elements using binary search? Type your answer in the text box. (refer to screenshot)

14

Suppose you are sorting the following list of numbers in ascending order using bubble sort: [16, 5, -1, 4, 12, 17, 3, 10, 5, 9]. After the first pass through the numbers, what value would appear on the right of the list?

17

For a list of 500 numbers, at most how many guesses would it take using binary search to guess the secret number if after each guess you were told whether your guess was too high or too low or just right? Type your answer into the text box.

9

Which of the following characteristics is true of bubble sort? Choose all that apply. - A comparison-based algorithm. - Useful only for sorting numbers. - A quadratic algorithm. - More efficient than bucket sort. - Widely used to sort large data sets.

A comparison-based algorithm and a quadratic algorithm.

What shape would be drawn by this algorithm? (refer to screenshot)

A pentagon with sides of length 100 pixels

Which of the following is not true about algorithms: - An algorithm is a sequence of precise instructions. - Algorithms can be written to solve every problem. - Algorithms are step-by-step procedures. - Algorithms consist of sequences, selections, and repetitions.

Algorithms can be written to solve every problem.

For which of the problems would the bubble sort algorithm provide an appropriate solution. Choose all that apply. - Arranging a deck of cards from the lowest to the highest value cards. - Looking up a name in the phone book. - Sorting a stack of paper money into denominations -- i.e., $1, $5, $10 etc. - Sorting a basket of laundry into socks, shirts, shorts, and sheets. - Arranging books on a bookshelf by author's last name.

Arranging a deck of cards from the lowest to the highest value cards, Sorting a stack of paper money into denominations -- i.e., $1, $5, $10 etc., and Arranging books on a bookshelf by author's last name.

The function shown in this graph is known as the base-2 logarithm function, y = log2(x). Which search algorithm behaves like this function? (refer to screenshot 4)

Binary Search

True of False. An algorithm can be found for any computational problem whatsoever.

False

True or False: Semantic errors can be detected by the compiler.

False

True or False? An algorithm is a precise sequence of statements that must be expressed in a computer language.

False

True or false. All intractable problems are bad.

False

Your classmate discovers that their MoleMash app has a bug in it. What should he/she do to debug their app?

Form a hypothesis about what might be wrong, design an experiment to test their hypothesis, perform the experiment, debug, and then retest the app.

Tractable or intractable? For any length string of letters 'a' through 'z', write down all possible words.

Intractable

How would you classify the following algorithm? To Sum 1 to N: Set sum to 0 For each number K in 1 to N Add K to sum Output Sum

Linear

Which of the following characteristics is true of bucket sort? Choose all that apply. - A comparison-based algorithm. - Useful only for sorting numbers. - A quadratic algorithm. - More efficient than bubble sort. - A linear algorithm

More efficient than bubble sort and a linear algorithm

How would you classify? To Count Primes between 2 and N Set Count to 0 For each number K between 2 and N: If K is a prime Add 1 to count Output Count

Quadratic

In computer programming, syntax is the __________ that determines whether statements are correctly formulated.

Set of rules

A ____________ error occurs when a programming language's rules are broken. This type of error can be detected by the compiler which will provide an error message.

Syntax

Which of the following are examples of semantic errors in App Inventor? Check all that apply. - The PaintPot ButtonMinus.Click event adding 1 to dotsize. - Coding duplicate Canvas1.Touched event handlers in PaintPot. - Attempting to set PaintPot's Canvas1.PaintColor to red using a text block. - The PaintPot ButtonRed.Click setting the Canvas1.PaintColor to blue.

The PaintPot ButtonMinus.Click event adding 1 to dotsize and the PaintPot ButtonRed.Click setting the Canvas1.PaintColor to blue.

You should be able to draw a square of any size with this procedure by calling it and specifying the parameter L. However, this procedure has a bug. What is the bug? (refer to screenshot number 2)

The procedure always draws a square with sides of size 50. The parameter L is ignored,

What are If/else blocks used for when programming an app? Check all that apply. - To control the app's behavior. - To repeat a sequence of statements. - To check if a certain condition is True or False. - To tell the app which path to take in the code.

To control the app's behavior, To check if a certain condition is True or False, and To tell the app which path to take in the code.

True or False: In computer programming, a bug is an error or defect that prevents the app from working the way it is supposed to.

True

Suppose you are sorting the following list of words in alphabetical order using bubble sort: [apple, banana, lemon, tomato, orange, squash, papaya, pumpkin]. Which of the following gives the correct order of the list after two passes through the list?

[apple, banana, lemon, orange, papaya, pumpkin, squash, tomato]

What value would give the Ball's Heading property to have the Ball move toward the left side of the screen?

a random integer between 140 and 220

The Halting Problemis an example of

an undecidable problem

To say that bucket sort is more efficient than bubble sort means that _________________.

as the size of the list grows, bucket sort will be faster than bubble sort.

For searching a sorted list, which search algorithm is the better choice? - sequential or binary

binary

Which of the following type of components must be always be used with a Ball?

canvas

Pseudocode is ___________________.

easy to read, not a programming language, a mixture between a natural language and a programming language

True or False: The Ball and ImageSprite components have all the same properties, event handlers, procedures, setters, and getters?

false

True or False: The Blockly Maze language is an example of pseudocode.

false

A sort algorithm's efficiency refers to ______________________.

how long it takes to arrange the values in order.

Complete the following sentence: Sequencing in algorithms means that each step of the algorithm is executed ____________.

in the order they are given

Assuming that forward tells the Android to move forward by 10 pixels and turn tells it to turn right by 90 degrees, what shape would be drawn by this algorithm? forward forward turn forward turn forward forward turn forward turn

rectangle

A ____________ error occurs when a programmer inadvertently puts code that is syntactically correct, but does not do what the programmer intended it to do.

semantic

For searching an unordered list, which search algorithm is the better choice? - sequential search or binary search

sequential search

Suppose you are sorting the following list of words into alphabetical order using bubble sort: [apple, orange, banana, papaya, lemon, pumpkin, squash, tomato]. After the first pass through the list, what word would appear on the right of the list?

tomato

What event checks to see if the Ball has made it past the paddle to the bottom of the screen?

when the ball reaches an edge

How would you classify this algorithm? Is N a prime For each number K from 2 to N/2 if N is divisible by K Output False Output True

Linear

What is the name of the computer language that uses a turtle to implement drawing algorithms? Type your answer into the textbox (spelling counts).

Logo

For which of the problems could the sequential search algorithm be used? Choose all that apply. - Arranging a deck of cards from the lowest to the highest value cards. - Looking up a phone number in the phone book given the person's full (unique) name. - Looking up a word in a dictionary. - Looking up a person's name in the phone book given the person's phone number. - Guessing a secret number between 1 and 100.

Looking up a phone number in the phone book given the person's full (unique) name, Looking up a word in a dictionary, Looking up a person's name in the phone book given the person's phone number, and Guessing a secret number between 1 and 100.

For which of the problems would the binary search algorithm be useful? Choose all that apply. - Arranging a deck of cards from the lowest to the highest value cards. - Looking up a phone number in the phone book given the person's full (unique) name. - Looking up a word in a dictionary. - Looking up a person's name in the phone book given the person's phone number. - Finding the smallest number in a list of numbers arranged randomly.

Looking up a phone number in the phone book given the person's full (unique) name. and Looking up a word in a dictionary.


Kaugnay na mga set ng pag-aaral

CHPT 18: Ad, PR and Sales Promotions

View Set

A & P FINAL EXAM- URINARY SYSTEM

View Set

Chapter 3 & 4 Study Guide System A&D(Multiple Choice)

View Set

3.5 Genetic Modification and Biotechnology

View Set

NU473 Week 6 HESI Case Study Evolve Elsevier: Feeding and Eating Disorders - 22 Questions

View Set

CJ 250 -- Exam 2 Study Sheet [CH5-8]

View Set

Chapter 7: Federal Tax Considerations For life Insurance And Annuities

View Set