wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Hash

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

If a list of items is in random order use a

a)

Binary search

b)

Linear Seach

2.

Hashing gives each item

a)

A sequential address

b)

A logarithmic address

c)

No address

d)

A unique address

3.

A hash table is

a)

an abstract data structure

b)

an array

c)

an integer

d)

made of pine

4.

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

IF KEY = 5432 and numberOfSlots = 1000

Address = ?

a)

5

b)

432

c)

543

d)

5432

5.

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

IF KEY = 5432 and numberOfSlots = 100

Address = ?

a)

5

b)

4

c)

32

d)

5432

6.

when an algorithm generates the same address for different primary keys it is known as

a)

Knock

b)

Bang

c)

Collisions

d)

DoubleHash

7.

a synonym is

a)

a word bank

b)

a key

c)

a collision

d)

a list

8.

What is the status after adding 10

a)
b)
c)
d)
9.

What is the status after adding 7

a)
b)
c)
d)
10.

Divide the item into equal-size pieces

Add the pieces together

Perform the mod step to get an address

Which hashing method does this describe

a)

folding method

b)

alphanumeric

c)

mid-square

d)

mod

11.
Which data structure uses hashing to store information with constant lookup time?
a)
Hash table
b)
1D Array
c)
Linked List
d)
2D Array
e)
Stack
12.

What is the load factor?

a)

Average array size

b)

Average key size

c)

Average chain length

d)

Average hash table length

13.

In simple chaining, what data structure is appropriate?

a)

Singly linked list

b)

Doubly linked list

c)

Circular linked list

d)

Binary trees

14.

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

15.

Which of the following is not a collision resolution technique?

a)

Separate chaining

b)

Linear probing

c)

Quadratic probing

d)

Hashing

16.

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

a)

True

b)

False

17.

A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown above.


Which one of the following choices gives a possible order in which the key values could have been inserted in the table?

a)

46, 42, 34, 52, 23, 33

b)

34, 42, 23, 52, 33, 46

c)

46, 34, 42, 23, 52, 33

d)

42, 46, 33, 23, 34, 52

18.

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

19.

What is the worst case search time of a hashing using separate chaining algorithm?

a)

O(N log N)

b)

O(N)

c)

O(N^2)

d)

O(N^3)

20.

Which of the following statement(s) is TRUE?

1) A hash function takes a message of arbitrary length and generates a fixed length code.

2) A hash function takes a message of fixed length and generates a code of variable length.

3) A hash function may give the same hash value for distinct messages.

a)

1 only

b)

1 & 3 only

c)

2 & 3 only

d)

3 only