Question: You need a generic collection class that will insert items in order using a comparator method because you need to have a sorted collection to

 You need a generic collection class that will insert items inorder using a comparator method because you need to have a sortedcollection to do a binary search. You decide that inserting items insorted order is a better strategy than sorting the collection later. Whichgeneric collection class should you choose? PriorityQueue LinkedList Queue E ArrayList Searchingan array using a binary search (check all that apply): . isusually slower for each search than a simple linear search is usuallyfaster for each search than a simple linear search. .requires a pre-sortedarray in order to work. .requires more code and logic than asimple linear search. A linear search algorithm is written (as in themodules, for example) which searches an array for some user-defined value, clientData.

You need a generic collection class that will insert items in order using a comparator method because you need to have a sorted collection to do a binary search. You decide that inserting items in sorted order is a better strategy than sorting the collection later. Which generic collection class should you choose? PriorityQueue LinkedList Queue E ArrayList Searching an array using a binary search (check all that apply): . is usually slower for each search than a simple linear search is usually faster for each search than a simple linear search. .requires a pre-sorted array in order to work. .requires more code and logic than a simple linear search. A linear search algorithm is written (as in the modules, for example) which searches an array for some user-defined value, clientData. If clientData is stored in the array, it returns its array position, and if not found, it returns -1 again, just like in the modules). Assume the array to be searched has 100 data elements in it. (Check all that apply): NOTE: due to common off-by-one interpretations when counting such things, if your predicted answer is within one (+1 or -1) of a posted option below, you can assume your prediction and the choice you are looking at are equivalent and check that option.] O It might return to the client with an answer after only one comparison of data. It will always return with an answer in 10 or fewer comparisons of data. It may require as many as 100 comparisons of data before it returns. It will never require more than 100 comparisons of data before it returns. It will always return with an answer in 50 or fewer comparisons of data. Consider the following main method that produces a compiler error: public static void main(String[] args) GList score score.addFirst (1) score.addFirst(4); new GList(9); class GList score new GList (9); Replace the entire line to fix the error A binary search of a pre-sorted array of 256 elements would take (at most) how many comparisons? (Assume the search key is the key on which the array is sorted). [I allow for off-by-one errors in this problem, so if your prediction is within one of the posted choice below, choose it.] O 255 0 9 O 256 A program may create many objects/instances of the same class True False In which type of class methods is it typically necessary to filter bad arguments (either directly or indirectly with the help of validators) in order to protect private data of your class? A default constructor that takes no parameters. A constructor that takes parameters. A set0) method (non-constructor mutator). A display0 (or show0) method, which takes no parameters, intended to output the data of the class for the display. O A get0 method (non-constructor accessor) Here is a method of the SLList class public void addLast(int x) IntNode p- first; while(p.next != null) p p.next p.next-new IntNode (x, null); Consider the following linked list visualization: oJava Visualizer (beta: report a bug) Frames objects IntNode instance IntNode instanceIntNode instance IntNode instance item 100 next null main:9 item 5 item 10 item 15 Return void value VOi next next next SLList instance first Assume that you call the addLast method to add a new node. When the method completes, where will the new node be added to this list as it is visually represented above? After (to the right of) the IntNode with item 100 After (to the right of) the IntNode with item 5 O Before (to the left of) the IntNode with item 100 O Before (to the left of) the IntNode with item 5 A java.util ArrayList (check all that apply). is a type of pre-defined (in java.util) generic class. is a type of constructor. is a type of container O .can be accessed using bracket, [], notation identical to a simple array. If varA and varB are two instantiated reference variables of some class, then varB-varA copies all the data members from varA's object over to varB's object, maintaining the individuality of the two objects pointed-to by these two references. O True False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!