NEW
Font size
WorksheetsStacks, Queues, Trees, and Graphs Quiz
Total questions: 50
Worksheet time: 25mins
What is a stack based on?
FIFO principle
LIFO principle
Random access
Priority order
Which operation adds an element to the stack?
Push
Pop
Peek
Enqueue
Which operation removes the top element from a stack?
Pop
Push
Peek
Enqueue
What is the primary application of stacks?
CPU scheduling
Expression evaluation
Shortest path algorithms
Network routing
Which operation adds an element to a queue?
Dequeue
Enqueue
Pop
Peek
Which operation removes an element from a queue?
Enqueue
Pop
Dequeue
Peek
A queue works on which principle?
LIFO
FIFO
Random access
Last priority
Which data structure is used to manage function calls in recursion?
Queue
Stack
Graph
Tree
Circular queues solve which problem of linear queues?
Stack overflow
Queue underflow
Wasted memory space
Binary search
Which of the following is an application of queues?
Undo operation in editors
CPU scheduling
Parenthesis matching
Expression evaluation
What is a tree in data structures?
A non-linear hierarchical structure
A linear structure
A graph with cycles
A sequential structure
In a binary tree, each node has at most how many children?
1
2
3
4
In a binary search tree (BST), the left child is always:
Smaller than the parent
Greater than the parent
Equal to the parent
Random
In a BST, the right child is always:
Smaller than the parent
Greater than the parent
Equal to the parent
Random
Which traversal method visits nodes in sorted order in a BST?
Preorder
Postorder
Inorder
Level order
What is the root of a tree?
The bottom node
The topmost node
A leaf node
A sibling node
Which tree traversal visits root first, then left and right subtrees?
Inorder
Preorder
Postorder
Level order
Which tree traversal visits left, right, then root?
Preorder
Inorder
Postorder
Level order
Which node in a tree has no children?
Root
Internal node
Leaf node
Parent node
Which traversal is also called Depth-First Search (DFS) in trees?
Preorder, Inorder, Postorder
Level order
Breadth-First
Random
What is a heap?
A special binary tree
A linked list
A graph
A queue
In a max-heap, the root node is always:
The smallest element
The largest element
Random
Equal to children
In a min-heap, the root node is always:
The largest element
The smallest element
Equal to children
Random
Priority queues are often implemented using:
Linked list
Heap
Stack
Array only
Which is an application of heaps?
Sorting (Heap Sort)
Expression evaluation
Network protocols
DFS traversal
What is the time complexity to insert into a heap?
O(1)
O(log n)
O(n)
O(n²)
Which operation retrieves the highest priority element in a max-heap?
Delete root
Insert
Peek root
Swap
Which operation maintains heap structure after deletion?
Re-heapify
Insert
Traverse
Rotate
A priority queue gives preference to:
First entered data
Data with highest priority
Last entered data
Random choice
Which sorting algorithm uses heap?
Merge sort
Quick sort
Heap sort
Bubble sort
What is a graph in data structures?
A set of nodes and edges
A tree
A queue
A stack
In a graph, nodes are called:
Roots
Vertices
Edges
Leafs
In a graph, connections are called:
Vertices
Edges
Roots
Levels
A graph with no cycles is called:
Cyclic graph
Acyclic graph
Weighted graph
Directed graph
A graph where edges have directions is called:
Directed graph
Undirected graph
Weighted graph
Tree
A graph where edges have weights is called:
Directed graph
Weighted graph
Undirected graph
Heap
Which algorithm explores nodes level by level?
DFS
BFS
Dijkstra
Bellman-Ford
Which algorithm explores as far as possible along one branch?
BFS
DFS
Dijkstra
Kruskal
Which data structure is used in BFS?
Stack
Queue
Heap
Tree
Which data structure is used in DFS?
Queue
Stack
Heap
Linked list
Which algorithm finds the shortest path in weighted graphs?
BFS
DFS
Dijkstra
Kruskal
Which graph algorithm is used in minimum spanning tree (MST)?
BFS
DFS
Kruskal or Prim's
Bellman-Ford
BFS is also known as:
Depth-first traversal
Breadth-first traversal
Shortest path algorithm
Priority traversal
DFS is also known as:
Level order traversal
Depth-first traversal
Shortest path algorithm
Priority traversal
What is the time complexity of BFS?
O(V + E)
O(V²)
O(E log V)
O(V log E)
What is the time complexity of DFS?
O(V + E)
O(V²)
O(E log V)
O(V log E)
Which graph representation uses adjacency list?
Array only
Linked lists for neighbors
2D matrix
Trees
Which graph representation uses adjacency matrix?
2D array
Linked list
Tree
Heap
Which traversal guarantees visiting all vertices in a connected graph?
BFS or DFS
Heap sort
Queue traversal
Dijkstra
Which graph algorithm is widely used in GPS navigation systems?
BFS
DFS
Dijkstra
Heap sort
