Presentation is loading. Please wait.

Presentation is loading. Please wait.

PreAP Computer Science Quiz

Similar presentations


Presentation on theme: "PreAP Computer Science Quiz"— Presentation transcript:

1 PreAP Computer Science Quiz 13.03-07
Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 30, 45 or 60 seconds per question.

2 Title the quiz as shown below The quiz starts in ONE minute.
Name Period Date Quiz EC.

3 Question 01 Why is a List class necessary, if you already have
an int array? The int array does not provide any methods to access the array elements. The int array does not provide methods to perform operations on the array. The int array does not protect against unwanted access of data members. All of the above

4 Question 02 What is the purpose of the pause method?
It slows down the output of an animated graphics program. It permanently stops the output of a graphics-based program in the middle of its execution. It permanently stops the output of a text-based program in the middle of its execution. It temporarily stops the output of a text-based program, to give you a chance to see it, and then continues when you press the <enter> key. It temporarily stops the output of a graphics-based program, to give you a chance to see it, and then continues when you click the mouse.

5 Question 03 The linear search works with any list of data.
lists of data sorted in ascending order only. lists of data sorted in descending order only. lists of random data only.

6 Question 04 The efficient linear search
stops searching when the data is found. finds requested data faster. works only with lists of sorted data. has less program code than the inefficient linear search.

7 Question 05 The reason for sorting data is people prefer data sorted.
sorted data takes less space. searching is faster with sorted data. all of the above.

8 Question 06 The partial sort – as demonstrated in Chapter 13 – only
sorts half the list. arranges data in ascending order. arranges data is descending order. places one element in the correct location.

9 Question 07 The bubble sort – as demonstrated in Chapter 13 – sorts
only half the list. data in ascending order. data in descending order. one element in the correct location.

10 Question 08 Which of the following is a problem with the inefficient Linear Search? I. The algorithm cannot find an item in the list. II. The algorithm will always search through to the end of the list even after the item is already found. III. The algorithm does not tell you the index of where an item was found. (a) I only (b) I & II only (c) I & III only (d) II & III only (e) I, II & III

11 Question 09 What is returned by the Inefficient Linear Search if the desired item IS in the list? The index where it was found. -1 true false Index Out of Bounds Exception

12 Question 10 What is returned by the Efficient & Practical Linear Search if the desired item IS in the list? The index where it was found. -1 true false Index Out of Bounds Exception

13 Question 11 What is returned by the Inefficient Linear Search if the desired item is NOT in the list? The index where it was found. -1 true false Index Out of Bounds Exception

14 Question 12 What is returned by the Efficient & Practical Linear Search if the desired item is NOT in the list? The index where it was found. -1 true false Index Out of Bounds Exception

15 Question 13 You have a sorted array of about 1,000,000 people.
You are using the linearSearch method to find someone in who is at the very beginning of the list. How many people does the computer look at before it finds the one you are looking for? exactly 1 about 500,000 about 1,000,000 It will not find the person.

16 Question 14 You have a sorted array of about 1,000,000 people.
You are using the linearSearch method to find someone in who is at the very end of the list. How many people does the computer look at before it finds the one you are looking for? exactly 1 about 500,000 about 1,000,000 It will not find the person.

17 Question 15 You have a sorted array of about 1,000,000 people.
You are using the linearSearch method to find someone in the exact middle on the list. How many people does the computer look at before it finds the one you are looking for? exactly 1 about 500,000 about 1,000,000 It will not find the person.

18 Question 16 You have a sorted array of about 1,000,000 people.
You are using the binarySearch method to find someone in the exact middle on the list. How many people does the computer look at before it finds the one you are looking for? exactly 1 about 500,000 about 1,000,000 It will not find the person.

19 Question 17 The advantage of the binary search over the
linear search is that it requires writing less program code. finds data much faster. quits when the required data is found. all of the above.

20 Question 18 The disadvantage of using the binary search is that it
requires writing less program code. finds data much faster. requires sorted data. requires random data.

21 Question 19 Below are a list of methods from Chapter 13.
If you had to pick one method to be declared private which would it be? NOTE: All of the methods are in the same class. linearSearch binarySearch swap partialSort bubbleSort

22 Question 20 (a) for (int p = 1; p < size; p++)
This program segment is a bubble sort and it has 3 less than ( < ) signs in it and will sort data in descending (largest to smallest) order. Which sign do I need to “flip” (change to a >) so it will now sort in ascending (smallest to largest) order? (a) for (int p = 1; p < size; p++) (b) for (int q = 0; q < size-p ; q++) (c) if (intArray[q] < intArray[q+1]) (d) swap(q,q+1);

23 Extra Credit The population of planet Earth is about 7 billion.
If all of these people were stored in one gigantic array, how many tries would it take the Binary Search to find any individual on the planet? (a) (b) 23 (c) (d) 31 (e) (f) 33 (g) (h) 3 to 3.5 billion 23


Download ppt "PreAP Computer Science Quiz"

Similar presentations


Ads by Google