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.

Download 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.

Post on 23-Dec-2015

214 views

Category:

Documents

0 download

TRANSCRIPT

  • Slide 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.
  • Slide 2
  • Title the quiz as shown below The quiz starts in ONE minute. Name Period Date Quiz 13.03-07 1. 11. 2. 12. 3. 13. 4. 14. 5. 15. 6. 16. 7. 17. 8. 18. 9. 19. 10. 20. EC.
  • Slide 3
  • Question 01 Why is a List class necessary, if you already have an int array? (a)The int array does not provide any methods to access the array elements. (b)The int array does not provide methods to perform operations on the array. (c)The int array does not protect against unwanted access of data members. (d)All of the above
  • Slide 4
  • Question 02 What is the purpose of the pause method? (a)It slows down the output of an animated graphics program. (b)It permanently stops the output of a graphics-based program in the middle of its execution. (c)It permanently stops the output of a text-based program in the middle of its execution. (d)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 key. (e)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.
  • Slide 5
  • Question 03 The linear search works with (a)any list of data. (b)lists of data sorted in ascending order only. (c)lists of data sorted in descending order only. (d)lists of random data only.
  • Slide 6
  • Question 04 The efficient linear search (a)stops searching when the data is found. (b)finds requested data faster. (c)works only with lists of sorted data. (d)has less program code than the inefficient linear search.
  • Slide 7
  • Question 05 The reason for sorting data is (a)people prefer data sorted. (b)sorted data takes less space. (c)searching is faster with sorted data. (d)all of the above.
  • Slide 8
  • Question 06 The partial sort as demonstrated in Chapter 13 only (a)sorts half the list. (b)arranges data in ascending order. (c)arranges data is descending order. (d)places one element in the correct location.
  • Slide 9
  • Question 07 The bubble sort as demonstrated in Chapter 13 sorts (a)only half the list. (b)data in ascending order. (c)data in descending order. (d)one element in the correct location.
  • Slide 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
  • Slide 11
  • Question 09 What is returned by the Inefficient Linear Search if the desired item IS in the list? (a)The index where it was found. (b)-1 (c)true (d)false (e)Index Out of Bounds Exception
  • Slide 12
  • Question 10 What is returned by the Efficient & Practical Linear Search if the desired item IS in the list? (a)The index where it was found. (b)-1 (c)true (d)false (e)Index Out of Bounds Exception
  • Slide 13
  • Question 11 What is returned by the Inefficient Linear Search if the desired item is NOT in the list? (a)The index where it was found. (b)-1 (c)true (d)false (e)Index Out of Bounds Exception
  • Slide 14
  • Question 12 What is returned by the Efficient & Practical Linear Search if the desired item is NOT in the list? (a)The index where it was found. (b)-1 (c)true (d)false (e)Index Out of Bounds Exception
  • Slide 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? (a)exactly 1 (b)about 500,000 (c)about 1,000,000 (d)It will not find the person.
  • Slide 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? (a)exactly 1 (b)about 500,000 (c)about 1,000,000 (d)It will not find the person.
  • Slide 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? (a)exactly 1 (b)about 500,000 (c)about 1,000,000 (d)It will not find the person.
  • Slide 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? (a)exactly 1 (b)about 500,000 (c)about 1,000,000 (d)It will not find the person.
  • Slide 19
  • Question 17 The advantage of the binary search over the linear search is that it (a)requires writing less program code. (b)finds data much faster. (c)quits when the required data is found. (d)all of the above.
  • Slide 20
  • Question 18 The disadvantage of using the binary search is that it (a)requires writing less program code. (b)finds data much faster. (c)requires sorted data. (d)requires random data.
  • Slide 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. (a)linearSearch (b)binarySearch (c)swap (d)partialSort (e)bubbleSort
  • Slide 22
  • Question 20 This program segment is a bubble sort and it has 3 less than ( ) 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);
  • Slide 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)20 (b)23 (c)30 (d)31 (e)32 (f)33 (g)34 (h)3 to 3.5 billion

Recommended

View more >