Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Hash Table in C

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

If our function is X % 10, where we would put 392?

a)
2
b)

9

c)

3

d)

0

2.

If our function is X % 5, where we would put 63?

(a)  

3.

Using chaining, how many list items would be have to search through if we are searching for 120?

a)

3

b)

1

c)

2

d)

0

4.

If our hash function is (x+2) % 9, where would 66 be stored?

a)

6

b)

3

c)

5

d)

2

5.

Hashing gives each item

a)

A sequential address

b)

A logarithmic address

c)

No address

d)

A unique address

6.

Address <----- key MOD(numberOfSlots)

IF KEY = 5432 and numberOfSlots = 100

Address = ?

a)

5

b)

4

c)

32

d)

5432

7.

What is the status after adding 10

a)
b)
c)
d)
8.

What is the status after adding 7

a)
b)
c)
d)
9.

The case in which a key other than the desired one is kept at the identified location is called?

a)

Hashing

b)

Collision

c)

Chaining

d)

Open addressing

10.

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

a)

i only

b)

ii only

c)

i and ii only

d)

iii or iv