Q. Which of the following sorting algorithms has the best average-case time complexity?
A.
Bubble Sort
B.
Insertion Sort
C.
Quick Sort
D.
Selection Sort
Show solution
Solution
Quick Sort has the best average-case time complexity of O(n log n) among the given sorting algorithms.
Correct Answer:
C
— Quick Sort
Learn More →
Q. Which of the following sorting algorithms has the worst-case time complexity of O(n^2)?
A.
Merge Sort
B.
Quick Sort
C.
Bubble Sort
D.
Heap Sort
Show solution
Solution
Bubble Sort has a worst-case time complexity of O(n^2).
Correct Answer:
C
— Bubble Sort
Learn More →
Q. Which of the following sorting algorithms is based on the divide and conquer approach?
A.
Bubble Sort
B.
Insertion Sort
C.
Merge Sort
D.
Selection Sort
Show solution
Solution
Merge Sort is a sorting algorithm that uses the divide and conquer strategy to sort elements.
Correct Answer:
C
— Merge Sort
Learn More →
Q. Which of the following sorting algorithms is not a comparison-based sort?
A.
Merge Sort
B.
Quick Sort
C.
Heap Sort
D.
Counting Sort
Show solution
Solution
Counting Sort is not a comparison-based sort; it uses counting to determine the position of each element.
Correct Answer:
D
— Counting Sort
Learn More →
Q. Which of the following sorting algorithms is not based on comparisons?
A.
Quick Sort
B.
Merge Sort
C.
Bubble Sort
D.
Counting Sort
Show solution
Solution
Counting Sort is a non-comparison-based sorting algorithm that sorts integers by counting occurrences.
Correct Answer:
D
— Counting Sort
Learn More →
Q. Which of the following sorting algorithms is not in-place?
A.
Quick Sort
B.
Merge Sort
C.
Bubble Sort
D.
Insertion Sort
Show solution
Solution
Merge Sort requires additional space for merging, making it not an in-place sorting algorithm.
Correct Answer:
B
— Merge Sort
Learn More →
Q. Which of the following sorting algorithms is not stable?
A.
Bubble Sort
B.
Merge Sort
C.
Quick Sort
D.
Insertion Sort
Show solution
Solution
Quick Sort is not a stable sorting algorithm because it can change the relative order of equal elements.
Correct Answer:
C
— Quick Sort
Learn More →
Q. Which of the following sorting algorithms is stable?
A.
Quick Sort
B.
Heap Sort
C.
Merge Sort
D.
Selection Sort
Show solution
Solution
Merge Sort is a stable sorting algorithm, meaning it maintains the relative order of equal elements.
Correct Answer:
C
— Merge Sort
Learn More →
Q. Which of the following statements about AVL and Red-Black trees is true?
A.
AVL trees are always faster than Red-Black trees
B.
Red-Black trees are more memory efficient than AVL trees
C.
AVL trees provide faster lookups than Red-Black trees
D.
Both trees are equally efficient in all scenarios
Show solution
Solution
AVL trees provide faster lookups than Red-Black trees due to their stricter balancing, but Red-Black trees are generally more efficient for insertions and deletions.
Correct Answer:
C
— AVL trees provide faster lookups than Red-Black trees
Learn More →
Q. Which of the following statements about AVL trees is false?
A.
They are a type of self-balancing binary search tree
B.
They can become unbalanced after insertion
C.
They require more rotations than Red-Black trees
D.
They can have nodes with two children only
Show solution
Solution
The statement that AVL trees can have nodes with two children only is false; they can have nodes with zero, one, or two children.
Correct Answer:
D
— They can have nodes with two children only
Learn More →
Q. Which of the following statements about AVL trees is true?
A.
They can become unbalanced after every insertion
B.
They require more rotations than Red-Black trees
C.
They are always perfectly balanced
D.
They are faster for search operations than Red-Black trees
Show solution
Solution
AVL trees can become unbalanced after every insertion, requiring rotations to restore balance, but they maintain a stricter balance than Red-Black trees.
Correct Answer:
A
— They can become unbalanced after every insertion
Learn More →
Q. Which of the following statements about BFS and DFS is false?
A.
BFS can find the shortest path in unweighted graphs
B.
DFS can be more memory efficient than BFS
C.
BFS uses a stack
D.
DFS can be implemented recursively
Show solution
Solution
BFS uses a queue, not a stack, which is a key difference from DFS.
Correct Answer:
C
— BFS uses a stack
Learn More →
Q. Which of the following statements about BFS and DFS is true?
A.
BFS is always faster than DFS
B.
DFS can be more memory efficient than BFS
C.
BFS can be used for topological sorting
D.
DFS is used for finding the shortest path
Show solution
Solution
DFS can be more memory efficient than BFS in certain scenarios, especially in deep graphs.
Correct Answer:
B
— DFS can be more memory efficient than BFS
Learn More →
Q. Which of the following statements about BFS is true?
A.
BFS can be implemented recursively.
B.
BFS is not suitable for large graphs.
C.
BFS guarantees the shortest path in weighted graphs.
D.
BFS explores nodes level by level.
Show solution
Solution
BFS explores nodes level by level, ensuring that all nodes at the present depth are explored before moving deeper.
Correct Answer:
D
— BFS explores nodes level by level.
Learn More →
Q. Which of the following statements about binary search is false?
A.
It can be implemented recursively
B.
It requires a sorted array
C.
It can be used on linked lists
D.
It is faster than linear search
Show solution
Solution
Binary search cannot be effectively used on linked lists due to their non-contiguous memory allocation, making it inefficient compared to arrays.
Correct Answer:
C
— It can be used on linked lists
Learn More →
Q. Which of the following statements about binary search is true?
A.
It can be used on linked lists
B.
It requires the array to be sorted
C.
It is always faster than linear search
D.
It can find multiple occurrences of an element
Show solution
Solution
Binary search requires the array to be sorted to function correctly.
Correct Answer:
B
— It requires the array to be sorted
Learn More →
Q. Which of the following statements about binary trees is true?
A.
A binary tree can have at most two children per node.
B.
A binary tree must be balanced.
C.
A binary tree can only have integer values.
D.
A binary tree cannot be empty.
Show solution
Solution
A binary tree is defined as a tree data structure in which each node has at most two children, often referred to as the left and right child.
Correct Answer:
A
— A binary tree can have at most two children per node.
Learn More →
Q. Which of the following statements about Decision Trees is true?
A.
They can only be used for classification tasks.
B.
They are sensitive to small changes in the data.
C.
They require feature scaling.
D.
They cannot handle missing values.
Show solution
Solution
Decision Trees are sensitive to small changes in the data, which can lead to different splits and thus different models.
Correct Answer:
B
— They are sensitive to small changes in the data.
Learn More →
Q. Which of the following statements about DFS is true?
A.
It can be implemented using a queue
B.
It is not suitable for large graphs
C.
It can be implemented using recursion
D.
It always finds the shortest path
Show solution
Solution
DFS can be implemented using recursion, which is a common approach in many algorithms.
Correct Answer:
C
— It can be implemented using recursion
Learn More →
Q. Which of the following statements about Dijkstra's algorithm is true?
A.
It can handle negative weight edges.
B.
It always finds the shortest path.
C.
It is a depth-first search algorithm.
D.
It can be used for unweighted graphs only.
Show solution
Solution
Dijkstra's algorithm always finds the shortest path in graphs with non-negative weights.
Correct Answer:
B
— It always finds the shortest path.
Learn More →
Q. Which of the following statements about Heap Sort is true?
A.
It is a stable sort
B.
It is an in-place sort
C.
It is faster than Quick Sort
D.
It requires O(n^2) time in the worst case
Show solution
Solution
Heap Sort is an in-place sorting algorithm, meaning it requires only a constant amount of additional space.
Correct Answer:
B
— It is an in-place sort
Learn More →
Q. Which of the following statements about intermediate code is true?
A.
It is always in a high-level programming language
B.
It is specific to the target architecture
C.
It can be optimized before final code generation
D.
It is not used in modern compilers
Show solution
Solution
Intermediate code can be optimized before final code generation, allowing for better performance on the target architecture.
Correct Answer:
C
— It can be optimized before final code generation
Learn More →
Q. Which of the following statements about K-means clustering is true?
A.
It can only be applied to spherical clusters
B.
It is guaranteed to find the global optimum
C.
It can be sensitive to the initial placement of centroids
D.
It does not require any distance metric
Show solution
Solution
K-means can be sensitive to the initial placement of centroids, which can lead to different clustering results on different runs.
Correct Answer:
C
— It can be sensitive to the initial placement of centroids
Learn More →
Q. Which of the following statements about Quick Sort is true?
A.
It is stable
B.
It can be implemented using a linked list
C.
It always selects the median as pivot
D.
It has a worst-case time complexity of O(n log n)
Show solution
Solution
Quick Sort can be implemented using a linked list, but it is not stable and does not always select the median as pivot.
Correct Answer:
B
— It can be implemented using a linked list
Learn More →
Q. Which of the following statements about Random Forests is true?
A.
They can only be used for regression tasks.
B.
They are less interpretable than single decision trees.
C.
They require more computational resources than a single decision tree.
D.
All of the above.
Show solution
Solution
Random Forests can be used for both classification and regression, are less interpretable than single trees, and require more computational resources.
Correct Answer:
D
— All of the above.
Learn More →
Q. Which of the following statements about Red-Black trees is true?
A.
They are always perfectly balanced.
B.
They can have a maximum of two consecutive red nodes.
C.
They are faster for search operations than AVL trees.
D.
They require more memory than AVL trees.
Show solution
Solution
In Red-Black trees, a red node cannot have a red child, which means they can have a maximum of one consecutive red node.
Correct Answer:
B
— They can have a maximum of two consecutive red nodes.
Learn More →
Q. Which of the following statements about RNNs is true?
A.
RNNs can only process fixed-length sequences.
B.
RNNs are not suitable for language modeling.
C.
RNNs can learn from past information in sequences.
D.
RNNs do not require any training.
Show solution
Solution
RNNs can learn from past information in sequences, making them effective for tasks involving temporal data.
Correct Answer:
C
— RNNs can learn from past information in sequences.
Learn More →
Q. Which of the following statements about stacks is true?
A.
Stacks can be implemented using arrays or linked lists.
B.
Stacks allow random access to elements.
C.
Stacks are FIFO data structures.
D.
Stacks can only store integers.
Show solution
Solution
Stacks can indeed be implemented using both arrays and linked lists, while they follow LIFO (Last In, First Out) order.
Correct Answer:
A
— Stacks can be implemented using arrays or linked lists.
Learn More →
Q. Which of the following statements about SVM is true?
A.
SVM can only be used for binary classification
B.
SVM is sensitive to outliers
C.
SVM does not require feature scaling
D.
SVM is a type of unsupervised learning
Show solution
Solution
SVM is sensitive to outliers, as they can affect the position of the decision boundary.
Correct Answer:
B
— SVM is sensitive to outliers
Learn More →
Q. Which of the following statements is false regarding AVL trees?
A.
They are a type of self-balancing binary search tree.
B.
They can become unbalanced after insertion or deletion.
C.
They require more rotations than Red-Black trees.
D.
They can have duplicate values.
Show solution
Solution
AVL trees do not allow duplicate values; they maintain a strict binary search tree property.
Correct Answer:
D
— They can have duplicate values.
Learn More →
Showing 2971 to 3000 of 3237 (108 Pages)