APCSP Unit 5

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

What element must always be used with a ball?

Canvas

What is a captcha and why are captchas important?

Captcha means "Completely Automated Public Turing test to tell Computers and Humans Apart". This is a test to see if the person typing the information is a person and not a robot. Thhis is when the computer asks you to copy a few letters in a weird font to make sure you are not a robot.

In computer programming, syntax is the __________ that determines whether statements are correctly formulated. A. programmer's knowledge B. compiler C.programming language D. set of rules

D

What are the sort algorithms?

Merge, Bubble, Bucket

Undecidable problem

No algorithm can be created to always lead to a correct yes or no

Semantic

occur when the programmer unintentionally writes code that follows the syntax rules of the programming language, but their code works in a different way than what the programmer had intended it to.

In a linear search algorithm how d you find the number of comparisons?

# of inputs=# of comparisons

In a binary search algorithm how do you find the number of comparisons?

#of inputs is equal to 2^(# of comparisons)

What is bucket sort?

1. For each card in the deck, put it into the bucket indicated by its rank. 2. Starting with the lowest numbered bucket, collect all the cards together.

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

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 because 17 is the largest number so it would bubble to the top

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 because every time you would eliminate some options by saying too high or low, 2^9 is 512 which is greater than 500

Firewall

A part of a computer system or network that is designed to prevent unauthorized access to or from that networkfirewall: a part of a computer system or network that is designed to prevent unauthorized access to or from that network

Decidable problem

A problem for which an algorithm can be constructed to answer a "yes" or "no" for all possible inputs

Unsolvable Problem

A problem when no solution is known or experts disagree about proposed solutions

What is a linear or subsequent search algorithm?

A search algorithm is when the cards are not ordered. You then look through all the cards until you find the one you want or until there are no cards left.

Syntax

A set of rules, that must be followed when writing code.

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

A, D

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

A,C

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

A,C,D

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

A,C,E

Which of the following are true if binary search is used to search through a list? A. The list must be ordered. B. The list must be small. C. The list must be a list of numbers. D. It will take 4 iterations to search through 16 items. E. On average, this search will take log2(n) comparisons to find an item among n items. F. On average, this search will take n comparisons to find an item amount n items.

A,D,E

Intractable problem

Algorithm to solve the problem but it is too inefficient to solve the problem as the number of inputs grows larger

Heuristic algorithm

Algorithms that usually get the correct solution to a problem but it is not guaranteed

To say that bucket sort is more efficient than bubble sort means that _________________. A.for any size list, bucket sort will always be faster than bubble sort. B.as the size of the list grows, bucket sort will be faster than bubble sort. C.bucket sort requires fewer comparisons than bubble sort. D.bucket sort requires fewer swaps than bubble sort.

B

What event checks to see if the Ball has made it past the paddle to the bottom of the screen? A.When the Ball collides with the paddle. B.When the Ball reaches an edge. C.When the paddle is dragged. D. When the Ball bounces.

B

Your classmate discovers that their MoleMash app has a bug in it. What should he/she do to debug their app? A.Rebuild the app and then retest the app B.Form a hypothesis about what might be wrong, design an experiment to test their hypothesis, perform the experiment, debug, and then retest the app. C.Form a hypothesis and then retest the app. D.mmediately start changing code and retest the app.

B

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

B and C

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.

B,C,D,E

For searching a sorted list, which search algorithm is the better choice?

Binary Search

What are the non-comparative sorts?

Bucket and Radix

Which sort algorithm is most efficient when the list is large? When the list is small?

Bucket sort is the more efficient algorithm in the sense that as the size of the list grows, the time it takes to sort the values will not increase as fast as for bubble sort. Bubble sort may actually be faster for very small list.

There are 32 students standing in a classroom. Two different algorithms are given for finding the average height of the students. Algorithm A Step 1: All students stand. Step 2: A randomly selected student writes his or her height on a card and is seated. Step 3: A randomly selected standing student adds his or her height to the value on the card, records the new value on the card, and is seated. The previous value on the card is erased. Step 4: Repeat step 3 until no students remain standing. Step 5: The sum on the card is divided by 32. The result is given to the teacher. Algorithm B Step 1: All students stand. Step 2: Each student is given a card. Each student writes his or her height on the card. Step 3: Standing students form random pairs at the same time. Each pair adds the numbers written on their cards and writes the result on one student's card; the other student is seated. The previous value on the card is erased. Step 4: Repeat step 3 until one student remains standing. Step 5: The sum on the last student's card is divided by 32. The result is given to the teacher. Which of the following statements is true? (A) Algorithm A always calculates the correct average, but Algorithm B does not. (B) Algorithm B always calculates the correct average, but Algorithm A does not. (C) Both Algorithm A and Algorithm B always calculate the correct average. (D) Neither Algorithm A nor Algorithm B calculates the correct average.

C

Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem? (A) When the problem can be solved in a reasonable time and an approximate solution is acceptable. (B) When the problem can be solved in a reasonable time and an exact solution is needed. (C) When the problem cannot be solved in a reasonable time and an approximate solution is acceptable. (D) When the problem cannot be solved in a reasonable time and an exact solution is needed.

C

