Q. Which of the following is NOT a characteristic of the Disjoint Set Union data structure?
A.
Supports union and find operations
B.
Can handle dynamic connectivity
C.
Maintains a sorted order of elements
D.
Can be implemented using trees
Show solution
Solution
Maintaining a sorted order of elements is NOT a characteristic of the Disjoint Set Union data structure; it focuses on managing disjoint sets.
Correct Answer:
C
— Maintains a sorted order of elements
Learn More →
Q. Which of the following is NOT a characteristic of the Disjoint Set Union?
A.
Supports union and find operations
B.
Can handle dynamic connectivity
C.
Requires elements to be integers
D.
Can be implemented with trees
Show solution
Solution
Disjoint Set Union does not require elements to be integers; it can handle any type of elements as long as they can be uniquely identified.
Correct Answer:
C
— Requires elements to be integers
Learn More →
Q. Which of the following is NOT a common application of Disjoint Set Union?
A.
Kruskal's algorithm for minimum spanning tree
B.
Network connectivity
C.
Dynamic connectivity queries
D.
Binary search tree operations
Show solution
Solution
Binary search tree operations are not a common application of Disjoint Set Union; it is primarily used for network connectivity and algorithms like Kruskal's.
Correct Answer:
D
— Binary search tree operations
Learn More →
Q. Which of the following is NOT a property of a binary heap?
A.
Complete binary tree
B.
Heap order property
C.
Balanced tree
D.
Each node has at most two children
Show solution
Solution
A binary heap does not need to be a balanced tree; it only needs to be a complete binary tree.
Correct Answer:
C
— Balanced tree
Learn More →
Q. Which of the following is NOT a type of hash table?
A.
Separate chaining hash table
B.
Open addressing hash table
C.
Dynamic array hash table
D.
Cuckoo hash table
Show solution
Solution
Dynamic array hash table is not a recognized type of hash table; the other options are valid methods for implementing hash tables.
Correct Answer:
C
— Dynamic array hash table
Learn More →
Q. Which of the following is NOT a typical application of Disjoint Set Union?
A.
Network connectivity
B.
Kruskal's algorithm for minimum spanning tree
C.
Finding the shortest path in a graph
D.
Image processing for region labeling
Show solution
Solution
Finding the shortest path in a graph is not a typical application of Disjoint Set Union; it is more related to algorithms like Dijkstra's or Bellman-Ford.
Correct Answer:
C
— Finding the shortest path in a graph
Learn More →
Q. Which of the following is NOT a typical application of heaps?
A.
Heap sort
B.
Implementing a priority queue
C.
Finding the median of a list
D.
Graph traversal
Show solution
Solution
Graph traversal is not a typical application of heaps; instead, heaps are used for sorting, priority queues, and finding medians.
Correct Answer:
D
— Graph traversal
Learn More →
Q. Which of the following is NOT a typical use case for Disjoint Set Union?
A.
Kruskal's algorithm for Minimum Spanning Tree
B.
Finding connected components in a graph
C.
Implementing a priority queue
D.
Dynamic connectivity queries
Show solution
Solution
Implementing a priority queue is not a typical use case for Disjoint Set Union; it is primarily used for managing disjoint sets.
Correct Answer:
C
— Implementing a priority queue
Learn More →
Q. Which of the following is NOT a typical use case for hash tables?
A.
Implementing a phone book
B.
Counting frequency of words in a document
C.
Storing a sorted list of items
D.
Implementing a set data structure
Show solution
Solution
Hash tables are not designed for maintaining sorted order, which is required for a sorted list of items.
Correct Answer:
C
— Storing a sorted list of items
Learn More →
Q. Which of the following is NOT a typical use case for priority queues?
A.
Job scheduling
B.
Pathfinding algorithms
C.
Data compression
D.
Implementing a LIFO structure
Show solution
Solution
Implementing a LIFO structure is not a typical use case for priority queues; that is the function of stacks.
Correct Answer:
D
— Implementing a LIFO structure
Learn More →
Q. Which of the following is NOT a valid implementation of a priority queue?
A.
Array
B.
Linked List
C.
Binary Search Tree
D.
Max-Heap
Show solution
Solution
While a binary search tree can be used to implement a priority queue, it is not a typical or efficient implementation compared to heaps.
Correct Answer:
C
— Binary Search Tree
Learn More →
Q. Which of the following is NOT a valid operation for a priority queue?
A.
Insert
B.
Delete Min
C.
Get Min
D.
Sort
Show solution
Solution
Sorting is not a direct operation of a priority queue; it can be achieved by repeatedly removing elements, but it is not a standard operation.
Correct Answer:
D
— Sort
Learn More →
Q. Which of the following is NOT an application of Disjoint Set Union?
A.
Network connectivity
B.
Image processing
C.
Dynamic connectivity
D.
Sorting algorithms
Show solution
Solution
Sorting algorithms are not an application of Disjoint Set Union; it is primarily used for network connectivity and dynamic connectivity problems.
Correct Answer:
D
— Sorting algorithms
Learn More →
Q. Which of the following is true about a max-heap?
A.
The parent node is always smaller than its children
B.
The parent node is always larger than its children
C.
It is a complete binary tree
D.
Both B and C
Show solution
Solution
In a max-heap, the parent node is always larger than its children, and it is also a complete binary tree.
Correct Answer:
D
— Both B and C
Learn More →
Q. Which of the following operations can be performed in O(1) time on a max-heap?
A.
Insert
B.
Delete Max
C.
Get Max
D.
Heapify
Show solution
Solution
The Get Max operation can be performed in O(1) time since the maximum element is always at the root of the max-heap.
Correct Answer:
C
— Get Max
Learn More →
Q. Which of the following operations can be performed in O(1) time on a priority queue implemented with a binary heap?
A.
Insert
B.
Delete Min
C.
Get Min
D.
Decrease Key
Show solution
Solution
Getting the minimum element in a binary heap can be done in O(1) time since the minimum element is always at the root.
Correct Answer:
C
— Get Min
Learn More →
Q. Which of the following operations can be performed in O(1) time on a priority queue implemented with a max-heap?
A.
Insert
B.
Delete Max
C.
Get Max
D.
Decrease Key
Show solution
Solution
Getting the maximum element in a max-heap can be done in O(1) time since the maximum element is always at the root.
Correct Answer:
C
— Get Max
Learn More →
Q. Which of the following operations can be performed in O(log n) time in a binary heap?
A.
Insertion
B.
Deletion of the maximum element
C.
Heapify
D.
All of the above
Show solution
Solution
All of the listed operations (insertion, deletion of the maximum element, and heapify) can be performed in O(log n) time in a binary heap.
Correct Answer:
D
— All of the above
Learn More →
Q. Which of the following scenarios is best suited for using a Disjoint Set Union?
A.
Finding the maximum element in an array
B.
Detecting cycles in a graph
C.
Sorting a list of numbers
D.
Searching for an element in a sorted array
Show solution
Solution
Disjoint Set Union is particularly useful for detecting cycles in a graph, as it can efficiently manage and merge sets of connected components.
Correct Answer:
B
— Detecting cycles in a graph
Learn More →
Q. Which of the following scenarios is best suited for using a hash table?
A.
When order of elements is important
B.
When frequent insertions and deletions are required
C.
When searching for elements by key is needed
D.
When elements need to be sorted
Show solution
Solution
Hash tables are ideal for scenarios where fast searching by key is required, as they provide average O(1) time complexity for lookups.
Correct Answer:
C
— When searching for elements by key is needed
Learn More →
Q. Which of the following scenarios is best suited for using Disjoint Set Union?
A.
Finding the maximum element in an array
B.
Detecting cycles in a graph
C.
Sorting a list of numbers
D.
Searching for an element in a linked list
Show solution
Solution
Disjoint Set Union is best suited for detecting cycles in a graph, as it efficiently manages connected components.
Correct Answer:
B
— Detecting cycles in a graph
Learn More →
Q. Which of the following scenarios would benefit most from using a hash table?
A.
When data needs to be stored in a sorted order
B.
When frequent insertions and deletions are required
C.
When searching for elements by key is common
D.
When data is accessed sequentially
Show solution
Solution
Hash tables are particularly beneficial when searching for elements by key is common, as they provide average O(1) time complexity for lookups.
Correct Answer:
C
— When searching for elements by key is common
Learn More →
Q. Which of the following scenarios would most likely benefit from using a hash table?
A.
Storing a sorted list of numbers
B.
Implementing a priority queue
C.
Counting the frequency of words in a document
D.
Performing a binary search
Show solution
Solution
A hash table is particularly useful for counting the frequency of words in a document, as it allows for quick updates and lookups.
Correct Answer:
C
— Counting the frequency of words in a document
Learn More →
Q. Which of the following statements about Disjoint Set Union is true?
A.
It can only handle integer elements
B.
It is not efficient for large datasets
C.
It can efficiently handle dynamic connectivity queries
D.
It requires a fixed number of elements
Show solution
Solution
Disjoint Set Union can efficiently handle dynamic connectivity queries, making it suitable for various applications.
Correct Answer:
C
— It can efficiently handle dynamic connectivity queries
Learn More →
Q. Which of the following statements about heaps is true?
A.
Heaps are always balanced
B.
Heaps can be implemented using arrays
C.
Heaps can only be binary
D.
Heaps are not complete binary trees
Show solution
Solution
Heaps can be efficiently implemented using arrays, where the parent-child relationship can be easily calculated.
Correct Answer:
B
— Heaps can be implemented using arrays
Learn More →
Q. Which of the following statements about open addressing is true?
A.
It uses linked lists to handle collisions
B.
It requires more memory than chaining
C.
It probes for the next available slot in the table
D.
It is slower than chaining
Show solution
Solution
Open addressing resolves collisions by probing for the next available slot in the hash table, rather than using linked lists.
Correct Answer:
C
— It probes for the next available slot in the table
Learn More →
Q. Which of the following techniques can be used to optimize the Union operation in Disjoint Set Union?
A.
Path compression
B.
Binary search
C.
Heapification
D.
Graph traversal
Show solution
Solution
Path compression is a technique used to optimize the Union operation in Disjoint Set Union by flattening the structure of the tree whenever 'Find' is called.
Correct Answer:
A
— Path compression
Learn More →
Q. Which operation in Disjoint Set Union is used to combine two sets?
A.
Find
B.
Union
C.
Merge
D.
Connect
Show solution
Solution
The operation used to combine two sets in Disjoint Set Union is called 'Union'.
Correct Answer:
B
— Union
Learn More →
Q. Which operation in the Disjoint Set Union is used to determine which set a particular element belongs to?
A.
Union
B.
Find
C.
Insert
D.
Delete
Show solution
Solution
The 'Find' operation is used to determine which set a particular element belongs to in the Disjoint Set Union.
Correct Answer:
B
— Find
Learn More →
Showing 151 to 179 of 179 (6 Pages)