46, 42, 34, 52, 23, 33
|
|
34, 42, 23, 52, 33, 46
|
|
46, 34, 42, 23, 52, 33
|
|
42, 46, 33, 23, 34, 52
|
Q2) Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4)mod7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that ‘_’ denotes an empty location in the table.
8, _, _, _, _, _, 10
|
|
1, 8, 10, _, _, _, 3
|
|
1, _, _, _, _, _,3
|
|
1, 10, 8, _, _, _, 3
|
Q3) Given the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199) and the hash function x mod 10, which of the following statements are true? i. 9679, 1989, 4199 hash to the same value ii. 1471, 6171 has to the same value iii. All elements hash to the same value iv. Each element hashes to a different value (GATE CS 2004)
i only
|
|
ii only
|
|
i and ii only
|
|
iii or iv
|
Q4) Consider a hash table with 100 slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first 3 slots are unfilled after the first 3 insertions?
(97 × 97 × 97)/100^3
|
|
(99 × 98 × 97)/100^3
|
|
(97 × 96 × 95)/100^3
|
|
(97 × 96 × 95)/(3! × 100^3)
|
Q5) Which of the following statement(s) is TRUE?
- A hash function takes a message of arbitrary length and generates a fixed length code.
- A hash function takes a message of fixed length and generates a code of variable length.
- A hash function may give the same hash value for distinct messages.
I only
|
|
II and III only
|
|
I and III only
|
|
II only
|
Q6) How many different insertion sequences of the key values using the same hash function and linear probing will result in the hash table shown above?
10
|
|
20
|
|
30
|
|
40
|
Q7) Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020?
h(i) =i^2 mod 10
|
|
h(i) =i^3 mod 10
|
|
h(i) = (11 ∗ i^2) mod 10
|
|
h(i) = (12 ∗ i) mod 10
|
Q8) Given a hash table T with 25 slots that stores 2000 elements, the load factor α for T is __________
80
|
|
0.0125
|
|
8000
|
|
1.25
|
Q9) A program P reads in 500 integers in the range [0..100] exepresenting the scores of 500 students. It then prints the frequency of each score above 50. What would be the best way for P to store the frequencies? (GATE CS 2005)
An array of 50 numbers
|
|
An array of 100 numbers
|
|
An array of 500 numbers
|
|
A dynamically allocated array of 550 numbers
|
Q10)
The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is
(A) (n) (B) (logn) (C) (log*n) (D) (n)
A
|
|
B
|
|
C
|
|
D
|