set-6
251. What is the correct postfix notation for the infix expression ?
252. Which notation is the most commonly used by humans to express arithmetic expressions?
Postfix notation
Infix notation
Prefix notation
All notations are equally popular
253. Which notation is the easiest to parse and evaluate using a stack-based algorithm?
Postfix notation
Infix notation
Prefix notation
All notations can be parsed and evaluated equally easily
254. Which notation is the easiest to convert to machine code or assembly language?
Postfix notation
Infix notation
Prefix notation
All notations can be easily converted to machine code or assembly language
255. What is the advantage of using prefix or postfix notation over infix notation?
Prefix and postfix notation can eliminate the need for parentheses
Prefix and postfix notation are more human-readable
Prefix and postfix notation are more compact than infix notation
Prefix and postfix notation are more intuitive than infix notation
256. Which of the following is NOT an application of stacks?
Implementing undo-redo functionality in text editors
Evaluating arithmetic expressions
Implementing backtracking algorithms
Storing data in a hash table
257. What is the application of a stack in implementing a web browser's back button?
The URLs of the visited web pages are pushed onto a stack
The URLs of the visited web pages are popped off a stack
The URLs of the visited web pages are stored in a queue
The URLs of the visited web pages are stored in a hash table
258. Which data structure can be used to implement a stack?
Array
Linked list
Both array and linked list
Neither array nor linked list
259. What is the application of a stack in evaluating arithmetic expressions?
The operands are pushed onto the stack, and the operators are evaluated in order
The operators are pushed onto the stack, and the operands are evaluated in order
The operands and operators are both pushed onto the stack in random order
The operands and operators are stored in separate stacks
260. What is the application of a stack in implementing function calls in programming languages?
The return address and parameters of a function call are pushed onto the stack, and the function is executed
The function itself is pushed onto the stack, and the return address and parameters are evaluated in order
The parameters of a function call are pushed onto the stack, and the function is executed without using a return address
The return address and parameters of a function call are stored in a queue
261. What is the purpose of a hash function in a hash table?
To convert a key into an index for the table
To sort the elements in the table
To compare elements in the table
To store the elements in the table
262. What is a hash table in computer science?
A data structure that stores elements in a sorted manner
A data structure that stores elements in a random order
A data structure that stores elements using a key-value pair
A data structure that stores elements using an array
263. What is collision resolution in hash tables?
The process of adding elements to a hash table
The process of removing elements from a hash table
The process of resolving conflicts when two keys hash to the same index
The process of searching for a specific element in a hash table
264. What are some common collision resolution techniques in hash tables?
Linear probing
Binary search
Chaining
All of the above
265. What is linear probing in hash tables?
A technique that resolves collisions by searching through the table sequentially
A technique that resolves collisions by dividing the table into smaller sections
A technique that resolves collisions by using a linked list to store elements at the same index
A technique that resolves collisions by using binary search to find the correct index
266. What is chaining in hash tables?
A technique that resolves collisions by searching through the table sequentially
A technique that resolves collisions by dividing the table into smaller sections
A technique that resolves collisions by using a linked list to store elements at the same index
A technique that resolves collisions by using binary search to find the correct index
267. What is the time complexity of searching in a hash table using chaining?
268. What is the main purpose of a hash function in a hash table?
To sort the elements in the table
To find the index of an element in the table
To compare the elements in the table
To store the elements in the table
269. What is the most common way to resolve collisions in a hash table?
Chaining
Open Addressing
Binary Search
Linear Search
270. What is the time complexity of searching an element in a hash table using the hash function?
271. What is the main advantage of using a hash table over a traditional array for storing elements?
Faster access time
Better sorting
More memory efficient
Better searching
272. What is the purpose of a collision resolution technique in a hash table?
To ensure that each element is stored at a unique index in the table
To sort the elements in the table
To compare the elements in the table
To store the elements in the table
273. What is the main objective of a minimum spanning tree algorithm?
To find the shortest path between two vertices
To find the minimum weight of a tree that connects all vertices
To find the longest path between two vertices
To find the maximum weight of a tree that connects all vertices
274. What is the time complexity of Prim's algorithm for finding a minimum spanning tree?
275. What is the time complexity of Kruskal's algorithm for finding a minimum spanning tree?
276. What is the difference between Prim's and Kruskal's algorithm for finding a minimum spanning tree?
Prim's algorithm starts with a single vertex and adds vertices to the tree while Kruskal's algorithm starts with all vertices and adds edges to the tree.
Prim's algorithm starts with all vertices and adds edges to the tree while Kruskal's algorithm starts with a single vertex and adds vertices to the tree.
Both algorithms start with a single vertex and add edges to the tree.
Both algorithms start with all vertices and add vertices to the tree.
277. What is the Round-Robin algorithm used for?
To find the minimum spanning tree
To schedule processes in a computer system
To sort a list of elements
To find the longest path between two vertices
278. What is the main advantage of using a minimum spanning tree algorithm?
To find the shortest path between two vertices
To find the minimum weight of a tree that connects all vertices
To find the longest path between two vertices
To find the maximum weight of a tree that connects all vertices
279. What is the use of a Round-Robin algorithm in a computer system?
To find the minimum spanning tree
To schedule processes in a computer system
To sort a list of elements
To find the longest path between two vertices
280. What is the main disadvantage of using a Kruskal's algorithm compared to Prim's algorithm for finding a minimum spanning tree?
Kruskal's algorithm is less efficient than Prim's algorithm
Kruskal's algorithm is more difficult to implement than Prim's algorithm
Kruskal's algorithm is less reliable than Prim's algorithm
Kruskal's algorithm is less accurate than Prim's algorithm
281. What is the use of a hash function in a hash table data structure?
To generate a unique key for each element in the table
To sort the elements in the table
To find the shortest path between two vertices
To find the longest path between two vertices
282. What is the main idea behind the greedy algorithm for solving the shortest path problem?
To find the shortest path by visiting all nodes in the graph
To find the shortest path by selecting the closest node at each step
To find the shortest path by selecting the most distant node at each step
To find the shortest path by using dynamic programming
283. What is the time complexity of Dijkstra's algorithm for finding the shortest path in a graph?
284. What is the difference between Dijkstra's algorithm and Bellman-Ford algorithm for finding the shortest path in a graph?
Dijkstra's algorithm is faster than Bellman-Ford algorithm
Bellman-Ford algorithm can handle negative weight edges while Dijkstra's algorithm cannot
Dijkstra's algorithm is simpler than Bellman-Ford algorithm
Bellman-Ford algorithm is more efficient than Dijkstra's algorithm
285. What is the use of the relaxation step in Dijkstra's algorithm for finding the shortest path?
To update the distance of each node from the source node
To find the shortest path between two nodes
To keep track of the visited nodes
To find the minimum distance between two nodes
286. Can Dijkstra's algorithm be used to find the shortest path in a graph with negative weight edges?
Yes, it can be used
No, it cannot be used
287. What is the main difference between greedy algorithm and dynamic programming for solving the shortest path problem?
Greedy algorithm gives the optimal solution while dynamic programming gives the suboptimal solution
Dynamic programming gives the optimal solution while greedy algorithm gives the suboptimal solution
Both greedy algorithm and dynamic programming give the optimal solution
Both greedy algorithm and dynamic programming give the suboptimal solution
288. What is the use of the priority queue in Dijkstra's algorithm for finding the shortest path?
To keep track of the visited nodes
To find the shortest path between two nodes
To update the distance of each node from the source node
To find the node with the minimum distance from the source node
289. Which of the following statements is true about undirected graphs?
The edges in an undirected graph have a direction.
The edges in an undirected graph have no direction.
The edges in an undirected graph are always weighted.
An undirected graph cannot have cycles.
290. Which of the following data structures is commonly used to represent a graph?
Linked list
Queue
Stack
Array
291. Which of the following is the best algorithm to find the transitive closure of a graph?
Dijkstra's algorithm
Bellman-Ford algorithm
Warshall's algorithm
Prim's algorithm
292. Which of the following algorithms is used to find the shortest path in a weighted graph?
Depth-first search
Breadth-first search
Dijkstra's algorithm
Kruskal's algorithm
293. What is the time complexity of Warshall's algorithm?
294. Which traversal algorithm is used to traverse a graph starting from a particular vertex and exploring as far as possible along each branch before backtracking?
Depth-first traversal
Breadth-first traversal
Topological sorting
Kruskal's algorithm
295. Which traversal algorithm is used to traverse a graph by exploring all the vertices at the same level before moving on to the next level?
Depth-first traversal
Breadth-first traversal
Topological sorting
Kruskal's algorithm
296. What is the time complexity of Breadth-first traversal of a graph?
297. Which of the following algorithms can be used to find a topological ordering of a directed acyclic graph (DAG)?
Depth-first traversal
Breadth-first traversal
Topological sorting (DFS)
Topological sorting (BFS)
298. Which of the following is true about a DAG?
It can have cycles.
It can have multiple sources.
It can have multiple sinks.
It can be disconnected.
299. Which of the following is used to determine whether a graph is acyclic or not?
Depth-first traversal
Breadth-first traversal
Topological sorting (DFS)
Topological sorting (BFS)
300. What is the time complexity of Depth-first traversal of a graph?
301. Which of the following algorithms is used to find the minimum spanning tree of a graph?
Depth-first traversal
Breadth-first traversal
Dijkstra's algorithm
Kruskal's algorithm
302. Which of the following is not a sorting algorithm?
Bubble sort
Heap sort
Quick sort
Binary search
303. Which of the following data structures is used to implement heap sort?
Stack
Queue
Heap
Linked list
304. What is the worst-case time complexity of heap sort?
305. Which of the following is not a step in heap sort?
Building a heap
Sorting the heap
Swapping the first and last elements
Inserting elements into the heap
306. What is the space complexity of heap sort?
307. What is the minimum number of elements that can be sorted using heap sort?
0
1
2
3
308. Which of the following is not a property of a heap?
It is a complete binary tree.
The root is always the maximum or minimum element.
The left child is always greater than the right child.
The height of the tree is .
309. What is the time complexity of building a heap?
310. Which of the following is not a type of heap?
Binary heap
Fibonacci heap
Ternary heap
Quad heap
311. Which of the following is a disadvantage of heap sort?
It is not an in-place algorithm.
It cannot handle duplicate elements.
It has a worst-case time complexity of .
It is not stable.
Last updated