WorksheetsData Structures and Algorithm Quiz
Total questions: 50
Worksheet time: 25mins
Which of the following is a limitation of the Array-based List ADT?
Slow random access
Fixed maximum size
Expensive lookup
Poor memory locality
What is the time complexity for inserting an element at the beginning of a singly linked list?
O(n)
O(1)
O(log n)
O(n2)
Which linked list supports insertion at both ends with O(1) efficiency?
Singly linked
Circular singly linked
Doubly linked
Array
What is the main use of a multilist structure?
Binary search
Multiple linked lists sharing nodes
Recursive sorting
Array-based priority queue
Radix sort is best used for:
Sorting floating point numbers
Sorting integers with a fixed number of digits
Sorting linked lists
Sorting trees
Which data structure helps in evaluating postfix expressions?
Queue
Stack
Dequeue
Linked list
In which application is a queue used?
Undo feature in editors
Call center waiting management
Recursion
Directory traversal
A circular queue helps in:
Preventing queue overflow when space is available
Non-repeating dequeue
Infinite stack
Nested function calls
The operation to remove an item from the front of a queue is:
Dequeue
Pop
Enqueue
Insert
Dequeue data structure allows:
Removal only at rear
Insertion only at rear
Insertion and removal at both ends
Insertion only at front
Which data structure supports efficient searching, insertion, and deletion?
Binary Search Tree
Singly linked list
Stack
What is the maximum number of children a binary tree node can have?
1
2
3
Any
In which traversal of a binary tree is the root visited first?
Inorder
Preorder
Postorder
Level Order
An AVL tree always maintains:
Perfect balance
Height balance
No duplicates
Threaded pointers
Which of these is not a binary tree property?
Each node has at most two children
Root node has no parents
Node degree can be more than 2
Traversals can be recursive
Which algorithm is applied for constructing an expression tree from postfix expression?
Stack-based
Queue-based
List-based
BFS-based
Binary heaps are used for which abstract data type?
Priority queue
Binary search tree
Array list
Doubly linked list
What operation does not require tree balancing in AVL tree?
Insertion
Traversal
Deletion
Rotations
The shape of a binary heap is always:
Complete binary tree
Skewed binary tree
Unordered tree
Balanced tree with duplicates
The height of a binary tree with one node is:
0
1
2
-1
A B-tree of order m can have at most ___ children per node.
m
m-1
m+1
2m
The root node in a B-tree must have at least:
1 key
2 keys
m/2 keys
m keys
Which one of the following is not a representation of a graph?
Adjacency matrix
Adjacency list
Which traversal is guaranteed to visit every vertex exactly once in a connected graph?
BFS
DFS
Topological sort
Both a and b
What is the distinguishing property of a B+ tree?
All keys in leaves
Non-leaf nodes have data
No hierarchical structure
Duplicate keys in internal nodes
Topological sorting is possible only in:
Undirected graphs
Cyclic graphs
Connected graphs
DAGs
Which algorithm efficiently finds the shortest path in a weighted undirected graph with non-negative edges?
BFS
Dijkstra’s algorithm
Prim’s algorithm
Kruskal’s algorithm
Which minimum spanning tree algorithm works by adding edges in increasing cost order?
Dijkstra’s algorithm
Kruskal’s algorithm
Prim’s algorithm
Topological sort
The degree of a vertex in a graph is:
Number of edges incident to it
Number of vertices
Number of loops
None
An Euler circuit exists in a connected undirected graph if:
Each vertex has even degree
Graph is acyclic
At least one odd degree vertex
No cycles
Breadth-first traversal uses which data structure?
Stack
Queue
List
Heap
Which representation is most space-efficient for sparse graphs?
Incidence matrix
Adjacency matrix
Adjacency list
Edge list
Which traversal is suitable for detecting cycles in a graph?
Inorder
Level Order
Depth-first traversal
Preorder
Which of the following is a characteristic of a strongly connected directed graph?
There’s a path from every vertex to every vertex
All edges are bidirectional
Has a single vertex
Cannot have cycles
In a B+ tree, which level stores all data records?
Root
Leaf
Internal nodes
Random nodes
Which is not true of graphs?
Edges may be directed or undirected
Vertices can be isolated
Each edge must form a cycle
Weights may be assigned to edges
Topological sort is used for:
Scheduling tasks with dependencies
Shortest path
Spanning tree
Detecting cycles
The minimum number of edges for a connected undirected graph with n vertices is:
n-1
n
n+1
2n
Which traversal covers all vertices reachable from a source in graph?
BFS
Inorder traversal
AVL traversal
Heap traversal
Always choosing the smallest weight edge connecting to the tree
Sorting all edges
Removing large edges
Adding random edges
Merge sort works fastest when:
Data is already sorted
List size is large
Data is in random order
There are duplicate values
Binary search is not applicable when:
List is sorted
List is unsorted
Elements are unique
Only integers are stored
Which sorting algorithm is in-place and not stable?
Insertion sort
Selection sort
Merge sort
Bubble sort
Which sorting method doesn’t use comparisons?
Bubble sort
Insertion sort
Counting sort
Selection sort
Open addressing resolves hashing collisions by:
Storing colliding values in new buckets by re-probing
Chaining values
Sorting the table
Creating a new hash function
A good hash function should:
Map all keys to the same value
Minimize collisions
Be slow
Ignore key input
Rehashing the hash table is needed when:
The load factor is too high
Table is empty
In separate chaining, collisions in hash tables are resolved by:
Linear search
Using buckets as linked lists
Inserting at random
Resizing the array
Quick sort’s average case complexity is:
O(n)
O(n log n)
O(n2)
O(log n)
In separate chaining, collisions in hash tables are resolved by:
a) Linear search
b) Using buckets as linked lists
c) Inserting at random
d) Resizing the array
