Q. In which scenario would DFS be preferred over BFS?
A.
Finding the shortest path
B.
Exploring all nodes
C.
When memory is limited
D.
When the graph is dense
Show solution
Solution
DFS is preferred when memory is limited, as it can use less space than BFS in certain cases.
Correct Answer:
C
— When memory is limited
Learn More →
Q. In which scenario would Dijkstra's algorithm be most useful?
A.
Finding the maximum element in an array
B.
Calculating the shortest distance between cities on a map
C.
Sorting a list of names alphabetically
D.
Searching for a specific value in a linked list
Show solution
Solution
Dijkstra's algorithm is most useful for calculating the shortest distance between cities on a map, as it efficiently finds the shortest paths in weighted graphs.
Correct Answer:
B
— Calculating the shortest distance between cities on a map
Learn More →
Q. In which scenario would hierarchical clustering be preferred over K-means?
A.
When the number of clusters is known
B.
When the dataset is very large
C.
When a hierarchy of clusters is desired
D.
When the data is strictly numerical
Show solution
Solution
Hierarchical clustering is preferred when a hierarchy of clusters is desired, as it provides a tree-like structure of the data.
Correct Answer:
C
— When a hierarchy of clusters is desired
Learn More →
Q. In which scenario would K-means clustering be preferred over hierarchical clustering?
A.
When the number of clusters is unknown
B.
When computational efficiency is a priority
C.
When the data is not well-separated
D.
When a detailed cluster hierarchy is needed
Show solution
Solution
K-means clustering is preferred when computational efficiency is a priority, especially for large datasets, as it is generally faster than hierarchical clustering.
Correct Answer:
B
— When computational efficiency is a priority
Learn More →
Q. In which scenario would linear regression be an appropriate model to use?
A.
Predicting customer churn (yes/no)
B.
Estimating house prices based on square footage
C.
Classifying emails as spam or not spam
D.
Segmenting customers into different groups
Show solution
Solution
Linear regression is suitable for estimating continuous values, such as house prices based on features like square footage.
Correct Answer:
B
— Estimating house prices based on square footage
Learn More →
Q. In which scenario would Random Forests be preferred over a single Decision Tree?
A.
When interpretability is the main goal
B.
When the dataset is small
C.
When overfitting is a concern
D.
When the model needs to run in real-time
Show solution
Solution
Random Forests reduce overfitting by averaging multiple Decision Trees, making them more robust.
Correct Answer:
C
— When overfitting is a concern
Learn More →
Q. In which scenario would Random Forests be preferred over Decision Trees?
A.
When interpretability is crucial
B.
When the dataset is small
C.
When overfitting is a concern
D.
When the model needs to be simple
Show solution
Solution
Random Forests reduce overfitting by averaging multiple Decision Trees, making them more robust.
Correct Answer:
C
— When overfitting is a concern
Learn More →
Q. In which scenario would you choose a linked list over an array for implementing a playlist?
A.
When the playlist size is fixed
B.
When you need to frequently add or remove songs
C.
When you need to access songs randomly
D.
When memory usage is minimal
Show solution
Solution
A linked list is preferred for implementing a playlist when you need to frequently add or remove songs, as it allows for efficient modifications.
Correct Answer:
B
— When you need to frequently add or remove songs
Learn More →
Q. In which scenario would you prefer a linked list over an array?
A.
When you need fast access to elements
B.
When the size of the data structure is fixed
C.
When you need to frequently insert and delete elements
D.
When memory usage is not a concern
Show solution
Solution
Linked lists allow for efficient insertion and deletion of elements, especially when the size of the data structure is not fixed.
Correct Answer:
C
— When you need to frequently insert and delete elements
Learn More →
Q. In which scenario would you prefer a queue over a stack?
A.
When you need to access the last element
B.
When you need to process elements in the order they were added
C.
When you need to delete elements randomly
D.
When you need to access elements by index
Show solution
Solution
A queue is preferred when you need to process elements in the order they were added, following the First In First Out (FIFO) principle.
Correct Answer:
B
— When you need to process elements in the order they were added
Learn More →
Q. In which scenario would you prefer a Red-Black Tree over an AVL Tree?
A.
When frequent insertions and deletions are expected
B.
When memory usage is a critical factor
C.
When the dataset is static
D.
When the tree needs to be perfectly balanced
Show solution
Solution
Red-Black Trees are generally preferred when there are frequent insertions and deletions because they require fewer rotations to maintain balance compared to AVL Trees.
Correct Answer:
A
— When frequent insertions and deletions are expected
Learn More →
Q. In which scenario would you prefer a stack over a queue?
A.
When you need to process items in FIFO order
B.
When you need to backtrack through previous states
C.
When you need to store items for later retrieval
D.
When you need to manage multiple tasks simultaneously
Show solution
Solution
Stacks are ideal for backtracking scenarios, such as navigating through a maze or undoing actions in applications.
Correct Answer:
B
— When you need to backtrack through previous states
Learn More →
Q. In which scenario would you prefer an AVL tree over a Red-Black tree?
A.
When frequent insertions and deletions are expected
B.
When search operations are more frequent than updates
C.
When memory usage is a critical factor
D.
When the tree needs to be perfectly balanced
Show solution
Solution
AVL trees provide faster search times due to their stricter balancing, making them preferable when search operations are more frequent.
Correct Answer:
B
— When search operations are more frequent than updates
Learn More →
Q. In which scenario would you prefer BFS over DFS?
A.
When you need to find a path in a weighted graph
B.
When you need to explore all possible paths
C.
When you need the shortest path in an unweighted graph
D.
When memory usage is a concern
Show solution
Solution
BFS is preferred for finding the shortest path in unweighted graphs because it explores all neighbors at the present depth before moving deeper.
Correct Answer:
C
— When you need the shortest path in an unweighted graph
Learn More →
Q. In which scenario would you prefer DFS over BFS?
A.
Finding the shortest path
B.
Exploring all possible paths
C.
Finding the minimum spanning tree
D.
Finding connected components
Show solution
Solution
DFS is preferred when exploring all possible paths, such as in puzzles or games where all solutions need to be considered.
Correct Answer:
B
— Exploring all possible paths
Learn More →
Q. In which scenario would you prefer Dijkstra's algorithm over Bellman-Ford algorithm?
A.
When the graph has negative weights
B.
When the graph is dense
C.
When the graph has non-negative weights
D.
When you need to find all paths
Show solution
Solution
Dijkstra's algorithm is preferred over Bellman-Ford when the graph has non-negative weights, as it is more efficient in such cases.
Correct Answer:
C
— When the graph has non-negative weights
Learn More →
Q. In which scenario would you prefer Dijkstra's algorithm over the Bellman-Ford algorithm?
A.
When the graph has negative weight edges
B.
When the graph is dense
C.
When the graph has non-negative weights
D.
When you need to find all pairs shortest paths
Show solution
Solution
Dijkstra's algorithm is preferred when the graph has non-negative weights, as it is more efficient than Bellman-Ford in such cases.
Correct Answer:
C
— When the graph has non-negative weights
Learn More →
Q. In which scenario would you prefer hierarchical clustering over K-means?
A.
When the number of clusters is known
B.
When the dataset is very large
C.
When you need a visual representation of the clustering process
D.
When clusters are expected to be spherical
Show solution
Solution
Hierarchical clustering is preferred when a visual representation of the clustering process is needed, as it provides a dendrogram.
Correct Answer:
C
— When you need a visual representation of the clustering process
Learn More →
Q. In which scenario would you prefer linear regression over other algorithms?
A.
When the relationship between variables is non-linear
B.
When you need to classify data into categories
C.
When you want to predict a continuous outcome with a linear relationship
D.
When the dataset is very small
Show solution
Solution
Linear regression is preferred when predicting a continuous outcome variable that has a linear relationship with the independent variables.
Correct Answer:
C
— When you want to predict a continuous outcome with a linear relationship
Learn More →
Q. In which scenario would you prefer Merge Sort over Quick Sort?
A.
When memory usage is a concern
B.
When sorting linked lists
C.
When the dataset is small
D.
When the data is mostly sorted
Show solution
Solution
Merge Sort is preferred for linked lists because it can be implemented without additional space for arrays.
Correct Answer:
B
— When sorting linked lists
Learn More →
Q. In which scenario would you prefer the Bellman-Ford algorithm over Dijkstra's algorithm?
A.
When all edge weights are positive
B.
When the graph is dense
C.
When there are negative weight edges
D.
When you need the shortest path in constant time
Show solution
Solution
You would prefer the Bellman-Ford algorithm when the graph contains negative weight edges, as Dijkstra's algorithm cannot handle them.
Correct Answer:
C
— When there are negative weight edges
Learn More →
Q. In which scenario would you prefer using a Decision Tree over a Random Forest?
A.
When interpretability is crucial.
B.
When you have a very large dataset.
C.
When you need high accuracy.
D.
When computational resources are limited.
Show solution
Solution
Decision Trees are easier to interpret, making them preferable when interpretability is crucial.
Correct Answer:
A
— When interpretability is crucial.
Learn More →
Q. In which scenario would you prefer using a linear regression model?
A.
When the outcome variable is categorical
B.
When the relationship between variables is non-linear
C.
When you need to predict a continuous variable based on other continuous variables
D.
When you have a small dataset
Show solution
Solution
Linear regression is preferred when predicting a continuous outcome variable based on one or more continuous predictor variables.
Correct Answer:
C
— When you need to predict a continuous variable based on other continuous variables
Learn More →
Q. In which scenario would you prefer using a queue over a stack?
A.
When you need to reverse elements
B.
When you need to process elements in the order they were added
C.
When you need to access the last added element
D.
When you need to sort elements
Show solution
Solution
A queue is preferred when processing elements in the order they were added (FIFO), such as in task scheduling.
Correct Answer:
B
— When you need to process elements in the order they were added
Learn More →
Q. In which scenario would you prefer using a Random Forest over a Decision Tree?
A.
When interpretability is the main concern.
B.
When you have a small dataset.
C.
When you need high accuracy and robustness.
D.
When computational resources are limited.
Show solution
Solution
Random Forest is preferred for high accuracy and robustness, especially in larger datasets where overfitting is a concern.
Correct Answer:
C
— When you need high accuracy and robustness.
Learn More →
Q. In which scenario would you prefer using a Random Forest over a single Decision Tree?
A.
When interpretability is the main concern
B.
When you have a small dataset
C.
When you need higher accuracy and robustness
D.
When computational resources are limited
Show solution
Solution
Random Forests are preferred when higher accuracy and robustness are needed, especially in larger datasets.
Correct Answer:
C
— When you need higher accuracy and robustness
Learn More →
Q. In which scenario would you prefer using a Red-Black tree over an AVL tree?
A.
When frequent insertions and deletions are expected
B.
When memory usage is a critical factor
C.
When the dataset is static
D.
When search operations are the most frequent
Show solution
Solution
Red-Black trees are generally preferred when there are frequent insertions and deletions because they require fewer rotations to maintain balance compared to AVL trees.
Correct Answer:
A
— When frequent insertions and deletions are expected
Learn More →
Q. In which scenario would you prefer using a serverless architecture for model deployment?
A.
When you need constant high traffic
B.
When you want to minimize operational overhead
C.
When you require low latency
D.
When you need to manage complex infrastructure
Show solution
Solution
A serverless architecture is preferred when you want to minimize operational overhead, as it automatically scales based on demand.
Correct Answer:
B
— When you want to minimize operational overhead
Learn More →
Q. In which scenario would you prefer using a stack over a queue?
A.
When you need to process tasks in the order they arrive
B.
When you need to backtrack through a series of operations
C.
When you need to manage tasks with priority
D.
When you need to store data persistently
Show solution
Solution
Stacks are useful for backtracking scenarios, such as undo operations in applications.
Correct Answer:
B
— When you need to backtrack through a series of operations
Learn More →
Q. In which scenario would you prefer using an AVL tree over a Red-Black tree?
A.
When frequent insertions and deletions are required.
B.
When search operations are more frequent than insertions.
C.
When memory usage is a concern.
D.
When the tree needs to be unbalanced.
Show solution
Solution
AVL trees provide faster lookups than Red-Black trees, making them preferable when search operations are more frequent.
Correct Answer:
B
— When search operations are more frequent than insertions.
Learn More →
Showing 631 to 660 of 3237 (108 Pages)