What value would give the Ball's Heading property to have the Ball move toward the left side of the screen? A.a random integer between 0 and 60 B.a random integer between 90 and 120 C.a random integer between 140 and 220 D. a random integer between 225 and 315

C

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

D,E

What numbers between 180 and 270 mean?

Down left

What do numbers between 270-360 mean?

Down right

What cardinal direction is 0 at?

East

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

FALSE, The Ball and ImageSprite have exactly the same event handlers, procedures, setters, and getters. But, they do not have all the same properties: the ImageSprite has a Picture property and the Ball does not.

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

False

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

False

What is merge sort?

First divide the list into the smallest unit (1 element), then compare each element with the adjacent list to sort and merge the two adjacent lists. Finally all the elements are sorted and merged.

Which sort algorithm is not a quadratic sort?

Merge Sort

What are the comparative sorts?

Merge and Bubble

When you type a word or phrase into the Google search engine, what is the search algorithm that is being used? Does Google's search engine search the web? Explain.

Google uses a search algorithm called a PageRank algorithm.This means that websites that are more popular are more likely to be shown when you search something.Google uses sofware programs called spiders. Spiders fetch a few web pages that lead to more web pages until you have lots of results. Google finds information throughout the Web.

URL

It is the global address of documents and other resources on the World Wide Web

Which search algorithm is the worst case scenario? Why?

Linear search algorithm because you have to look through all the cards to find the one you are looking for

What are the search algorithms?

Linear(Sequential), binary

What cardinal direction is 90 at?

North

What is the bigO notation for merge sort?

O(n)=n*log2(n)

What is the bigO notation for bubble sort?

O(n)=n^2

What is the bigO notation for selection sort?

O(n)=n^2

What is the Big-O efficiency of Radix Sort?

O(wn)

Index

Ordered collection

What is bubble sort?

Place the unsorted deck, face down, in the right hand pile. Repeat N times Put the top card of the right pile in your hand. Repeat until there are no more cards in the right pile. If the card in your hand > the top card on the right pile Place top card on the left pile. Else Place the hand card on the left pile. When the pass is finished, put the card left in your hand on the sorted pile. Move the left pile to the right pile.

Should a researcher place absolute trust in a search engine? Why or why not?

Researchers should not put complete faith in a search engine because you are giving complete control to the search engine so some information might not be shown if a search engine is being restricted. So if the search engine company like Google wants to restrict information then the citizens can't get all the information others might get.

What two sorts are quadratic?

Selection and Bubble Sort

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 / Linear Search

Algorithm

Set of steps to complete a task

What cardinal direction is 270 at?

South

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

What is the PageRank algorithm? How does it work?

The PageRank algorithm works by choosing sights that are more popular when someone does a search because the user is more likley to like these results.

Bug

an error or defect, that prevents the app from working the way it is supposed to.

What does it mean to "empty the cache"?

The cache is like and Internet folder where you keep your copies of web pages. If you empty you cache you get rid of all the copies so you are getting rid of all the information you have saved. This creates more disk space and clears your history.

Reasonable Time

The number of steps the algorithm takes is less than or equal to a polynomial function of the size of the input

What is an example of an index?

The pages at the back of a textbook because they are in alphabetical order

"The architecture of human knowledge has changed as a result of search." What does this claim mean?

This is saying that how people get their information has changed because with a search engine people are able to find a lot of information about a topic where as before the search engine people had to use books which did not give as much information as search engines do.

The efficiency of an algorithm is a measure of:

Time and memory usage

Radix sort

To sort the numbers by their digits, you sort based on their most significant digit like ten or hundred place) and the least significant digit (ones Place)

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

Brute Force Attack/Search

Tries every possible password

Dictionary attack

Tries to look up users password in the dictionary

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

What does URL stand for?

Uniform Resource Locator

What numbers between 90 and 180 mean?

Up and left

What do numbers between 0 and 90 mean?

Up and right

What improvements did we make to the pong game?

We ended the game when it went off the bottom edge, kept track of the score and added sound effects.

What cardinal direction is 180 at?

West

Is Wikipedia considered Web 1.0 or Web 2.0? Explain.

Wikipedia is considered Web 2.0 because users give information for other users to utilize. Wikipedia and other Web 2.0 sites use network effects.

Think of a number between 1 and 100. If you tell me "too high" or "too low", I can guess the number in 7 guesses. How come? What algorithm makes this possible

You can guess my number in 7 guesses because every time you say too high or too low then you eliminate many numbers that your number can not be. By doing this you are more quickly able to figure out my number.

Cache

a special high-speed storage mechanism

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 because the tomato and squash which are later in the alphabet bubbled to the top

HTML

hypertext markup language, a standardized system for tagging text files to achieve font, color, graphic, and hyperlink effects on World Wide Web pages

Foreground

in multiprocessing systems, the process that is currently accepting input from the keyboard or other input device

Background

multitasking computers are capable of executing several tasks, or programs, at the same time

Binary

pertaining to a number system that has just two unique digits

Bot

short for robot, a computer program that runs automatically.

Sorting

the process of putting objects in order. Sorting algorithms have been studied extensively by computer scientists.


Ensembles d'études connexes

Ricci 45 Nursing Care of the Child with an Integumentary Disorder

View Set