Q. If you have a sorted array of 1000 elements, how many iterations will binary search take to find an element?
Show solution
Solution
Binary search will take log2(1000) which is approximately 9.97, so it will take at most 10 iterations.
Correct Answer:
B
— 9
Learn More →
Q. If you have a sorted array of 1000 elements, how many iterations will binary search take at most?
Show solution
Solution
Binary search will take at most log2(1000) which is approximately 10 iterations.
Correct Answer:
A
— 10
Learn More →
Q. In a /16 subnet, what is the range of valid host addresses for the network 172.16.0.0?
A.
172.16.0.1 to 172.16.255.254
B.
172.16.0.0 to 172.16.255.255
C.
172.16.0.0 to 172.16.0.255
D.
172.16.1.0 to 172.16.1.255
Show solution
Solution
In a /16 subnet, the valid host range is from 172.16.0.1 to 172.16.255.254, with 172.16.0.0 as the network address and 172.16.255.255 as the broadcast address.
Correct Answer:
A
— 172.16.0.1 to 172.16.255.254
Learn More →
Q. In a binary classification problem using SVM, what does a decision boundary represent?
A.
The line that separates the two classes
B.
The average of all data points
C.
The centroid of the data points
D.
The area of overlap between classes
Show solution
Solution
The decision boundary in SVM represents the hyperplane that separates the two classes in the feature space.
Correct Answer:
A
— The line that separates the two classes
Learn More →
Q. In a binary classification problem, what does a confusion matrix represent?
A.
The relationship between features
B.
The performance of the model on training data
C.
The true positive, false positive, true negative, and false negative counts
D.
The distribution of the target variable
Show solution
Solution
A confusion matrix summarizes the performance of a classification model by showing the counts of true positives, false positives, true negatives, and false negatives.
Correct Answer:
C
— The true positive, false positive, true negative, and false negative counts
Learn More →
Q. In a binary classification problem, what does a high precision indicate?
A.
High true positive rate
B.
Low false positive rate
C.
High true negative rate
D.
Low false negative rate
Show solution
Solution
High precision indicates that when the model predicts a positive class, it is correct most of the time, meaning low false positives.
Correct Answer:
B
— Low false positive rate
Learn More →
Q. In a binary classification problem, what does a high recall indicate?
A.
High true positive rate
B.
High false positive rate
C.
Low true negative rate
D.
Low false negative rate
Show solution
Solution
High recall indicates that the model correctly identifies a large proportion of actual positive cases.
Correct Answer:
A
— High true positive rate
Learn More →
Q. In a binary classification problem, what does a high value of the margin indicate?
A.
The model is likely to overfit
B.
The model has a high bias
C.
The model is more robust to noise
D.
The model is underfitting
Show solution
Solution
A high value of the margin indicates that the model is more robust to noise and is likely to generalize better.
Correct Answer:
C
— The model is more robust to noise
Learn More →
Q. In a binary classification, what does a high recall indicate?
A.
The model is good at identifying negative cases
B.
The model is good at identifying positive cases
C.
The model has a high number of false positives
D.
The model has a high number of false negatives
Show solution
Solution
High recall indicates that the model is effective at identifying most of the actual positive cases.
Correct Answer:
B
— The model is good at identifying positive cases
Learn More →
Q. In a binary search algorithm, if the middle element is greater than the target, what should be done next?
A.
Search the left half
B.
Search the right half
C.
Return the middle element
D.
Increase the middle index
Show solution
Solution
If the middle element is greater than the target, the search continues in the left half of the array.
Correct Answer:
A
— Search the left half
Learn More →
Q. In a binary search algorithm, if the target is less than the mid element, what should be the next step?
A.
Search the right half
B.
Search the left half
C.
Return the mid index
D.
Increase the mid index
Show solution
Solution
If the target is less than the mid element, the search should continue in the left half of the array.
Correct Answer:
B
— Search the left half
Learn More →
Q. In a binary search algorithm, if the target is less than the mid value, what should be the next step?
A.
Search the left half of the array
B.
Search the right half of the array
C.
Return the mid index
D.
Increase the mid index
Show solution
Solution
If the target is less than the mid value, the next step is to search the left half of the array.
Correct Answer:
A
— Search the left half of the array
Learn More →
Q. In a binary search algorithm, what happens if the middle element is equal to the target?
A.
Search continues in the left half
B.
Search continues in the right half
C.
Target is found
D.
Search terminates immediately
Show solution
Solution
If the middle element is equal to the target, the search is successful and the target is found.
Correct Answer:
C
— Target is found
Learn More →
Q. In a binary search algorithm, what happens if the middle element is less than the target?
A.
Search the left half
B.
Search the right half
C.
Return the middle element
D.
Terminate the search
Show solution
Solution
If the middle element is less than the target, the search continues in the right half of the array.
Correct Answer:
B
— Search the right half
Learn More →
Q. In a binary search algorithm, what happens if the target is less than the mid value?
A.
Search the right half
B.
Search the left half
C.
Return the mid index
D.
Increase the mid index
Show solution
Solution
If the target is less than the mid value, the search continues in the left half of the array.
Correct Answer:
B
— Search the left half
Learn More →
Q. In a binary search algorithm, what happens if the target is less than the middle element?
A.
Search the right half
B.
Search the left half
C.
Return the middle element
D.
End the search
Show solution
Solution
If the target is less than the middle element, the search continues in the left half of the array.
Correct Answer:
B
— Search the left half
Learn More →
Q. In a binary search algorithm, what happens to the search space after each comparison?
A.
It doubles
B.
It remains the same
C.
It halves
D.
It increases linearly
Show solution
Solution
After each comparison in binary search, the search space is halved, which is why it is efficient.
Correct Answer:
C
— It halves
Learn More →
Q. In a binary search implementation, if the target is less than the mid value, what should be the next step?
A.
Search the right half
B.
Search the left half
C.
Return the mid index
D.
Increase the mid index
Show solution
Solution
If the target is less than the mid value, the search should continue in the left half of the array.
Correct Answer:
B
— Search the left half
Learn More →
Q. In a binary search implementation, what condition is checked to determine if the search should continue?
A.
If the target is less than the middle element
B.
If the target is greater than the middle element
C.
If the target is equal to the middle element
D.
All of the above
Show solution
Solution
All these conditions are checked to decide whether to continue searching in the left half, right half, or if the target is found.
Correct Answer:
D
— All of the above
Learn More →
Q. In a binary search implementation, what happens if the target is less than the mid value?
A.
Search the right half
B.
Search the left half
C.
Return mid
D.
End the search
Show solution
Solution
If the target is less than the mid value, the search continues in the left half of the array.
Correct Answer:
B
— Search the left half
Learn More →
Q. In a binary search implementation, what is the condition to continue searching?
A.
left <= right
B.
left < right
C.
left < mid
D.
mid < right
Show solution
Solution
The search continues as long as the left index is less than or equal to the right index.
Correct Answer:
A
— left <= right
Learn More →
Q. In a binary search implementation, what is the purpose of the 'mid' variable?
A.
To store the maximum value
B.
To find the middle index
C.
To count iterations
D.
To store the minimum value
Show solution
Solution
'mid' is used to find the middle index of the current search range to compare with the target value.
Correct Answer:
B
— To find the middle index
Learn More →
Q. In a binary search implementation, what is the role of the 'low' and 'high' variables?
A.
To store the size of the array
B.
To track the current search range
C.
To count the number of iterations
D.
To store the target value
Show solution
Solution
'low' and 'high' define the current range of indices being searched in the array.
Correct Answer:
B
— To track the current search range
Learn More →
Q. In a binary search tree (BST), how does binary search differ from searching in a sorted array?
A.
It is slower
B.
It requires more comparisons
C.
It can be done in O(1)
D.
It uses tree properties
Show solution
Solution
In a binary search tree, the search leverages the tree structure, allowing for efficient searching based on the properties of BSTs.
Correct Answer:
D
— It uses tree properties
Learn More →
Q. In a binary search tree, how does binary search help in finding an element?
A.
By traversing all nodes
B.
By comparing with the root and deciding left or right
C.
By using a queue
D.
By using a stack
Show solution
Solution
In a binary search tree, binary search helps by comparing the target with the root and deciding whether to go left or right based on the value.
Correct Answer:
B
— By comparing with the root and deciding left or right
Learn More →
Q. In a binary search tree, what is the average time complexity for searching an element?
A.
O(1)
B.
O(log n)
C.
O(n)
D.
O(n log n)
Show solution
Solution
The average time complexity for searching an element in a balanced binary search tree is O(log n).
Correct Answer:
B
— O(log n)
Learn More →
Q. In a binary search tree, what is the maximum number of nodes at depth 'd'?
A.
2^d
B.
2^(d+1) - 1
C.
d^2
D.
d!
Show solution
Solution
In a binary search tree, the maximum number of nodes at depth 'd' is 2^d, as each node can have two children.
Correct Answer:
A
— 2^d
Learn More →
Q. In a binary search tree, what is the time complexity for inserting an element in the average case?
A.
O(1)
B.
O(log n)
C.
O(n)
D.
O(n log n)
Show solution
Solution
In a balanced binary search tree, the average-case time complexity for insertion is O(log n).
Correct Answer:
B
— O(log n)
Learn More →
Q. In a binary search tree, what is the time complexity for searching for an element in the average case?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n log n)
Show solution
Solution
In a balanced binary search tree, the average time complexity for searching an element is O(log n).
Correct Answer:
C
— O(log n)
Learn More →
Q. In a binary search tree, what is the time complexity of searching for an element in the average case?
A.
O(1)
B.
O(log n)
C.
O(n)
D.
O(n log n)
Show solution
Solution
In a balanced binary search tree, the average time complexity for searching an element is O(log n).
Correct Answer:
B
— O(log n)
Learn More →
Showing 151 to 180 of 3237 (108 Pages)