Q. In a clustering case study, which of the following is a real-world application?
A.
Spam detection in emails
B.
Customer segmentation in marketing
C.
Predicting stock prices
D.
Image classification
Show solution
Solution
Customer segmentation in marketing is a common application of clustering to identify distinct customer groups.
Correct Answer:
B
— Customer segmentation in marketing
Learn More →
Q. In a complete binary tree, how many nodes are there at height 'h'?
A.
h + 1
B.
2^h
C.
2^(h+1) - 1
D.
h^2
Show solution
Solution
In a complete binary tree, the number of nodes at height 'h' is 2^(h+1) - 1.
Correct Answer:
C
— 2^(h+1) - 1
Learn More →
Q. In a complete binary tree, how many nodes are there at level k?
A.
2^k
B.
2^(k+1)
C.
2^(k-1)
D.
k^2
Show solution
Solution
In a complete binary tree, the number of nodes at level k is given by 2^k, where k starts from 0 for the root level.
Correct Answer:
A
— 2^k
Learn More →
Q. In a complete binary tree, how many nodes are there at the last level if the total number of levels is 'h'?
A.
2^(h-1)
B.
2^h
C.
2^(h+1)
D.
2^(h-1) - 1
Show solution
Solution
In a complete binary tree, the last level can have up to 2^(h-1) nodes, where h is the total number of levels.
Correct Answer:
A
— 2^(h-1)
Learn More →
Q. In a complete binary tree, what is the maximum number of nodes at level 'h'?
A.
2^h
B.
2^(h+1) - 1
C.
h^2
D.
h!
Show solution
Solution
In a complete binary tree, the maximum number of nodes at level 'h' is 2^h.
Correct Answer:
A
— 2^h
Learn More →
Q. In a complete binary tree, what is the relationship between the number of nodes and the height?
A.
Height = log(n)
B.
Height = n
C.
Height = n/2
D.
Height = n^2
Show solution
Solution
In a complete binary tree, the height is approximately log(n), where n is the number of nodes.
Correct Answer:
A
— Height = log(n)
Learn More →
Q. In a complete binary tree, what is the relationship between the number of nodes and the height of the tree?
A.
Nodes = 2^height
B.
Nodes = 2^(height + 1) - 1
C.
Nodes = height^2
D.
Nodes = height!
Show solution
Solution
In a complete binary tree, the number of nodes is given by the formula Nodes = 2^(height + 1) - 1.
Correct Answer:
B
— Nodes = 2^(height + 1) - 1
Learn More →
Q. In a complete binary tree, what is the time complexity of DFS?
A.
O(log n)
B.
O(n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
In a complete binary tree, the time complexity of DFS is O(n) as it visits every node once.
Correct Answer:
B
— O(n)
Learn More →
Q. In a confusion matrix, what does the term 'specificity' refer to?
A.
True Positive Rate
B.
False Positive Rate
C.
True Negative Rate
D.
False Negative Rate
Show solution
Solution
Specificity is the True Negative Rate, indicating the proportion of actual negatives that are correctly identified.
Correct Answer:
C
— True Negative Rate
Learn More →
Q. In a Decision Tree, what does the Gini impurity measure?
A.
The accuracy of the model.
B.
The likelihood of misclassifying a randomly chosen element.
C.
The depth of the tree.
D.
The number of features used.
Show solution
Solution
Gini impurity measures the likelihood of misclassifying a randomly chosen element from the dataset, helping to determine the best splits.
Correct Answer:
B
— The likelihood of misclassifying a randomly chosen element.
Learn More →
Q. In a Decision Tree, what does the term 'Gini impurity' refer to?
A.
A measure of the tree's depth
B.
A metric for evaluating model performance
C.
A criterion for splitting nodes
D.
A method for pruning trees
Show solution
Solution
Gini impurity is a criterion used to measure the impurity of a node, helping to determine the best feature to split on.
Correct Answer:
C
— A criterion for splitting nodes
Learn More →
Q. In a Decision Tree, what does the term 'node' refer to?
A.
A point where a decision is made.
B.
The final output of the tree.
C.
The data used to train the model.
D.
The overall structure of the tree.
Show solution
Solution
A 'node' in a Decision Tree is where a decision is made based on the feature values.
Correct Answer:
A
— A point where a decision is made.
Learn More →
Q. In a depth-first search, what happens when a node is visited?
A.
It is added to the queue.
B.
It is marked as visited and all its adjacent nodes are explored.
C.
It is removed from the graph.
D.
It is added to the stack.
Show solution
Solution
In DFS, when a node is visited, it is marked as visited and all its adjacent nodes are explored.
Correct Answer:
B
— It is marked as visited and all its adjacent nodes are explored.
Learn More →
Q. In a double-ended queue (deque), which operations can be performed at both ends?
A.
Enqueue only
B.
Dequeue only
C.
Enqueue and Dequeue
D.
None
Show solution
Solution
A double-ended queue (deque) allows both enqueue and dequeue operations to be performed at both ends, making it more flexible than a standard queue.
Correct Answer:
C
— Enqueue and Dequeue
Learn More →
Q. In a doubly linked list, how do you delete a node given only a pointer to that node?
A.
Set next and previous pointers
B.
Traverse from head
C.
Use a stack
D.
Not possible
Show solution
Solution
In a doubly linked list, you can delete a node by adjusting the next and previous pointers of the adjacent nodes.
Correct Answer:
A
— Set next and previous pointers
Learn More →
Q. In a doubly linked list, how many pointers does each node contain?
A.
One
B.
Two
C.
Three
D.
Four
Show solution
Solution
Each node in a doubly linked list contains two pointers: one to the next node and one to the previous node.
Correct Answer:
B
— Two
Learn More →
Q. In a doubly linked list, what is the time complexity for deleting a node given a pointer to that node?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
Deletion of a node in a doubly linked list can be done in O(1) time if you have a pointer to the node.
Correct Answer:
A
— O(1)
Learn More →
Q. In a doubly linked list, what is the time complexity of deleting a node given a pointer to that node?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
If you have a pointer to the node to be deleted, you can adjust the pointers of the adjacent nodes in constant time, so the time complexity is O(1).
Correct Answer:
A
— O(1)
Learn More →
Q. In a doubly linked list, what is the time complexity of inserting a new node after a given node?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
Inserting a new node after a given node in a doubly linked list involves changing a few pointers, which takes constant time, hence O(1).
Correct Answer:
A
— O(1)
Learn More →
Q. In a dynamic programming approach, what is the primary technique used to optimize recursive solutions?
A.
Memoization
B.
Backtracking
C.
Greedy Method
D.
Divide and Conquer
Show solution
Solution
Memoization is the technique used in dynamic programming to store the results of expensive function calls and reuse them when the same inputs occur again.
Correct Answer:
A
— Memoization
Learn More →
Q. In a dynamic programming solution for the Longest Common Subsequence (LCS), what does the DP table represent?
A.
The length of the LCS
B.
The characters of the LCS
C.
The indices of the LCS
D.
The number of subsequences
Show solution
Solution
The DP table in LCS represents the length of the longest common subsequence between two strings.
Correct Answer:
A
— The length of the LCS
Learn More →
Q. In a feature engineering case study, what is the role of domain knowledge?
A.
To automate model training
B.
To inform feature selection and creation
C.
To evaluate model performance
D.
To visualize data
Show solution
Solution
Domain knowledge helps identify relevant features that can significantly impact model performance.
Correct Answer:
B
— To inform feature selection and creation
Learn More →
Q. In a graph represented as an adjacency list, what is the space complexity of storing the graph?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(V^2)
Show solution
Solution
The space complexity of storing a graph in an adjacency list is O(V + E), where V is the number of vertices and E is the number of edges.
Correct Answer:
C
— O(V + E)
Learn More →
Q. In a graph represented as an adjacency list, what is the space complexity?
A.
O(V + E)
B.
O(V^2)
C.
O(E)
D.
O(V)
Show solution
Solution
The space complexity of a graph represented as an adjacency list is O(V + E), where V is the number of vertices and E is the number of edges.
Correct Answer:
A
— O(V + E)
Learn More →
Q. In a graph represented by an adjacency list, what is the space complexity?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(V * E)
Show solution
Solution
The space complexity of a graph represented by an adjacency list is O(V + E), where V is the number of vertices and E is the number of edges.
Correct Answer:
C
— O(V + E)
Learn More →
Q. In a graph with V vertices and E edges, what is the time complexity of DFS?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(V * E)
Show solution
Solution
DFS has a time complexity of O(V + E) as it visits each vertex and edge once.
Correct Answer:
C
— O(V + E)
Learn More →
Q. In a graph, if all edges have the same weight, which algorithm can be used to find the shortest path?
A.
Dijkstra's algorithm
B.
Breadth-First Search (BFS)
C.
Depth-First Search (DFS)
D.
A* Search
Show solution
Solution
When all edges have the same weight, Breadth-First Search (BFS) can be used to find the shortest path.
Correct Answer:
B
— Breadth-First Search (BFS)
Learn More →
Q. In a graph, if there are multiple paths to a node, how does Dijkstra's algorithm determine which path to take?
A.
It chooses the path with the most edges
B.
It chooses the path with the least weight
C.
It randomly selects a path
D.
It chooses the first path it encounters
Show solution
Solution
Dijkstra's algorithm always chooses the path with the least cumulative weight to ensure the shortest path is found.
Correct Answer:
B
— It chooses the path with the least weight
Learn More →
Q. In a graph, if there are multiple paths to reach a node, how does Dijkstra's algorithm choose the path?
A.
It chooses the path with the maximum weight
B.
It chooses the path with the minimum weight
C.
It chooses the first path it encounters
D.
It randomly selects a path
Show solution
Solution
Dijkstra's algorithm always chooses the path with the minimum weight to ensure the shortest path is found.
Correct Answer:
B
— It chooses the path with the minimum weight
Learn More →
Q. In a graph, if you want to check for cycles, which traversal method is more suitable?
A.
BFS
B.
DFS
C.
Both are equally suitable
D.
Neither can check for cycles
Show solution
Solution
DFS is more suitable for cycle detection as it can track back edges effectively.
Correct Answer:
B
— DFS
Learn More →
Showing 241 to 270 of 3237 (108 Pages)