Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

NEW 1.4.2 Data Structures

Total questions: 39

Worksheet time: 20mins

Name
Class
Date
1.
The following code: Print(Animal(4,1)) outputs the string, 'Dog'. However, the code: Animal(4,1)='Cat' produces an error. Why could this be?
a)
Animal has not been declared
b)
Animal is a variable
c)
'Cat' is not a string
d)
Animal is a tuple
2.
One of the differences between stacks and queues is:
a)
A stack is dynamic but a queue is static
b)
A stack can hold any type of data but a queue cannot
c)
A stack has one pointer, a queue has two
d)
A stack has two pointers, a queue has one
3.
The data structure used to store return addresses and local variables when a function is executing is a:
a)
Stack
b)
Dictionary
c)
Queue
d)
Graph
4.
What is a tuple?
a)
An immutable list
b)
A function of a class
c)
A mutable list
d)
An array of characters to create a string
5.
A list is an example of which type of data structure?
a)
Undirected
b)
Directed
c)
Static
d)
Dynamic
6.
The data structure used to handle interrupts is a:
a)
Stack
b)
Graph
c)
Dictionary
d)
Queue
7.
Sarah is making a version of a board game called Othello which is played on an 8x8 grid. Which data structure should Sarah use to store the colour of the counters in each space to make her algorithms for the game most efficient?
a)
Binary tree
b)
List
c)
Array
d)
Graph
8.
A queue contains the following data: A>B>C>D. The item D was the first to enter the structure. What is the state of the structure after E is enqueued?
a)
A>B>C>E
b)
A>B>C>D>E
c)
E>B>C>D
d)
E>A>B>C>D
9.
The data structure used to store process blocks in a round robin scheduling algorithm is a:
a)
Stack
b)
Queue
c)
Dictionary
d)
Graph
10.
The following code: Print(Animal(4,1)) outputs the string, 'Dog'. However, the code: Animal(4,1)='Cat' produces an error. Why could this be?
a)
Animal is a variable
b)
Animal is a tuple
c)
'Cat' is not a string
d)
Animal has not been declared
11.
A hash table is used when you want
a)
To traverse the data
b)
To create a one-way function
c)
Immediate access to data
d)
To perform a linear search on the data
12.
A linked list data structure is used to maintain the order of items in a list. The linked list contains the data: A>C>E>G. What happens when D is added to the linked list?
a)
C points to D and D points to C
b)
G points to D
c)
C points to D and D points to E
d)
D points to A
13.
Which register is used to access a given element of an array?
a)
Memory data register
b)
Program counter
c)
Index register
d)
Interrupt register
14.
A network printer uses spooling to hold print jobs waiting to print from many users. Which data structure would be most suitable for storing the print jobs?
a)
Dictionary
b)
Queue
c)
Stack
d)
Graph
15.
Consider this command: print(board[3,2]). What is the number 3 in this command?
a)
The number of items in the array
b)
A list
c)
An index
d)
The data in the board array
16.
A stack is an example of a:
a)
First in first out structure (FIFO)
b)
Last in first out structure (LIFO)
c)
Any in any out structure (AIAO)
d)
Last in last out structure (LILO)
17.
What data structure can be described as, 'data structure which has zero, one or two children from each node'?
a)
Linked list
b)
Queue
c)
Stack
d)
Binary tree
18.
Before data is added (pushed) to a stack, what should be checked first?
a)
The data is not already in the stack
b)
The pointer is an integer
c)
Stack underflow
d)
Stack overflow
19.
A stack contains the following data: A>B>C>D. The item D is the last one to enter the structure. What is the state of the structure after the following operation: pop, pop?
a)
A>B
b)
A>B>C
c)
A>B>C>D
d)
A
20.
What data structure can be described as, 'data can usually be found immediately by calculating the position of the item from a key field'?
a)
Graph
b)
Queue
c)
Stack
d)
Hash table
21.
An undirected graph is one where two nodes are connected:
a)
in one direction
b)
to all other nodes
c)
in both directions
d)
to no other nodes
22.
Consider this command: print(board[3,2]). What type of data structure is board?
a)
Boolean
b)
Record
c)
String
d)
Array
23.
A buffer is used in data transfer between two devices operating at different speeds. For example between a server and client in video transfer over the internet. Which data structure should data be held in before being shown to the user?
a)
Graph
b)
Stack
c)
Dictionary
d)
Queue
24.
A queue is an example of a:
a)
Any in any out structure (AIAO)
b)
Last in first out structure (LIFO)
c)
First in first out structure (FIFO)
d)
Last in last out structure (LILO)
25.
A circular queue is implemented using an array of 6 elements, 0-5. The front pointer is 2, the back pointer is 5. What is the value of the back pointer when a new item is enqueued?
a)
6
b)
1
c)
3
26.
A directed graph is one where two nodes are connected:
a)
in both directions
b)
in one direction
c)
to all other nodes
d)
to no other nodes
27.
Before data is removed (popped) from a stack, what should be checked first?
a)
Stack overflow
b)
The data is not already in the stack
c)
Stack underflow
d)
The pointer is an integer
28.
Which data structure can be described as, 'A data structure consisting of nodes and edges'?
a)
Stack
b)
Linked List
c)
Queue
d)
Graph
29.
What data structure can be described as, 'The last data item to enter the data structure is the first to leave'?
a)
Linked list
b)
Queue
c)
Stack
d)
Hash table
30.
A stack is an example of which type of data structure?
a)
Dynamic
b)
Static
c)
Undirected
d)
Directed
31.
A queue is an example of which type of data structure?
a)
Undirected
b)
Static
c)
Dynamic
d)
Directed
32.
An array is an example of which type of data structure?
a)
Directed
b)
Dynamic
c)
Static
d)
Undirected
33.
Arrays or lists have data and:
a)
A field name
b)
An iteration
c)
An index
d)
A file
34.
Which data structure is being described as, 'Data structure used to maintain the order of items in a list'?
a)
Linked list
b)
Graph
c)
Stack
d)
Hash table
35.
A stack contains the following data: A>B>C>D. The item D is the last one to enter the structure. What is the state of the structure after the following operation: push E?
a)
A>B>C>E
b)
E>A>B>C>D
c)
E>B>C>D
d)
A>B>C>D>E
36.
How is a binary tree different to a graph structure?
a)
Each node can only have up to two children
b)
Each node always has two children
c)
Each node has more than two children
d)
It uses traversal algorithms to output the data.
37.
What data structure can be described as, 'a collection of fields, possibly of different data types, typically in fixed number and sequence'?
a)
Variable
b)
Array
c)
List
d)
Record
38.
Amir is creating a computer game where the player has an inventory of items. An example of an item is, 'torch'. There is no limit to the number of items in the inventory. Which data structure should he use to store this data in order to minimise the memory footprint?
a)
List
b)
Array
c)
Integer
d)
Variable
39.
What data structure can be described as, 'the first data item to enter the data structure is the first to leave'?
a)
Hash table
b)
Linked list
c)
Queue
d)
Stack