Question
Which statements about hashing collisions are true? Group of answer choices A. Double hashing is one of the collision resolution techniques used in open addressing
Which statements about hashing collisions are true?
Group of answer choices
A. Double hashing is one of the collision resolution techniques used in open addressing
B. Clustering elements is a technique used to optimize the retrieval from a hash table
C. Linear probing often results in clustering of elements
D. Quadratic probing helps to achieve clustering in separate chaining
E. Quadratic probing helps to prevent clustering in separate chaining
F. In separate chaining, elements that hash to the same index are stored in the same "bucket"
Q. 2
Which statements about hashings functions are correct?
Group of answer choices
A. A hashing function quarantees a unique output for each key
B. A hashing function stores an element in a hash table
C. A hashing function may map two or more elements with different keys to the same index in the hash table
D. The hashing function h(k) = k is used for direct addressing
E. A hashing function maps a key to an index in the hash table
Q. 3
Which of the following statements about arrays and array lists are correct?
Group of answer choices
A. When you create an array using ArrayList x = new ArrayList(10), x.size() is 10
B. When you create an array using new int[10], an array object is created with ten integers of value 0
C. When you create an array using new int[10], an array object is created with no values in the array
D. When you create an ArrayList using new ArrayList(), an ArrayList object is created with no elements in the ArrayList object
E. When you create an array using int[] x = new int[10], x.length is 10
Q.4
Analyze the following code and from the statements below select those that are true.
public class TwoRecursiveMethods { public static void main(String[] args) { System.out.println(f1(3)); System.out.println(f2(3, 0)); } public static int f1(int n) { if (n == 0) return 0; else { return n + f1(n - 1); } } public static int f2(int n, int result) { if (n == 0) return result; else return f2(n - 1, n + result); } }
Group of answer choices
A. For a non-negative input n and initial value of result = 0, f2 computes 0 + 1 + 2 + ... + n
B. For all negative inputs both f1 and f2 run infinitely and cause a StackOverflowError
C. Neither f1 nor f2 is tail recursive
E. f1 is tail recursion, but f2 is not
F. For a non-negative input n, f1 computes 0 + 1 + 2 + ... + n
G. f2 is tail recursion, but f1 is not
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started