Q. In Python, which data structure can be used to implement a stack?
A.
List
B.
Dictionary
C.
Set
D.
Tuple
Show solution
Solution
A stack can be implemented using a list in Python, utilizing append() and pop() methods.
Correct Answer:
A
— List
Learn More →
Q. In Python, which library can be used to implement Dijkstra's algorithm efficiently?
A.
NumPy
B.
NetworkX
C.
Pandas
D.
Matplotlib
Show solution
Solution
The NetworkX library in Python provides efficient implementations for graph algorithms, including Dijkstra's algorithm.
Correct Answer:
B
— NetworkX
Learn More →
Q. In Python, which of the following is a correct implementation of binary search?
A.
def binary_search(arr, x): ...
B.
def binary_search(arr, x): return arr.index(x)
C.
def binary_search(arr, x): for i in arr: if i == x: return i
D.
def binary_search(arr, x): while arr: ...
Show solution
Solution
The correct implementation of binary search involves a function that takes an array and a target value, and uses a loop to narrow down the search.
Correct Answer:
A
— def binary_search(arr, x): ...
Learn More →
Q. In Quick Sort, what is the effect of choosing a bad pivot?
A.
Increased space complexity
B.
Increased time complexity
C.
Decreased time complexity
D.
No effect
Show solution
Solution
Choosing a bad pivot can lead to increased time complexity, potentially degrading to O(n^2) in the worst case.
Correct Answer:
B
— Increased time complexity
Learn More →
Q. In Quick Sort, what is the role of the pivot element?
A.
To divide the array
B.
To sort the array
C.
To merge the arrays
D.
To find the median
Show solution
Solution
The pivot element in Quick Sort is used to divide the array into two parts, elements less than the pivot and elements greater than the pivot.
Correct Answer:
A
— To divide the array
Learn More →
Q. In Quick Sort, what is the role of the pivot?
A.
To divide the array
B.
To sort the array
C.
To merge the array
D.
To find the maximum element
Show solution
Solution
In Quick Sort, the pivot is used to divide the array into two parts: elements less than the pivot and elements greater than the pivot.
Correct Answer:
A
— To divide the array
Learn More →
Q. In Random Forests, how are individual trees typically trained?
A.
On the entire dataset.
B.
On a random subset of the data.
C.
Using only the most important features.
D.
With no data at all.
Show solution
Solution
Individual trees in Random Forests are trained on random subsets of the data, which helps to create diversity among the trees.
Correct Answer:
B
— On a random subset of the data.
Learn More →
Q. In Random Forests, how are the individual trees trained?
A.
On the entire dataset without any modifications.
B.
Using a bootstrapped sample of the dataset.
C.
On a subset of features only.
D.
Using the same random seed for all trees.
Show solution
Solution
Individual trees in Random Forests are trained using bootstrapped samples of the dataset, which helps to create diversity among the trees.
Correct Answer:
B
— Using a bootstrapped sample of the dataset.
Learn More →
Q. In Random Forests, how are the trees typically constructed?
A.
Using all features for each split.
B.
Using a random subset of features for each split.
C.
Using only the most important feature.
D.
Using a fixed number of features for all trees.
Show solution
Solution
Random Forests use a random subset of features for each split, which helps in reducing correlation among trees.
Correct Answer:
B
— Using a random subset of features for each split.
Learn More →
Q. In Random Forests, what does 'bagging' refer to?
A.
Using all available features for each tree.
B.
Randomly selecting subsets of data to train each tree.
C.
Combining predictions from multiple models.
D.
Pruning trees to improve performance.
Show solution
Solution
Bagging refers to randomly selecting subsets of data to train each tree, which helps to reduce variance and improve model robustness.
Correct Answer:
B
— Randomly selecting subsets of data to train each tree.
Learn More →
Q. In Random Forests, what does the term 'feature randomness' refer to?
A.
Randomly selecting features for each tree
B.
Randomly selecting data points for training
C.
Randomly assigning labels to data
D.
Randomly adjusting tree depth
Show solution
Solution
Feature randomness refers to the practice of randomly selecting a subset of features for each tree in the forest, which helps to create diverse models.
Correct Answer:
A
— Randomly selecting features for each tree
Learn More →
Q. In Random Forests, what does the term 'out-of-bag error' refer to?
A.
Error on the training set
B.
Error on unseen data
C.
Error calculated from the samples not used in training a tree
D.
Error from the final ensemble model
Show solution
Solution
Out-of-bag error is an estimate of the model's performance calculated using the data points that were not included in the bootstrap sample for each tree.
Correct Answer:
C
— Error calculated from the samples not used in training a tree
Learn More →
Q. In Random Forests, what is the purpose of bootstrapping?
A.
To reduce the number of features
B.
To create multiple subsets of the training data
C.
To increase the depth of trees
D.
To improve interpretability
Show solution
Solution
Bootstrapping involves creating multiple subsets of the training data by sampling with replacement, which helps in building diverse trees in Random Forests.
Correct Answer:
B
— To create multiple subsets of the training data
Learn More →
Q. In regression analysis, what does R-squared indicate?
A.
The strength of the relationship between variables
B.
The proportion of variance explained by the model
C.
The accuracy of predictions
D.
The number of features used in the model
Show solution
Solution
R-squared indicates the proportion of variance in the dependent variable that can be explained by the independent variables in the model.
Correct Answer:
B
— The proportion of variance explained by the model
Learn More →
Q. In regression analysis, what does the term 'overfitting' refer to?
A.
The model performs well on training data but poorly on unseen data
B.
The model is too simple to capture the underlying trend
C.
The model has too few features
D.
The model is perfectly accurate
Show solution
Solution
Overfitting occurs when a model learns the training data too well, capturing noise instead of the underlying pattern, leading to poor performance on unseen data.
Correct Answer:
A
— The model performs well on training data but poorly on unseen data
Learn More →
Q. In regression tasks, which metric is typically used to measure the difference between predicted and actual values?
A.
F1 Score
B.
Mean Absolute Error
C.
Confusion Matrix
D.
Precision
Show solution
Solution
Mean Absolute Error (MAE) is used in regression tasks to quantify the average absolute difference between predicted and actual values.
Correct Answer:
B
— Mean Absolute Error
Learn More →
Q. In reinforcement learning, what is an 'agent'?
A.
A data point in a dataset
B.
A model that predicts outcomes
C.
An entity that takes actions in an environment
D.
A method for evaluating performance
Show solution
Solution
An agent is the entity that interacts with the environment by taking actions to achieve a goal.
Correct Answer:
C
— An entity that takes actions in an environment
Learn More →
Q. In supervised learning, what does overfitting refer to?
A.
Model performs well on training data but poorly on unseen data
B.
Model performs poorly on both training and unseen data
C.
Model generalizes well to new data
D.
Model is too simple to capture the underlying trend
Show solution
Solution
Overfitting occurs when a model learns the training data too well, capturing noise and failing to generalize to new data.
Correct Answer:
A
— Model performs well on training data but poorly on unseen data
Learn More →
Q. In supervised learning, what is the primary goal of regression algorithms?
A.
To classify data into categories
B.
To predict continuous outcomes
C.
To cluster similar data points
D.
To reduce dimensionality
Show solution
Solution
The primary goal of regression algorithms in supervised learning is to predict continuous outcomes based on input features.
Correct Answer:
B
— To predict continuous outcomes
Learn More →
Q. In supervised learning, what is the primary purpose of the training dataset?
A.
To evaluate model performance
B.
To make predictions on new data
C.
To train the model on known outcomes
D.
To visualize data distributions
Show solution
Solution
The training dataset is used to train the model on known outcomes, allowing it to learn the relationship between input features and target labels.
Correct Answer:
C
— To train the model on known outcomes
Learn More →
Q. In supervised learning, what is the role of the target variable?
A.
To provide input features for the model
B.
To evaluate the model's performance
C.
To serve as the output that the model predicts
D.
To determine the model's complexity
Show solution
Solution
The target variable is the output that the model aims to predict based on the input features.
Correct Answer:
C
— To serve as the output that the model predicts
Learn More →
Q. In supervised learning, what is the role of the training dataset?
A.
To evaluate the model's performance
B.
To tune hyperparameters
C.
To train the model to learn patterns
D.
To visualize data
Show solution
Solution
The training dataset is used to train the model, allowing it to learn patterns and relationships in the data.
Correct Answer:
C
— To train the model to learn patterns
Learn More →
Q. In supervised learning, what is the role of the training set?
A.
To evaluate the model's performance
B.
To tune hyperparameters
C.
To train the model on labeled data
D.
To visualize the data
Show solution
Solution
The training set is used to train the model by providing it with labeled data, allowing it to learn the relationship between inputs and outputs.
Correct Answer:
C
— To train the model on labeled data
Learn More →
Q. In SVM, what are support vectors?
A.
Data points that are farthest from the decision boundary
B.
Data points that lie on the decision boundary
C.
Data points that are misclassified
D.
All data points in the dataset
Show solution
Solution
Support vectors are the data points that lie closest to the decision boundary and are critical in defining the position of the hyperplane.
Correct Answer:
B
— Data points that lie on the decision boundary
Learn More →
Q. In SVM, what does the term 'support vectors' refer to?
A.
Data points that are farthest from the decision boundary
B.
Data points that lie on the decision boundary
C.
All data points in the dataset
D.
Data points that are misclassified
Show solution
Solution
Support vectors are the data points that lie closest to the decision boundary and are critical in defining the position and orientation of the boundary.
Correct Answer:
B
— Data points that lie on the decision boundary
Learn More →
Q. In syntax-directed translation, what does an attribute represent?
A.
A semantic value associated with a grammar symbol
B.
A token type in lexical analysis
C.
A machine instruction in code generation
D.
A parsing strategy
Show solution
Solution
An attribute represents a semantic value associated with a grammar symbol in syntax-directed translation.
Correct Answer:
A
— A semantic value associated with a grammar symbol
Learn More →
Q. In syntax-directed translation, what is an intermediate code?
A.
A high-level representation of the source code
B.
A low-level machine code
C.
A representation that is easier to optimize than source code
D.
A representation that is not used in modern compilers
Show solution
Solution
Intermediate code is a representation that is easier to optimize than the original source code.
Correct Answer:
C
— A representation that is easier to optimize than source code
Learn More →
Q. In syntax-directed translation, what is the role of semantic actions?
A.
To define the grammar
B.
To perform type checking
C.
To generate intermediate code
D.
To handle syntax errors
Show solution
Solution
Semantic actions in syntax-directed translation are used to generate intermediate code based on the parse tree.
Correct Answer:
C
— To generate intermediate code
Learn More →
Q. In syntax-directed translation, which of the following is true about synthesized attributes?
A.
They are computed from the attributes of the parent node
B.
They are computed from the attributes of the child nodes
C.
They can only be used in inherited attributes
D.
They are not used in syntax-directed definitions
Show solution
Solution
Synthesized attributes are computed from the attributes of the child nodes in syntax-directed translation.
Correct Answer:
B
— They are computed from the attributes of the child nodes
Learn More →
Q. In TCP/IP, which layer corresponds to the OSI Transport Layer?
A.
Application Layer
B.
Internet Layer
C.
Transport Layer
D.
Network Access Layer
Show solution
Solution
The Transport Layer in TCP/IP corresponds directly to the OSI Transport Layer, handling end-to-end communication.
Correct Answer:
C
— Transport Layer
Learn More →
Showing 451 to 480 of 3237 (108 Pages)