wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

pythonDS

Total questions: 15

Worksheet time: 7mins

Name
Class
Date
1.

Which the following simple searching

a)

Stack

b)

Queue

c)

Sequence searching

d)

Binary searching

2.

Based on binary searching, how to get middle key

a)

last index/2

b)

(last index + initial index)/2

c)

(last index - initial index)/2

d)

(last index + initial index) % 2

3.

In simple chaining, what data structure is appropriate?

a)

Singly linked list

b)

Doubly linked list

c)

Circular linked list

d)

Binary trees

4.

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

5.

Which of the following is not a collision resolution technique?

a)

Separate chaining

b)

Linear probing

c)

Quadratic probing

d)

Hashing

6.

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

7.

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?

a)

h(i) =i^2 mod 10

b)

h(i) =i^3 mod 10

c)

h(i) = (11 ∗ i^2) mod 10

d)

h(i) = (12 ∗ i) mod 10

8.

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

9.

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)

10.

What is the advantage of using a doubly linked list for chaining over singly linked list?

a)

it takes less memory

b)

it is easy to implement

c)

it makes the process of insertion and deletion faster

d)

it causes less collisions

11.

Separate chaining is easier to implement as compared to open addressing .

a)

True

b)

False

12.

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

a)

it should cause less collisions

b)

it should cause more collisions

c)

it should occupy less space

d)

it should be easy to implement

13.

Given a hash table T with 25 slots that stores 2000 elements, the load factor α for T is

a)

80

b)

0.0125

c)

8000

d)

1.25

14.

A hash table with ten buckets with one slot per bucket is shown in the following figure. The symbols S1 to S7 initially entered using a hashing function with linear probing.The maximum number of comparisons needed in searching an item that is not present is

a)

3

b)

4

c)

5

d)

6

15.

The characters of the string K R P C S N Y T J M are inserted into a hash table of size 10 using hash function

h(x) = ((ord(x) - ord(A) + 1)) mod 10

(here ord(A) = 1, ord(B)=2, so on)

If linear probing is used to resolve collisions, then the following insertion causes collision

a)

Y

b)

C

c)

M

d)

P