Data Structures :: Hashing

Home > Technical Aptitude > Data Structures > Hashing > General Questions

NA
SHSTTON
29
Solv. Corr.
38
Solv. In. Corr.
67
Attempted
0 M:0 S
Avg. Time

1 / 52

Choose the correct option.

If h is any hashing function and is used to hash n keys in to a table of size m, where n<=m, the expected number of collisions involving a particular key x is :

Aless than 1

Bless than n.

Cless than m.

Dless than n/2.

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
17
Solv. Corr.
55
Solv. In. Corr.
72
Attempted
0 M:0 S
Avg. Time

2 / 52

Choose the correct option.

The hash function is
H1(k) = k % 50.
In the case of collision, the hash function used is
H(k) = (H1(k) + M x H2(k)) % 50
where H1(k) = k % 50 and H2(k) = k % 20.
M is initialized to 0 and is incremented by 1 each time a collision occurs.
This could be categorized under which of the following collision detection technic

ALinear Probing

CRe-Hashing

DDouble Hashing

| | | Asked In Societe Generale |

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
42
Solv. Corr.
78
Solv. In. Corr.
120
Attempted
0 M:27 S
Avg. Time

3 / 52

Choose the correct option.

Which of these are core interfaces in the collection framework. Select the one correct answer.

ATree

BStack

CQueue

DMap

| | | Asked In Virtusa |

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
12
Solv. Corr.
5
Solv. In. Corr.
17
Attempted
0 M:0 S
Avg. Time

4 / 52

Choose the correct option.

Which of the following is used in hash tables to determine the index of any input record?

Ahash function

Chash chaining

Dhash tree

Explanation:

Hash table is an example of a data structure that is built for fast access of elements. Hash functions are used to determine the index of any input record in a hash table.

Workspace

NA
SHSTTON
10
Solv. Corr.
5
Solv. In. Corr.
15
Attempted
0 M:0 S
Avg. Time

5 / 52

Choose the correct option.

Which of the following technique stores data in the hash table itself in case of a collision?

CChaining using binary tree

| | | Asked In Societe Generale |

Explanation:

Open addressing is used to store data in the table itself in case of a collision. Whereas chaining stores data in a separate entity.

Workspace

NA
SHSTTON
16
Solv. Corr.
0
Solv. In. Corr.
16
Attempted
0 M:0 S
Avg. Time

6 / 52

Choose the correct option.

Hashing is the problem of finding an appropriate mapping of keys into addresses.

ATRUE

BFALSE

Explanation:

Hashing is a data structure which is used to locate data in a table based on a key value.

Workspace

NA
SHSTTON
11
Solv. Corr.
7
Solv. In. Corr.
18
Attempted
0 M:0 S
Avg. Time

7 / 52

Choose the correct option.

In a hash table of size 10, where is element 7 placed?

A6

B7

C6

D17

Explanation:

The hash location is defined as hash(f)= key mod table_size.
7 mod 10 gives 7. It is placed in 7th position.

Workspace

NA
SHSTTON
4
Solv. Corr.
10
Solv. In. Corr.
14
Attempted
0 M:0 S
Avg. Time

8 / 52

Choose the correct option.

What should be the load factor for separate chaining hashing?

A0.5

B1

C2

D1.5

Explanation:

For hashing using separate chaining method, the load factor should be maintained as 1. For open addressing method, it should not exceed 0.5.

Workspace

NA
SHSTTON
5
Solv. Corr.
6
Solv. In. Corr.
11
Attempted
0 M:0 S
Avg. Time

9 / 52

Choose the correct option.

Which of the following trait of a hash function is most desirable?

Ait should cause less collisions

Bit should cause more collisions

Cit should be easy to implement

Dit should occupy less space

Explanation:

Hash function calculates and returns the index for corresponding data. So the most important trait of a hash function is that it should cause a minimum number of collisions.

Workspace

NA
SHSTTON
10
Solv. Corr.
4
Solv. In. Corr.
14
Attempted
0 M:0 S
Avg. Time

10 / 52

Choose the correct option.

A hash table may become full in the case when we use open addressing.

ATRUE

BFALSE

Explanation:

A hash table may become full in the case when we use open addressing. But when we use separate chaining it does not happen.

Workspace