NEW
Font size
WorksheetsCode Nascar
Total questions: 30
Worksheet time: 8hrs 30mins
Which data structure gives O(1) time for both get() and put() in an LRU cache?
Queue
HashMap
Doubly Linked List
HashMap + Doubly Linked List
Which algorithm is used for finding Strongly Connected Components (SCC)?
Prim’s
Kosaraju’s Algorithm
Kruskal’s
Topological Sort
Which algorithm can be used for detecting bridges in a graph?
BFS
Tarjan's Algorithm
Dijkstra
Prim
Which of the following is not an application of stack?
Infix to postfix conversion
Function call management
BFS traversal
Expression evaluation
The minimum number of edges in a connected undirected graph with n vertices is:
n
n-1
n+1
2n
Which of the following sorting algorithms is stable?
QuickSort
MergeSort
HeapSort
Selection Sort
Which of the following data structures is best for implementing a priority queue?
Stack
Queue
Heap
Tree
What is the time complexity of inserting an element in a heap?
O(1)
O(log n)
O(n)
O(n²)
Which of the following is not true about a Red-Black Tree?
It is a binary search tree
It is balanced
It requires rebalancing after insert/delete
It allows duplicate keys
Which traversal method is used by DFS?
BFS
Queue
Stack
Min Heap
What is the time complexity to insert into a binary search tree (average case)?
O(n)
O(log n)
O(1)
O(n log n)
In Union-Find, which optimization keeps the tree flat?
Path Compression
DFS
Rank Balancing
Greedy Linking
Which of these operations is not efficient in a singly linked list?
Insert at head
Insert at tail
Delete at head
Delete at tail
A complete binary tree with n nodes has height:
O(n)
O(log n)
O(n log n)
O(1)
Which algorithm is used to find all pairs shortest path?
Kruskal
Floyd-Warshall
DFS
Prim
Which of the following is used in Dijkstra’s algorithm for shortest path?
Queue
Min Heap
Max Heap
Stack
Which of these can be used to detect a cycle in a directed graph?
DFS with recursion stack
Dijkstra’s algorithm
BFS only
Prim’s algorithm
What is the auxiliary space complexity of Merge Sort?
O(1)
O(log n)
O(n)
O(n log n)
The best-case time complexity of QuickSort is:
O(n²)
O(n log n)
O(log n)
O(n)
Which data structure is used in Breadth First Search (BFS)?
Stack
Queue
Tree
Heap
Which of the following is not a self-balancing binary search tree?
Red-Black Tree
AVL Tree
B-Tree
Binary Heap
Which of the following uses Divide and Conquer?
Dijkstra’s Algorithm
Kruskal’s Algorithm
Merge Sort
Prim’s Algorithm
In a max-heap, the largest element is:
At the leaf
In the middle
At the root
Undefined
What is the height of an AVL Tree with n nodes?
O(n)
O(log n)
O(1)
O(n log n)
Which algorithm is used to find a Minimum Spanning Tree?
Dijkstra’s
Prim’s
Floyd-Warshall
DFS
What is the space complexity of an adjacency matrix for a graph with V vertices?
O(V)
O(V²
O(log V)
O(E)
Which of the following operations can be done in O(1) in a hash table (on average)?
Search
Insert
Delete
All of the above
In which traversal method is a binary search tree traversed to get the values in ascending order?
Preorder
Inorder
Postorder
Level order
What is the worst-case time complexity of Binary Search on a sorted array?
O(n)
O(log n)
O(n log n)
O(1)
Which data structure is most suitable for implementing recursion?
Queue
Array
Stack
Linked List
