Font size
WorksheetsAQA Data Structures and algorithms
Total questions: 78
Worksheet time: 45mins
What is meant by 'declaring' an array?
Create an array in a program, specifying its name and size
creating a program, specifying its size
create a program, specifying its name
create an array to assign to a Selection process
scores = [5,7,0,10,8,3,7,3]
Which value will be found using the following statement:
print(scores[2])
5
7
0
10
What is the name given to a number that corresponds to the location of an item of data in an array?
Initial
Primary
Index
Identifier
Arrays have a fixed number of items.
True or False
True
False
Arrays can have different data types?
True or False?
True
False
Which type of array is the following example?
score = [5,7,0,10,8,3,7,3]
1D
2D
3D
4D
How may index numbers are used in accessing a 2D array?
1
2
3
4
What is the name given to an abstract representation of how data is stored in a 2D array?
Record
File
Field
Table
What is the position of the name 'Paula' in the following list:
names = ["Paul","Pranav","Paula","Prea"]
0
1
2
3
In the following list, which item has the index number 3?
["John", "Harry", "Jesse", "John", "Jairus", "Hamza"]
"Jairus"
"Harry"
"Jesse"
"John"
What is the number held in the root node?
(a)
does not have any more nodes below
(a)
Queues implement which mechanism?
LIFO
FIFO
FILO
LILO
A Queue can only store 6 data items. The Queue is sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Front" pointer point?
0
1
2
3
A Queue can only store 6 data items. The Queue is sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Rear" pointer point?
0
1
2
3
A Queue can only store 6 data items. The Queue is sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Front" pointer point if a deQueue operation is performed.
Bert
Cynthia
Cedric
Albert
What is an advantage of a circular queue?
Free space can be reused
Easy to program
Gives preference to important items
It is static
What is a data structure where the first item added is the first item removed?
Queue
Stack
Char
Integer
Boolean
What is a method of storing data where the amount of data stored (and memory used to store it) will vary as the program is being run?
Static data structure
Dynamic data structure
Heap
Encapsulation
What is a portion of memory from which space is automatically allocated or de-allocated as required?
Static data structure
Dynamic data structure
Heap
Encapsulation
What is a variation of a FIFO structure where some data may leave out a sequence where it has a higher priority than other data items?
Linear queue
Circular queue
Priority queue
Heap
If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?
ABCD
DCBA
ABDC
DCAB
A circular queue is implemented using an array of size 10. The array index starts with 0, front is 6, and rear is 9. The insertion of next element takes place at the array index.
7
0
9
insertion not possible
What is a stack?
A data structure that adds the last added data item.
A data structure that increases data items first.
Data structure that removes the last added data item first
A data structure that multiplies data items
What two operations do stacks require?
Push
Draw
Stretch
Drag
Pop
If you have a stack containing 'A' 'D' 'G' . What will happen if you push 'C' into the stack?
'C' Will be added on top of the stack
'C' Will be added from the bottom of the stack
'C' Will be removed from the stack
'C' Will not be added to the stack
A stack containing 'Dog' 'Cat' & 'Rat' . What will happen if you carry out a pop operation on the stack ?
Noting
Cat will be removed
Dog will be removed
Rat will be removed
If you carry out a pop operation on this stack what will you be left with?
What will happen if you carry out a push operation with the word 'Bill'?
What are Stacks Used For?
Type in data from keyboard
To remove data
To stack information
To keep track of a sequence of operations
A common example of a queue operation is...
Write queue
Do queue
Print queue
Cyber queue
Which of the following is not a style of graph traversal in computing?
Breadth-First
Depth-First
Height-First
Graph traversal is used to find the ______ route to visit all nodes in a network
Shortest
Best
Longest
Most secure
Which method of graph traversal makes use of a stack?
Depth-First
Breadth-First
Which method of graph traversal makes use of a queue?
Depth-First
Breadth-First
Which method of graph traversal continues to visit the first neighbour of each node before backtracking and beginning the next route?
Depth-First
Breadth-First
Which method of graph traversal visits all neighbours of one node before moving on to further nodes?
Depth-First
Breadth-First
Which order of traversal is correct using depth-first?
A B C G D E F
A B D C E C G
Which of the following beginnings to a graph traversal would not be correct for depth-first?
A B C G
A D F
A E D F
A B D C
Which order of traversal is correct using breadth-first?
A B D E C F G
A B C G D E F
Which of the following beginnings to a graph traversal would not be correct for breadth-first?
A B D E
A E D B
A D B E
A D F B
Does Breadth-first search use a queue or a stack?
Stack
Queue
Both
neither
Which of these tree traversal methods is used to output the contents of a binary tree in ascending order?
Pre-Order
In-Order
Post-Order
Monastic Orders
A list must be in order for a Binary search to take place
True
False
The ____ of a Binary Search Tree starts by visiting the current node, then its left child node and then its right child node.
Pre-Order Traversal
In-Order Traversal
Post-Order Traversal
Linear Order Traversal
What is the following expression an example of?
3 + 4
Infix expression
Postfix expression
Afterfix expression
Between expression
What is the following expression an example of?
3 4 +
Infix expression
Postfix expression
Afterfix expression
Between expression
What is the postfix equivalent of the following infix expression?
5 + 6
+ 5 6
5 6 +
6 + 5
6 + 5 +
What is the postfix equivalent of the following infix expression?
5 + 6
+ 5 6
5 6 +
6 + 5
6 + 5 +
What is the infix equivalent for the following postfix expression?
3 5 6 + *
5 + 6 * 3
5 + (3 * 6)
(5 + 6) * 3
5 (+ 6 * 3)
What data structure can be used with postfix expressions?
Queue
Hash Table
Vector
Stack
Which of the following data structures is a LIFO data structure?
hash table
queue
stack
tree
Which of the the following properties would mean that a graph is not a tree?
unweighted
undirected
cyclical
acyclical
What is a characteristic feature of a hash algorithm?
It increases the size of the original file
It's encryption cannot be decrypted
It can easily be reversed
It makes files unreadable
What is a major requirement of a hash algorithm?
It must be fast
It must be colorful
It must be reversible
It must be infinite
What does the term 'hash collision' refer to?
A hash losing its data
A hash algorithm failing
Two different files having the same hash
Two hashes running into each other
What is the significance of a unique hash value?
It ensures data can be easily decrypted
It prevents unauthorized access to the data
It signifies that the data has not been altered
It makes the hash function reversible
What would be a consequence of a hash collision?
Increased security of the hash algorithm
Decreased time to compute the hash
Potential compromise of data integrity
Improved efficiency of data retrieval
What is a hashing function used for?
To calculate the position of an item in a hash table
To determine the size of a hash table
To compare items in a data set
To implement a dictionary data structure
What is rehashing in a hash table?
Finding an alternative position for items in the hash table
Using a two-dimensional hash table
Storing items in a linked list
Searching sequentially in an overflow table
What is chaining in a hash table?
Storing items in a linked list
Using a two-dimensional hash table
Searching sequentially in an overflow table
Finding an alternative position for items in the hash table
Hashing gives each item
A sequential address
A logarithmic address
No address
A unique address
address = key MOD(numberOfSlots)
If key = 5432 and numberOfSlots = 1000
address = ?
5
432
543
5432
What is the status after adding 10
What is the status after adding 7
Which word means storing data in sequence, next to each other?
Contiguous
Contrary
Quantitative
Non-adjacent
What are you aiming to avoid when creating a suitable method for dealing with collisions in a hash table?
Clustering
Merging
Cluttering
Address <----- key MOD(numberOfSlots)
IF KEY = 5432 and numberOfSlots = 100
Address = ?
5
4
32
5432
