Q. How does a Random Forest handle missing values?
A.
It cannot handle missing values.
B.
It uses mean imputation.
C.
It uses a surrogate split.
D.
It drops the entire dataset.
Show solution
Solution
Random Forests can handle missing values by using surrogate splits, which allow the model to make predictions even when some data points are missing.
Correct Answer:
C
— It uses a surrogate split.
Learn More →
Q. How does a Random Forest improve upon a single Decision Tree?
A.
By using a single model for predictions
B.
By averaging the predictions of multiple trees
C.
By increasing the depth of each tree
D.
By using only the most important features
Show solution
Solution
Random Forest improves accuracy by averaging the predictions of multiple Decision Trees, which reduces variance.
Correct Answer:
B
— By averaging the predictions of multiple trees
Learn More →
Q. How does a Red-Black tree ensure balance after deletion?
A.
By performing rotations and recoloring.
B.
By deleting the node and not balancing.
C.
By merging nodes.
D.
By increasing the height of the tree.
Show solution
Solution
After deletion in a Red-Black tree, balance is restored through a combination of rotations and recoloring.
Correct Answer:
A
— By performing rotations and recoloring.
Learn More →
Q. How does a Red-Black Tree ensure balance after insertion?
A.
By performing rotations and recoloring
B.
By deleting the deepest node
C.
By merging nodes
D.
By increasing the height of the tree
Show solution
Solution
Red-Black Trees maintain balance after insertion by performing rotations and recoloring nodes to satisfy the properties of the tree.
Correct Answer:
A
— By performing rotations and recoloring
Learn More →
Q. How does an AVL tree maintain balance after an insertion?
A.
By performing rotations.
B.
By deleting nodes.
C.
By increasing the height of the tree.
D.
By changing node colors.
Show solution
Solution
An AVL tree maintains balance after an insertion by performing rotations (single or double) to ensure the height difference property is satisfied.
Correct Answer:
A
— By performing rotations.
Learn More →
Q. How does an AVL tree maintain balance after insertion?
A.
By performing rotations.
B.
By deleting nodes.
C.
By increasing the height.
D.
By changing colors.
Show solution
Solution
AVL trees maintain balance by performing rotations (single or double) after insertions to ensure the balance factor remains within the allowed range.
Correct Answer:
A
— By performing rotations.
Learn More →
Q. How does binary search determine the middle element of the array?
A.
Using the first and last index
B.
Using the average of all elements
C.
Using the median value
D.
Using a random index
Show solution
Solution
Binary search calculates the middle element using the formula (low + high) / 2, where low and high are the current bounds.
Correct Answer:
A
— Using the first and last index
Learn More →
Q. How does binary search determine the middle index of an array?
A.
(low + high) / 2
B.
low + high
C.
low * high
D.
high - low
Show solution
Solution
Binary search calculates the middle index using (low + high) / 2 to find the midpoint of the current search range.
Correct Answer:
A
— (low + high) / 2
Learn More →
Q. How does binary search determine the next interval to search?
A.
By comparing the target with the middle element
B.
By checking the first and last elements
C.
By using a hash table
D.
By traversing the entire array
Show solution
Solution
Binary search determines the next interval by comparing the target with the middle element and deciding which half to continue searching.
Correct Answer:
A
— By comparing the target with the middle element
Learn More →
Q. How does binary search determine which half of the array to search next?
A.
By comparing the middle element with the target
B.
By checking the length of the array
C.
By using a random index
D.
By iterating through the array
Show solution
Solution
Binary search compares the middle element of the array with the target value to decide whether to search the left or right half.
Correct Answer:
A
— By comparing the middle element with the target
Learn More →
Q. How does Dijkstra's algorithm ensure that it finds the shortest path?
A.
By exploring all possible paths
B.
By using a depth-first search
C.
By always choosing the nearest unvisited vertex
D.
By backtracking to previous nodes
Show solution
Solution
Dijkstra's algorithm ensures it finds the shortest path by always choosing the nearest unvisited vertex, which is a key aspect of its greedy approach.
Correct Answer:
C
— By always choosing the nearest unvisited vertex
Learn More →
Q. How does Dijkstra's algorithm ensure that the shortest path is found?
A.
By exploring all possible paths
B.
By using a greedy approach
C.
By backtracking
D.
By using dynamic programming
Show solution
Solution
Dijkstra's algorithm uses a greedy approach, always expanding the least costly node first, ensuring that the shortest path is found.
Correct Answer:
B
— By using a greedy approach
Learn More →
Q. How does Dijkstra's algorithm handle nodes that have already been visited?
A.
It ignores them
B.
It re-evaluates their distances
C.
It adds them to a stack
D.
It removes them from the graph
Show solution
Solution
Once a node has been visited and its shortest distance determined, Dijkstra's algorithm ignores it in future iterations.
Correct Answer:
A
— It ignores them
Learn More →
Q. How does Dijkstra's algorithm update the tentative distances of neighboring nodes?
A.
By adding the edge weights to the current node's distance
B.
By multiplying the edge weights with the current node's distance
C.
By subtracting the edge weights from the current node's distance
D.
By ignoring the edge weights
Show solution
Solution
Dijkstra's algorithm updates the tentative distances of neighboring nodes by adding the edge weights to the current node's distance.
Correct Answer:
A
— By adding the edge weights to the current node's distance
Learn More →
Q. How does Dijkstra's algorithm update the tentative distances?
A.
By adding the edge weights to the current distances
B.
By multiplying the edge weights with the current distances
C.
By subtracting the edge weights from the current distances
D.
By averaging the edge weights
Show solution
Solution
Dijkstra's algorithm updates the tentative distances by adding the edge weights to the current distance of the node.
Correct Answer:
A
— By adding the edge weights to the current distances
Learn More →
Q. How does Random Forest handle missing values in the dataset?
A.
It ignores missing values completely
B.
It uses mean imputation for missing values
C.
It can use surrogate splits to handle missing values
D.
It requires complete data without any missing values
Show solution
Solution
Random Forest can use surrogate splits to handle missing values, allowing it to make predictions even with incomplete data.
Correct Answer:
C
— It can use surrogate splits to handle missing values
Learn More →
Q. How does Random Forest handle missing values?
A.
It cannot handle missing values
B.
It ignores missing values completely
C.
It uses imputation techniques
D.
It can use surrogate splits
Show solution
Solution
Random Forest can use surrogate splits to handle missing values, allowing it to make predictions even when some data is missing.
Correct Answer:
D
— It can use surrogate splits
Learn More →
Q. How does Random Forest improve upon a single Decision Tree?
A.
By using a single tree with more depth.
B.
By averaging the predictions of multiple trees.
C.
By using only the most important features.
D.
By increasing the size of the training dataset.
Show solution
Solution
Random Forest improves accuracy by averaging the predictions of multiple trees, which reduces overfitting.
Correct Answer:
B
— By averaging the predictions of multiple trees.
Learn More →
Q. How does Random Forest reduce the risk of overfitting compared to a single Decision Tree?
A.
By using a single tree with more depth
B.
By averaging the predictions of multiple trees
C.
By using only the most important features
D.
By increasing the size of the training dataset
Show solution
Solution
Random Forest reduces overfitting by averaging the predictions of multiple trees, which smooths out the noise and variance.
Correct Answer:
B
— By averaging the predictions of multiple trees
Learn More →
Q. How does SVM handle multi-class classification problems?
A.
By using a single model for all classes
B.
By applying one-vs-one or one-vs-all strategies
C.
By ignoring the additional classes
D.
By converting them into binary problems only
Show solution
Solution
SVM can handle multi-class classification using one-vs-one or one-vs-all strategies.
Correct Answer:
B
— By applying one-vs-one or one-vs-all strategies
Learn More →
Q. How does SVM handle outliers in the training data?
A.
By ignoring them completely
B.
By assigning them a higher weight
C.
By using a soft margin approach
D.
By clustering them separately
Show solution
Solution
SVM can handle outliers using a soft margin approach, which allows some misclassifications to achieve a better overall model.
Correct Answer:
C
— By using a soft margin approach
Learn More →
Q. How does the balancing factor of an AVL tree node get calculated?
A.
Height of left subtree - height of right subtree
B.
Height of right subtree - height of left subtree
C.
Number of nodes in left subtree - number of nodes in right subtree
D.
Number of nodes in right subtree - number of nodes in left subtree
Show solution
Solution
The balancing factor of an AVL tree node is calculated as the height of the left subtree minus the height of the right subtree.
Correct Answer:
A
— Height of left subtree - height of right subtree
Learn More →
Q. How does the balancing of an AVL tree differ from that of a Red-Black tree?
A.
AVL trees are more rigidly balanced than Red-Black trees
B.
Red-Black trees are always perfectly balanced
C.
AVL trees allow more flexibility in balancing
D.
There is no difference
Show solution
Solution
AVL trees are more rigidly balanced than Red-Black trees, which allows AVL trees to provide faster lookups at the cost of more complex insertions and deletions.
Correct Answer:
A
— AVL trees are more rigidly balanced than Red-Black trees
Learn More →
Q. How does the choice of the kernel affect the performance of a Support Vector Machine?
A.
It does not affect performance
B.
It determines the complexity of the model
C.
It only affects training time
D.
It is irrelevant to the model's accuracy
Show solution
Solution
The choice of kernel significantly impacts the model's ability to capture the underlying patterns in the data, thus affecting performance.
Correct Answer:
B
— It determines the complexity of the model
Learn More →
Q. How does the height of an AVL tree compare to that of a Red-Black tree?
A.
AVL trees are always shorter.
B.
Red-Black trees are always shorter.
C.
They have the same height.
D.
AVL trees are shorter in the worst case.
Show solution
Solution
AVL trees are more strictly balanced, which can lead to a shorter height compared to Red-Black trees in the worst case.
Correct Answer:
D
— AVL trees are shorter in the worst case.
Learn More →
Q. How does the insertion operation in a Red-Black Tree differ from that in an AVL Tree?
A.
Red-Black Trees require fewer rotations
B.
AVL Trees allow duplicate values
C.
Red-Black Trees are always balanced
D.
AVL Trees are faster for insertion
Show solution
Solution
Insertion in Red-Black Trees typically requires fewer rotations compared to AVL Trees.
Correct Answer:
A
— Red-Black Trees require fewer rotations
Learn More →
Q. How does the insertion operation in an AVL tree differ from that in a Red-Black tree?
A.
AVL trees require more rotations
B.
Red-Black trees require more rotations
C.
Both require the same number of rotations
D.
Insertion is the same in both
Show solution
Solution
Insertion in an AVL tree may require more rotations to maintain balance compared to a Red-Black tree, which allows for a more relaxed balancing approach.
Correct Answer:
A
— AVL trees require more rotations
Learn More →
Q. How does the presence of duplicate elements affect the binary search algorithm?
A.
It has no effect
B.
It slows down the search
C.
It can return any index of the duplicates
D.
It makes the search impossible
Show solution
Solution
Binary search can return any index of the duplicates, as it does not guarantee which duplicate will be found first.
Correct Answer:
C
— It can return any index of the duplicates
Learn More →
Q. How does the time complexity of searching in a Red-Black Tree compare to that in an AVL Tree?
A.
Red-Black Tree is faster
B.
AVL Tree is faster
C.
Both have the same time complexity
D.
It depends on the implementation
Show solution
Solution
Both Red-Black Trees and AVL Trees have a search time complexity of O(log n).
Correct Answer:
C
— Both have the same time complexity
Learn More →
Q. How does the time complexity of searching in a Red-Black Tree compare to that of an AVL Tree?
A.
Red-Black is faster
B.
AVL is faster
C.
Both have the same complexity
D.
Red-Black is slower
Show solution
Solution
Both Red-Black Trees and AVL Trees have a search time complexity of O(log n).
Correct Answer:
C
— Both have the same complexity
Learn More →
Showing 31 to 60 of 3237 (108 Pages)