WorksheetsUnderstanding Data Structures Quiz
Total questions: 24
Worksheet time: 15mins
Which data structure operates on a Last-In, First-Out (LIFO) principle?
Queue
Stack
Hash Table
Vector
What is the main difference between a stack and a queue?
Stack is FIFO, Queue is LIFO
Stack is LIFO, Queue is FIFO
Both are LIFO
Both are FIFO
Which operation removes the front element from a queue?
Pop
Dequeue
Push
Peek
In a binary tree, what is the maximum number of children a node can have?
1
2
3
4
Which traversal method visits the left subtree, then the root, then the right subtree in a binary tree?
Pre-order
In-order
Post-order
Level-order
What is the primary advantage of using a hash table?
Maintains order of elements
Fast data retrieval
Uses less memory
Easy to implement
Which data structure is best suited for implementing undo functionality in software?
Queue
Stack
Hash Table
Vector
What is the main benefit of a balanced binary search tree compared to an unbalanced one?
It uses less memory
It keeps data more organised for faster searching
It allows duplicate values
It is easier to implement
Which of the following is NOT a valid operation on a stack?
Push
Pop
Enqueue
Peek
What is the main purpose of a hash function in a hash table?
To sort data
To map keys to addresses
To compress data
To encrypt data
What are the nodes at the bottom of a tree called?
Parents
Children
Root
Leaves
Always undirected with no loops
Tree
Graph
Stack
Hash Table
What is a collision in a hash table?
When two keys map to the same index
When a key cannot be found
When the table is full
When the hash function fails
What type of queue allows certain elements to jump to the front?
(a)
Which traversal method visits the root node first in a binary tree?
In-order
Pre-order
Post-order
Level-order
Which of the following is NOT a property of a binary search tree?
Left child is less than parent
Right child is greater than parent
All nodes have two children
No duplicate values
When inserting an element into a hash table with a good hash function, what is the expected result?
The element is placed quickly at its calculated position
The element is always placed at the end
The element is sorted with others
The element is always placed at the start
What is the main advantage of using a list over an array?
Faster access
Dynamic resizing
Less memory usage
Easier sorting
Which operation adds an element to the end of a queue?
Push
Enqueue
Pop
Peek
In a graph, what is a cycle?
A path that starts and ends at the same vertex
A path that visits every vertex once
A path with no repeated vertices
A path with only one edge
Which of the following is NOT a valid use case for a hash table?
Storing unique keys
Fast lookup
Maintaining sorted order
Handling collisions
What is the parent of a node in a tree?
The node directly above it
The node directly below it
Any node in the tree
The root node
Apply the scalar of 2.5 to the following vector
(7, 3, 2, 8)
(a)
For convex combination, what constraint is applied to the values of What constraint is applied to the values of α and β?
