Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Hash Tables & Other Data Structures

Total questions: 35

Worksheet time: 18mins

Name
Class
Date
1.

Hashing gives each item

a)

A sequential address

b)

A logarithmic address

c)

No address

d)

A unique address

2.

A hash table is

a)

an abstract data structure

b)

an array

c)

an integer

d)

made of pine

3.

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

IF KEY = 5432 and numberOfSlots = 1000

Address = ?

a)

5

b)

432

c)

543

d)

5432

4.

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

a)

Knock

b)

Bang

c)

Collisions

d)

DoubleHash

5.

What is the status after adding 10

a)
b)
c)
d)
6.

What is the status after adding 7

a)
b)
c)
d)
7.

What does the term immutable mean?

a)

unable to be changed

b)

unable to speak

c)

can be modified

d)

can be increased in size

8.

Which data structure cannot have elements of different data types?

a)

Array

b)

Tuple

c)

Record

d)

Stack

e)

Queue

9.

In terms of data structures, what does mutable mean?

a)

A mutable structure is one which can only have data added to it

b)

A mutable structure is one which is fixed in size

c)

A mutable structure is one which allows data to be added, edited, deleted or moved

10.

What type of data structure is an array?

a)

Static and mutable

b)

Dynamic and immutable

c)

Static and immutable

11.

In terms of an array, what is an index?

a)

A value which points to a data element in an array

b)

The first element in an array

c)

A list of all the elements in an array

12.

Which mathematical function do all hashing algorithms use?

a)

MOD

b)

DIV

c)

EXP

d)

COS

e)

RAND

13.

In this binary tree, where would the new value "7" be placed?

a)
On the left "leaf" of "4"
b)
On the right "leaf" of "6"
c)
On the left "leaf" of "15"
d)
Over the top of the current number "5"
14.

Which word means storing data in sequence, next to each other?

a)

contiguous

b)

contrary

c)

quantitative

d)

immutable

15.

When a collision occurs with a hashing function, what is one method for dealing with the collisions?

a)

creating a new list at that index

b)

creating a new array

c)

creating a new hash table

d)

creating a new binary tree

16.

Which word describes a lot of collisions with using hashing?

a)

contiguous

b)

traffic

c)

clustering

d)

mutable

17.
What is returned by values[5]?
a)
9
b)
12
c)
6
d)
8
18.
Ordered set of a variable number of elements to which additions and deletions may be made 
a)
List
b)
Array
c)
Variables
d)
Constants
19.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

20.

Which symbol surrounds a Python dictionary?

a)

{

b)

(

c)

[

d)

:

21.

Which of these are operations of a stack?

a)

Push

b)

Add

c)

Remove

d)

Pop

22.

Which of these is not a data structure?

a)

Stack

b)

Array

c)

Integer

d)

List

23.

A stack is last in, "what" out?

(a)  

24.
A tree is composed of ____ connected by edges or lines.
a)
Fruit 
b)
Leaf Node
c)
Root Node
d)
Nodes
25.

What is the value of the ROOT node in this Tree?

a)

35

b)

24

c)

42

d)

20

26.

Consider the following operation performed on a stack of max size 5.


Push(1);

Pop();

Push(2);

Push(3);

Pop();

Push(4);

Pop();

Pop();

Push(5);


After the completion of all operation, the no of element present on stack are

a)

1

b)

3

c)

2

d)

4

27.

Records allow you to store more than one data type

a)

True

b)

False

28.

A hash table will generally take longer to search as more data is added

a)

True

b)

False

29.

A hash table can access the data directly, without having to traverse through previous links in the structure

a)

True

b)

False

30.

What is the goal of a hash table?

a)

To compare items in a data set

b)

To store all the data items

c)

To immediately find an item without comparing other items

d)

To implement a dictionary data structure

31.

What is a hashing function used for?

a)

To calculate the position of an item in a hash table

b)

To determine the size of a hash table

c)

To compare items in a data set

d)

To implement a dictionary data structure

32.

What is a collision in a hash table?

a)

When two data items have the same hash value

b)

When a hash table is too small to store all the data items

c)

When a hashing function takes too long to calculate

d)

When a hash table is empty

33.

What is a disadvantage of linear probing?

a)

It prevents other items from being stored in their correct location

b)

It requires a large amount of memory

c)

It results in a high number of collisions

d)

It is a slow method of resolving collisions

34.

What is chaining in a hash table?

a)

Storing items in a linked list

b)

Using a two-dimensional hash table

c)

Searching sequentially in an overflow table

d)

Finding an alternative position for items in the hash table

35.

What are the three basic operations that can be performed on a hash table?

a)

Adding a value, deleting a value, retrieving a value

b)

Sorting a value, searching a value, updating a value

c)

Copying a value, moving a value, renaming a value

d)

Creating a value, reading a value, updating a value