wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Chapter_23_9608

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.
Which are the pointers for a stack?
a)
TopOfStack pointer
b)
BaseOfStack pointer
c)
FrontOfStack pointer
d)
EndOfStack pointer
2.
A stack (choose all that applies)
a)
is a LIFO data structure
b)
has a push function and a pop function
c)
has two pointers: Top pointer and Base pointer
d)
has a O(1) - constant time complexity
e)
is a FIFO data structure
3.
the Top pointer of a stack
a)
points at the top item in the stack
b)
points at the free space above the stack
c)
points at the bottom item of the stack
d)
points at the free space below the end of the stack
4.
The Base pointer of a stack
a)
points at the top item in the stack
b)
points at the free space above the stack
c)
points at the bottom item of the stack
d)
points at the free space below the end of the stack
5.
A stack (choose all that applies)
a)
adds new items using push() to add to the top of the stack
b)
removes 1 item a time using pop(), from the top of the stack
c)
removes 1 item a time using pop(), from the base of the stack
6.
A queue (choose all that applies)
a)
is a FIFO data structure
b)
has a enqueue function and a dequeue function
c)
has two pointers: Front pointer and End pointer
d)
needs to shift all items forward after every removal/dequeue action
e)
is a LIFO data structure
7.
A circular queue (choose all that applies)
a)
is a FIFO data structure
b)
has a enqueue function and a dequeue function
c)
has two pointers: Front pointer and End pointer
d)
does NOT shift any items forward after every removal/dequeue action
e)
is a LIFO data structure
8.
A linked list (choose all that applies)
a)
has a node as an element of the list
b)
has a start pointer which is the address for the first node
c)
each node has a pointer to store the address for the next node, which can be NULL
d)
each node contains data item(s)
9.
The differences between an Array and a Linked List are: (choose all that applies)
a)
The elements in an Array are stored in consecutive addresses - in a contiguous block
b)
The elements in a Linked List are not required to be stored in consecutive addresses
c)
An array uses index to locate each element
d)
A linked list uses pointer to locate each element.
10.
A stack, a queue and an array are common in terms of: (choose all that applies)
a)
They are all linear lists.
b)
Their elements all occupy consecutive memory addresses.
11.
A pointer is (choose all that applies)
a)
a picture or icon
b)
a variable that stores the address of the node it points to
c)
a data item of the node
12.
A NULL pointer is (choose all that applies)
a)
a pointer that does not point to anything
b)
a variable with a value of NULL
13.
Can you write the pseudocode and Python code for INSERTING a node into a Linked List?
a)
Yes
b)
No
14.
Can you write the pseudocode and Python code for DELETING a node from a Linked List?
a)
Yes
b)
No
15.
Can you write the pseudocode and Python code for ACCESSING ALL the nodes in a Linked List?
a)
Yes
b)
No
16.
A binary tree (choose all that applies)
a)
can have a root node and leave nodes
b)
each node has two pointers: left and right pointers
c)
data items in a binary tree could be ordered - in certain order
d)
all binary trees are ordered
17.
Can you write the pseudocode and Python code for INSERTING a node into a Binary tree?
a)
Yes
b)
No
18.
Can you write the pseudocode and Python code for DELETING a node from a Binary tree?
a)
Yes
b)
No
19.
Can you write the pseudocode and Python code for ACCESSING ALL the nodes in a Binary tree?
a)
Yes
b)
No
20.

Hashing is (choose all that applies)

a)

to calculate an address from a key

b)

generating an integer value or values from a string of text using a mathematical function

c)

hash brown

d)

a mixture

21.
Hash table is (choose all that applies)
a)
an array holding a record in each element with the index calculated by a hashing function
b)
a table for working out the hash of each record
c)
a table to store the hash value only
22.
Hash collision is
a)
when two different keys produce the same hash value
b)
when tow different hash values from the same key
23.
These can be used to deal with hash collision: (choose all that applies)
a)
using neighbouring slots: perform a linear search from the hashed address to find an empty slot - open hashing
b)
chaining: create a linked list for collisions with start pointer at the hashed address
c)
using overflow areas: all collisions are stored in a separate overflow area, closed hashing.
d)
Replacing: store the new record in the hashed address directly
24.
Can you write the pseudocode and Python code for MOD (n+1) hashing ?
a)
Yes
b)
No
25.
Can you write the pseudocode and Python code for MOD (n+1) hashing collision handling ?
a)
Yes
b)
No
26.
Can you write the pseudocode and Python code for MOD (n+1) hashing to retrieve a record?
a)
Yes
b)
No
27.
A dictionary is a collection of key-value pairs.
a)
true
b)
false
c)
Not sure
28.
TYPE DictionaryEntry DECLARE key : String, DECLARE value : string ENDTYPE
a)
This is the pseudocode for defining a record type for a dictionary data item - a key-value pair
b)
This is the pseudocode for defining a dictionary
29.
DECLARE theDictionary[0 : 999] OF DictionaryEntry
a)
This is the pseudocode for defining a record type for a dictionary data item - a key-value pair
b)
This is the pseudocode for defining a dictionary
30.
DECLARE theDictionary[0 : 999] OF DictionaryEntry
a)
This dictionary has 1000 item capacity
b)
The key is 0 and the value is 999
31.
Can you write the pseudocode and Python code for DEFINING a dictionary?
a)
Yes
b)
No
32.
Can you write the pseudocode and Python code for INSERTING items into a dictionary?
a)
Yes
b)
No
33.
Can you write the pseudocode and Python code for SEARCHING a dictionary?
a)
Yes
b)
No
34.
x = [1, 2, 3, 4, 5,6,7]
a)
is an array
b)
is an array of integer type
c)
is a linear list
d)
is a linked list
e)
is a stack
35.
x=['a',"b", 'c', 'd']
a)
is an array
b)
is an array of string type
c)
is a linear list
d)
is a linked list
e)
is a stack
36.
x ={'a': 12 , 'b': 24, 'c':36}
a)
is a dictionary in Python
b)
is a linked list in Python
c)
is a linear list
d)
is an array
e)
is a stack
37.

d=dict()

d['a']='John'

d['b']='Sam'

print(d)


-- WHAT will be the output?

a)

{'a': 'John', 'b': 'Sam'}

b)

{'a', 'John', 'b', 'Sam'}

c)

{a: 'John', b: 'Sam'}

38.

x ={'a': 12 , 'b': 24, 'c':36}

print(x['a'])


WHAT WILL BE the output?

a)

12

b)

24

c)

36

d)

{'a': 12 , 'b': 24, 'c':36}

39.

x ={'a': 12 , 'b': 24, 'c':36}

print(x['c'])


WHAT WILL BE the output?

a)

12

b)

24

c)

36

d)

{'a': 12 , 'b': 24, 'c':36}

40.

x ={'a': 12 , 'b': 24, 'c':36}

x['a'] = 120

print(x['a'])


WHAT WILL BE the output?

a)

12

b)

24

c)

36

d)

{'a': 12 , 'b': 24, 'c':36}

e)

120