Cumulated Quizzes(DataStructures)
Hashing which of the following data types requires a simple folding technique (no exponentiation of terms) based on the author's examples in the textbook (all that apply)? A. byte B. short C. int D. long E. float F. double G. String
long
Match the Graph representation on the left with the correct description on the right: Adjacency Matrix
A table containing 0 or 1 in each position.
________ is a data structure to store data in sequential order. A. A List B. A Set C. A Stack D. A Queue
A. A List
A graph in which each edge has only one direction is called a.... A. Digraph B. List C. Tree D. Korean Drama
A. Digraph
A Graph G is a pair, G = (V,E), where V is a finite, nonempty set called the set of vertices, and E is what? A. E ⊆ V×V B. E ⊆ V*V C. E ⊆ V+V D. E ∊ K-드라마
A. E ⊆ V×V
Which of the following Collection classes does not store the entries in any particular order? A. HashSet B. LinkedHashSet C. TreeSet
A. HashSet
Which of the following collision resolution techniques is/are of the open addressing type (all that apply)? A. Linear Probing B. Quadratic Probing C. Double Hashing D. Chaining
A. Linear Probing B. Quadratic Probing C. Double Hashing
Which of the following are not concrete classes in the Java Collections API (all that apply): A. List B. Stack C. Queue D. Set
A. List C. Queue D. Set
Which of the following statements is correct: A. Object-Oriented Programs are Structured. B. Structured Programs are Object Oriented. C. Java is Structured but not Object Oriented. D. Java is Object Oriented but not Structured.
A. Object-Oriented Programs are Structured.
Which of the following statements about recursive algorithms are true (all that apply): A. They always have a base case. B. They can have only one base case. C. They can have more than one base case. D. They always have a general case. E. They can have more than one general case.
A. They always have a base case. C. They can have more than one base case. D. They always have a general case.
Match the Sort types with their corresponding Big-O expected time efficiencies: Please note, Canvas apparently does not support subscripts in the answers section to quiz questions; therefore, log2 n → log n among the choices. Merge Sort
Always n * log n
Match the Sort types with their corresponding Big-O expected time efficiencies: Please note, Canvas apparently does not support subscripts in the answers section to quiz questions; therefore, log2 n → log n among the choices. Selection Sort
Always n²
Match the Graph representation on the left with the correct description on the right: Adjacency List
An array of linked-lists.
Which of the following collision resolution techniques either avoids or doesn't have the primary clustering problem (all that apply)? A. Linear Probing B. Quadratic Probing C. Double Hashing D. Chaining
B. Quadratic Probing C. Double Hashing D. Chaining
Which of the following Collection classes allows for traversing the members by their key value in a sorted order? A. TreeSet B. TreeMap C. LinkedHashMap
B. TreeMap
In black-box testing ____. A. You can not analyze the execution. B. You can not analyze the source code. C. You can not see the inputs. D. You cannot see the outputs.
B. You can not analyze the source code.
On an average, if an element is in the list, linear search searches _____. A. the whole list. B. half of the list. C. just the first element in the list. D. the entire list (n-1) times.
B. half of the list.
The source code formatting illustrated below is: public static void main (String[] args) { System.out.println("Hello, World."); } A. ASCII style. B. ANSI style. C. Allman style. D. Gangnam style
C. Allman style.
Which of the following Collection classes allows retrieving entries in the order they were last accessed? A. HashSet B. LinkedHashSet C. LinkedHashMap
C. LinkedHashMap
A variation on this collection type in the Java Collections API allows processing members by their priority: A. List B. Stack C. Queue D. Set
C. Queue
Which of the following Collection classes maintains the entries in the "natural" order as defined in the implementation of the Comparable interface for the members? A. HashSet B. LinkedHashSet C. TreeSet
C. TreeSet
A method is called Tail Recursive if ___. A. the return statement is the last line in the method. B. the return statement is not the last statement in the method. C. the the recursive call is that last action the method performs before returning. D. more statements in the method follow the recursive call.
C. the the recursive call is that last action the method performs before returning.
Analyzing algorithm efficiency is ________. A. to measure the actual execution time B. to estimate the execution time C. to estimate the growth function D. to determine the best-case execution time
C. to estimate the growth function
For a sorted list of 1024 elements, a binary search takes at most _______ comparisons. A. 512 B. 256 C. 128 D. 11
D. 11
Which data structure is appropriate to store patients seeking COVID-19 Vaccine shots in California in the first quarter of 2021? NOTE: For those that forgot, due to limited availability, healthy people were supposed to wait until those with "underlying medical conditions" got their vaccinations first. Oh... and of course Federal politicians get theirs before everyone! And if you are really paying attention, similar "availability protocols" and in place for Monkey-pox vaccinations. A. Stack B. Queue C. Any List (Array or Link based) D. A Queue implemented as a Heap
D. A Queue implemented as a Heap
Why is the analysis often for the worst case? A. Best-case is not representative. B. Average-case is not representative. C. Worst-case is most representative. D. Average-case is ideal, but difficult to determine due to the uncertain relative probabilities and distributions of various input instances for many problems.
D. Average-case is ideal, but difficult to determine due to the uncertain relative probabilities and distributions of various input instances for many problems.
As implemented in our textbook: MyArrayList is more efficient than MyLinkedList for the following operations: A. Insert/delete an element in the middle of the list. B. Insert/delete an element in the beginning of the list. C. Append an element at the end of the list. D. Retrieve an element at given the index.
D. Retrieve an element at given the index.
This collection type does not allow duplicates: A. List B. Stack C. Queue D. Set
D. Set
In order to use a Graph in the solution of certain real-world problems, we need to provide each edge with a certain property. What is that property always called (in Graphs) regardless of its actual value or type? A. Cost B. Length C. Speed D. Weight
D. Weight
When different input values are expected to produce the same output value, such testing cases are called ____. A. initial values. B. final values. C. boundary conditions. D. equivalency sets.
D. equivalency sets.
To improve the time-complexity of a search function over those based on key comparisons we need to use: A. sorted lists B. binary trees C. balanced search trees D. hashing
D. hashing
Given that inputs are all within acceptable ranges, the properties of the expected outputs are called ____. A. parameters. B. returns. C. pass-by-values D. post-conditions.
D. post-conditions.
Match the Sort types with their corresponding Big-O expected time efficiencies: Please note, Canvas apparently does not support subscripts in the answers section to quiz questions; therefore, log2 n → log n among the choices. Quick Sort
Usually n * log n but can be much worse under certain circumstances.
Match the Sort types with their corresponding Big-O expected time efficiencies: Please note, Canvas apparently does not support subscripts in the answers section to quiz questions; therefore, log2 n → log n among the choices. Insertion Sort
Usually n² but can be much better under certain circumstances.
Match the Graph traversal on the left with the correct description on the right: Breadth-first
Visits all closest vertices before any further ones.
Stack
Last one added is first one removed.
Match the Graph traversal on the left with the correct description on the right: Depth-first
Similar to pre-order traversal of binary tree.
Set
Stores a collection without duplicates in no order.
List
Stores and ordered collection including duplicates.
As implemented in our textbook: Suppose list1 is a MyArrayList and list2 is a MyLinkedList. Both contains 1 million double values. Analyze the following code: // A: while (list1.size() > 0) list1.remove(0); // B: while (list2.size() > 0) list2.remove(0); A. Code fragment A runs faster than code fragment B. B. Code fragment B runs faster than code fragment A. C. Code fragments A and B should run at about the same speed (based on Big-O analysis). D. Both contain logic errors because they produce infinite loops.
B. Code fragment B runs faster than code fragment A.
Under the best circumstances, this sorting algorithm can approach a Big-O time efficiency of n: A. Selection Sort B. Insertion Sort C. Quick Sort D. Merge Sort
B. Insertion Sort
Which of the following Collection classes maintains the entries in the order added? A. HashSet B. LinkedHashSet C. TreeSet
B. LinkedHashSet
The time complexity for the binary search algorithm in the text is ________. Note: The Quizzes section on Canvas does not accept UTF-8 subscripts in the answers; therefore, log₂(n) is being written as Log2(n). A. n Log2(n) B. Log2(n) C. n² D. n
B. Log2(n)
Priority Queue
Elements are added in any order but removed in ranked order.
Some problems cannot be solved with iteration but can be solved with recursion. True False
False
Match the Graph application on the left with the correct description on the right: Minimal Spanning Tree
Finds the minimally connected graph with the lowest total weight.
Match the Graph application on the left with the correct description on the right: Shortest Path
Finds the path with the lowest weight.
Queue
First one added is first one removed.
Match the Graph application on the left with the correct description on the right: Topological Order
Identifies a valid path through the vertices from one with no predecessors to one with no successors.