First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Foundations of Artificial Intelligence and Machine Learning
In supervised learning, what does the training label for each example represent?
- The learning rate applied during gradient descent
- A randomly assigned identifier used only for shuffling
- The target output the model should learn to predict Correct answer.
- The number of features available in the dataset
Explanation
A label is the desired output paired with an input example, and supervised learning fits a mapping from inputs to those labels. Unlabeled data cannot directly provide this signal.
Question 2Foundations of Artificial Intelligence and Machine Learning
Which task is a canonical example of unsupervised learning?
- Clustering customers by purchasing behavior without labels Correct answer.
- Predicting a house price from its features
- Estimating a probability from labeled training data
- Classifying emails as spam or not spam using labeled examples
Explanation
Unsupervised learning finds structure in data without target labels; clustering is the standard example. The other tasks all rely on labeled targets, making them supervised.
Question 3Foundations of Artificial Intelligence and Machine Learning
A model performs very well on training data but poorly on unseen test data. What is this pattern called?
- Overfitting Correct answer.
- Regularization
- Underfitting
- Normalization
Explanation
Overfitting occurs when a model captures noise or idiosyncrasies of the training set and fails to generalize. The gap between high training performance and low test performance is its signature.
Question 4Foundations of Artificial Intelligence and Machine Learning
What is the primary purpose of splitting data into training and test sets?
- To estimate how well the model generalizes to unseen data Correct answer.
- To increase the size of the training dataset
- To guarantee the model achieves zero training error
- To reduce the number of features used by the model
Explanation
Holding out data that the model never sees during fitting gives an unbiased estimate of generalization performance. Evaluating on training data alone overstates quality.
Question 5Foundations of Artificial Intelligence and Machine Learning
Which quantity does the learning rate control in gradient-based optimization?
- The proportion of data used for validation
- The number of layers in the network
- The number of output classes
- The size of the parameter update at each step Correct answer.
Explanation
The learning rate scales the gradient when updating parameters, so it sets the step size taken toward lower loss. Too large a value can diverge; too small a value converges slowly.
Question 6Foundations of Artificial Intelligence and Machine Learning
In a neural network, what is the role of an activation function?
- To normalize the input features before the first layer
- To introduce nonlinearity so the network can model complex mappings Correct answer.
- To compute the loss between predictions and labels
- To store the learned weights between training epochs
Explanation
Stacked linear layers collapse into a single linear map, so nonlinear activation functions are needed for the network to represent nonlinear relationships. They are applied to layer pre-activations.
Question 7Foundations of Artificial Intelligence and Machine Learning
Which statement best describes a decision tree's splitting criterion?
- It always splits on the feature with the largest numeric range
- It selects the split that maximizes the purity gain of the resulting children Correct answer.
- It selects a split uniformly at random among all features
- It selects the split that maximizes impurity of the child nodes
Explanation
Decision trees greedily choose splits that increase node purity, measured by criteria such as Gini impurity or information gain. The goal is to reduce impurity in the children.
Question 8Foundations of Artificial Intelligence and Machine Learning
What does the bias term contribute in a linear model such as y = w·x + b?
- It measures the variance of the training data
- It multiplies each feature by a fixed constant
- It controls the number of training iterations
- It shifts the decision boundary independently of the input features Correct answer.
Explanation
The bias b allows the model's output to be offset when all inputs are zero, shifting the hyperplane away from the origin. Without it, the boundary is forced through the origin.
Question 9Foundations of Artificial Intelligence and Machine Learning
A classification model outputs probabilities. Which metric directly measures the fraction of positive predictions that are actually positive?
- Precision Correct answer.
- Area under the ROC curve
- Recall
- Accuracy
Explanation
Precision is true positives divided by all predicted positives, so it answers how often a positive prediction is correct. Recall instead measures coverage of actual positives.
Question 10Foundations of Artificial Intelligence and Machine Learning
A dataset has 990 negative and 10 positive examples. A model predicts negative for every example. Which statement is accurate?
- It achieves high recall but low precision
- It achieves balanced precision and recall
- It achieves high accuracy but zero recall on the positive class Correct answer.
- It achieves high F1 despite low accuracy
Explanation
Predicting the majority class yields 99% accuracy while never detecting a positive, so recall on the positive class is zero. This illustrates why accuracy is misleading under class imbalance.
Question 11Foundations of Artificial Intelligence and Machine Learning
Why is k-fold cross-validation often preferred over a single train/test split?
- It guarantees the model will not overfit
- It removes the need for a separate held-out test set entirely
- It uses all data for both training and validation across folds, giving a more stable estimate Correct answer.
- It always produces a lower validation error than a single split
Explanation
Cross-validation rotates the validation fold so every example is used for validation once, reducing variance in the performance estimate. It does not guarantee protection from overfitting.
Question 12Foundations of Artificial Intelligence and Machine Learning
Which technique is used to mitigate overfitting by adding a penalty proportional to the magnitude of model weights?
- Dropout
- Early stopping
- Data augmentation
- L2 regularization Correct answer.
Explanation
L2 regularization adds a penalty on the squared magnitude of weights to the loss, discouraging large parameters and reducing overfitting. Dropout and early stopping are different mechanisms.
Question 13Foundations of Artificial Intelligence and Machine Learning
What is the main function of the backpropagation algorithm in training a neural network?
- To shuffle the training data between epochs
- To compute gradients of the loss with respect to each parameter using the chain rule Correct answer.
- To initialize the weights randomly before training
- To select the best architecture automatically
Explanation
Backpropagation applies the chain rule through the computational graph to obtain gradients of the loss for every parameter. Those gradients are then used by an optimizer to update weights.
Question 14Foundations of Artificial Intelligence and Machine Learning
A model with high variance is most likely to benefit from which change?
- Removing the validation set
- Increasing model complexity
- Training for more epochs without regularization
- Reducing model complexity or adding regularization Correct answer.
Explanation
High variance indicates overfitting, so simplifying the model or adding regularization reduces sensitivity to training noise. Increasing complexity would worsen the variance.
Question 15Foundations of Artificial Intelligence and Machine Learning
In k-means clustering, what does the algorithm iteratively update?
- The learning rate and the loss function
- Cluster centroids and the assignment of points to the nearest centroid Correct answer.
- The labels and the train/test split
- The number of clusters and the feature weights
Explanation
K-means alternates between assigning each point to its nearest centroid and recomputing centroids as the mean of assigned points. This minimizes within-cluster squared distance.
Question 16Foundations of Artificial Intelligence and Machine Learning
Which statement correctly distinguishes precision from recall?
- Precision measures correctness of positive predictions; recall measures coverage of actual positives Correct answer.
- Both measure the same quantity but on different datasets
- Precision applies only to regression, recall only to classification
- Precision measures coverage of actual positives; recall measures correctness of positive predictions
Explanation
Precision is true positives over predicted positives, capturing how often positive predictions are correct. Recall is true positives over actual positives, capturing how many real positives were found.
Question 17Foundations of Artificial Intelligence and Machine Learning
What does the softmax function produce for the output layer of a multi-class classifier?
- Binary outputs of zero or one for each class
- A single scalar representing the predicted class index
- The gradient of the loss with respect to inputs
- A set of values that sum to one and can be interpreted as class probabilities Correct answer.
Explanation
Softmax exponentiates logits and normalizes them so the outputs are nonnegative and sum to one, giving a probability distribution over classes. The predicted class is usually the argmax.
Question 18Foundations of Artificial Intelligence and Machine Learning
Which scenario best illustrates reinforcement learning rather than supervised learning?
- An agent learning to play a game by receiving rewards for actions Correct answer.
- Clustering unlabeled documents by topic
- Classifying images using a labeled dataset
- Fitting a regression line to labeled prices
Explanation
Reinforcement learning involves an agent interacting with an environment and learning from reward signals rather than labeled input-output pairs. The other options are supervised or unsupervised.
Question 19Foundations of Artificial Intelligence and Machine Learning
What is the purpose of a validation set during model development?
- To replace the training set when data is scarce
- To provide the final unbiased estimate of deployment performance
- To compute gradients during backpropagation
- To tune hyperparameters and select models without touching the test set Correct answer.
Explanation
The validation set guides hyperparameter choices and model selection, keeping the test set untouched for a final unbiased evaluation. Using the test set for tuning leaks information.
Question 20Foundations of Artificial Intelligence and Machine Learning
A feature has values ranging from 0.001 to 1,000,000 while another ranges from 0 to 1. Why might feature scaling matter for gradient descent?
- Scaling changes the number of training examples
- Scaling guarantees the model becomes nonlinear
- Unscaled features can make the loss surface poorly conditioned and slow convergence Correct answer.
- Scaling removes the need for a learning rate
Explanation
Features on very different scales produce elongated loss contours, causing gradient descent to zigzag and converge slowly. Standardizing features improves conditioning and speeds optimization.
Question 21Foundations of Artificial Intelligence and Machine Learning
Which statement about the bias-variance tradeoff is correct?
- Increasing model flexibility always reduces both bias and variance
- Variance is independent of the training set size
- Bias can be eliminated entirely by adding more features
- Simple models tend to have high bias, while flexible models tend to have high variance Correct answer.
Explanation
Simple models underfit with high bias, and highly flexible models overfit with high variance. The tradeoff means total error is minimized at an intermediate level of complexity.
Question 22Foundations of Artificial Intelligence and Machine Learning
Why does principal component analysis retain the components with the largest eigenvalues of the covariance matrix?
- They guarantee the transformed features are statistically independent
- They correspond to directions of maximum variance in the data
- They correspond to directions with the smallest reconstruction error and largest variance, capturing the most information Correct answer.
- They minimize the number of original features needed for classification accuracy
Explanation
PCA projects data onto orthogonal directions ordered by variance; the leading components maximize retained variance and minimize squared reconstruction error. Independence is not guaranteed by PCA.
Question 23Foundations of Artificial Intelligence and Machine Learning
A logistic regression model is trained on data where one class is rare. Which adjustment most directly addresses the imbalance during training?
- Assigning class weights inversely proportional to class frequency Correct answer.
- Increasing the learning rate substantially
- Removing the rare class from the dataset
- Adding more layers to the model
Explanation
Class weighting scales the loss contribution of each example so rare-class errors matter more, countering imbalance without discarding data. Logistic regression has no layers, and a higher learning rate does not address imbalance.
Question 24Foundations of Artificial Intelligence and Machine Learning
Which statement about the relationship between maximum likelihood estimation and cross-entropy loss is correct?
- Maximum likelihood always yields lower test error than cross-entropy
- Minimizing cross-entropy is equivalent to maximizing likelihood under a categorical model Correct answer.
- Cross-entropy and likelihood are unrelated objectives
- Cross-entropy applies only to regression tasks
Explanation
For categorical outputs, the negative log-likelihood is exactly the cross-entropy loss, so maximizing likelihood and minimizing cross-entropy are the same optimization. This equivalence is fundamental in classifier training.
Question 25Foundations of Artificial Intelligence and Machine Learning
In a convolutional neural network, what property do weight-sharing and local receptive fields primarily provide?
- Faster convergence without any hyperparameter tuning
- Guaranteed invariance to all image transformations
- Translation equivariance with far fewer parameters than a fully connected layer Correct answer.
- Elimination of the need for activation functions
Explanation
Sharing the same filter across spatial positions gives translation equivariance and drastically reduces parameters compared with dense connections. It does not provide full invariance to arbitrary transformations.
Question 26Foundations of Artificial Intelligence and Machine Learning
Which learning paradigm trains a model on input-output pairs where each training example carries an explicit target label?
- Supervised learning Correct answer.
- Unsupervised learning
- Reinforcement learning
- Self-supervised learning
Explanation
Supervised learning uses labeled examples, so the model learns a mapping from inputs to known targets by minimizing error against those targets. Unsupervised and self-supervised methods do not rely on human-provided labels, and reinforcement learning learns from reward signals rather than labeled targets.
Question 27Foundations of Artificial Intelligence and Machine Learning
Which type of machine learning task predicts a continuous numeric value rather than a discrete class?
- Regression Correct answer.
- Classification
- Dimensionality reduction
- Clustering
Explanation
Regression models output continuous quantities such as price or temperature, while classification predicts discrete categories. Clustering and dimensionality reduction are unsupervised techniques that do not predict a labeled continuous target.
Question 28Foundations of Artificial Intelligence and Machine Learning
In gradient descent, what does the learning rate control?
- The step size taken along the negative gradient at each update Correct answer.
- The number of features used by the model
- The depth of the network's hidden layers
- The fraction of data held out for testing
Explanation
The learning rate scales the gradient before it is subtracted from the parameters, so it sets how far each update moves. Too large a value can cause divergence or oscillation, and too small a value makes convergence slow.
Question 29Foundations of Artificial Intelligence and Machine Learning
Which statement best characterizes the difference between parametric and non-parametric models?
- Non-parametric models cannot be used for classification tasks
- Parametric models require no training data to fit their parameters
- Parametric models fix a finite set of parameters before seeing data, while non-parametric models grow in complexity with the data Correct answer.
- Parametric models always outperform non-parametric models on large datasets
Explanation
Parametric models assume a fixed functional form with a bounded parameter count, so their capacity does not grow with sample size. Non-parametric models such as k-nearest neighbors retain data or add complexity as more examples arrive.
Question 30Foundations of Artificial Intelligence and Machine Learning
A model achieves very low training error but much higher error on held-out data. Which diagnosis and remedy pair is most appropriate?
- Underfitting; reduce the number of training epochs
- Overfitting; increase regularization or gather more training data Correct answer.
- Overfitting; remove the validation set and retrain on all data
- Underfitting; increase model capacity substantially
Explanation
A large gap between low training error and high generalization error signals overfitting, meaning the model has fit noise specific to the training set. Adding regularization or more data constrains variance and typically narrows that gap.
Question 31Foundations of Artificial Intelligence and Machine Learning
A dataset contains a categorical feature with 40 distinct values and no natural ordering. Which encoding is generally most suitable for a linear model?
- One-hot encoding Correct answer.
- Standardizing the raw category strings
- Label encoding with arbitrary integer codes
- Binning the categories into two groups
Explanation
One-hot encoding creates a separate binary indicator per category, avoiding the false implication of order or equal spacing that arbitrary integer codes introduce. Linear models can then assign an independent weight to each category.
Question 32Foundations of Artificial Intelligence and Machine Learning
Which evaluation setup is required to estimate generalization performance of a model whose hyperparameters were tuned on a validation set?
- Report the training loss of the final model
- Report the best validation score achieved during the search
- Report the average of the training and validation scores
- Report performance on a separate test set not used during tuning Correct answer.
Explanation
Hyperparameters selected using the validation set make that set's score optimistically biased, because the model was chosen to do well on it. An untouched test set provides an unbiased estimate of performance on new data.
Question 33Foundations of Artificial Intelligence and Machine Learning
What is the primary purpose of a pooling layer in a convolutional neural network?
- To normalize the input images to zero mean and unit variance
- To convert convolutional features into class probabilities
- To reduce the spatial dimensions of feature maps while retaining the strongest activations Correct answer.
- To increase the number of trainable parameters in the network
Explanation
Pooling summarizes local regions, shrinking height and width and cutting computation, while preserving dominant responses. It introduces no trainable parameters, unlike convolutional or fully connected layers.
Question 34Foundations of Artificial Intelligence and Machine Learning
In k-nearest neighbors, what happens to the decision boundary as k increases from 1 to a large value?
- The boundary becomes smoother and the model's variance decreases Correct answer.
- The model memorizes the training set exactly
- The model stops depending on the distance metric
- The boundary becomes more jagged and the model's variance increases
Explanation
With small k the prediction follows individual points closely, producing a high-variance, irregular boundary. Increasing k averages over more neighbors, smoothing the boundary and reducing variance at the cost of some bias.
Question 35Foundations of Artificial Intelligence and Machine Learning
A logistic regression model is fit to data whose features have very different scales, and training converges slowly with erratic loss. Which change is most likely to help?
- Standardize the features before training Correct answer.
- Increase the number of output classes
- Remove the intercept term
- Add more polynomial features
Explanation
Features on vastly different scales produce ill-conditioned gradients, so the optimizer zigzags and converges slowly. Standardizing each feature to comparable scale improves the conditioning of the optimization problem.
Question 36Foundations of Artificial Intelligence and Machine Learning
Which statement correctly describes ensemble methods bagging and boosting?
- Boosting combines models by simple majority vote of independently trained learners
- Both methods require the base learners to be deep decision trees with low bias
- Bagging trains models in parallel on bootstrap samples to reduce variance, while boosting trains models sequentially to reduce bias Correct answer.
- Bagging reduces bias, while boosting reduces variance by averaging independent models
Explanation
Bagging fits models independently on resampled data and averages them, which mainly lowers variance. Boosting fits models one after another, each focusing on the errors of the previous ones, which mainly reduces bias.
Question 37Foundations of Artificial Intelligence and Machine Learning
Which statement describes the role of the kernel trick in support vector machines?
- It replaces the margin maximization objective with a nearest-neighbor rule
- It computes inner products in a higher-dimensional feature space without explicitly mapping points into that space Correct answer.
- It guarantees that the training data become linearly separable in the original space
- It removes the need for a regularization parameter in the optimization
Explanation
A kernel function returns the inner product of two points as if they had been mapped into a richer feature space, so a linear separator there corresponds to a nonlinear boundary in the input space. This avoids the cost of explicitly constructing high-dimensional features.
Question 38Foundations of Artificial Intelligence and Machine Learning
A recurrent neural network trained on long sequences fails to learn dependencies spanning hundreds of time steps. Which explanation is most consistent with this behavior?
- Weight sharing across time steps prevents the model from learning any temporal pattern
- The softmax output layer discards information from earlier time steps
- Repeated multiplication through many time steps causes gradients to vanish or explode Correct answer.
- Recurrent networks cannot process sequences longer than their hidden size
Explanation
Backpropagation through time multiplies many Jacobians together, so gradient magnitudes shrink or grow exponentially with sequence length. Gated architectures such as LSTM and GRU units were designed to create paths that preserve gradient flow over long spans.
Question 39Foundations of Artificial Intelligence and Machine Learning
A generative model is trained to maximize a variational lower bound on the data log-likelihood. What does this bound consist of?
- Only a reconstruction term, with no regularization
- A policy gradient term plus an entropy bonus
- A discriminator loss plus a generator loss
- A reconstruction term plus a divergence term between the approximate posterior and the prior Correct answer.
Explanation
The evidence lower bound equals the expected log-likelihood of the data under the decoder minus the KL divergence between the approximate posterior and the prior. The first term rewards accurate reconstruction and the second regularizes the latent distribution.
Question 40Foundations of Artificial Intelligence and Machine Learning
Two models are compared on the same test set. Model A has slightly higher accuracy but much lower macro-averaged F1 than Model B on a multi-class problem. Which interpretation is most defensible?
- The two metrics are equivalent, so the difference must be noise
- Model B distributes performance more evenly across classes, while Model A's accuracy may be driven by a few frequent classes Correct answer.
- Model B must have overfit because its accuracy is lower
- Model A is strictly better because accuracy is the primary metric in all cases
Explanation
Macro-averaged F1 weights every class equally, so a low value indicates weak performance on some classes even when overall accuracy is high. Accuracy is dominated by frequent classes, so the gap suggests Model A neglects rarer classes that Model B handles better.
Question 41Data Preparation, Feature Engineering, and Model Evaluation
A dataset has 10,000 rows and a single feature column with 200 missing values. Which approach removes every row containing a missing value in that column?
- K-nearest-neighbor imputation of the feature column
- Mean imputation of the feature column
- Median imputation of the feature column
- Listwise deletion on the feature column Correct answer.
Explanation
Listwise deletion drops any record with a missing entry in the considered columns, so 200 rows would be discarded. All imputation methods keep the row count and instead fill the empty cells with estimated values.
Question 42Data Preparation, Feature Engineering, and Model Evaluation
A numeric feature has a heavily right-skewed distribution with several extreme outliers. Which transformation most directly reduces that skew before modeling?
- Min-max scaling to the interval [0,1]
- Standardization to zero mean and unit variance
- One-hot encoding
- A log transformation Correct answer.
Explanation
A logarithmic transform compresses large values far more than small ones, which pulls a long right tail toward symmetry. Standardization and min-max scaling shift and rescale linearly, so they preserve the shape of the skew.
Question 43Data Preparation, Feature Engineering, and Model Evaluation
Which statistic is most appropriate for detecting outliers in a single numeric feature using the interquartile range rule?
- Values below Q1 − 1.5·IQR or above Q3 + 1.5·IQR Correct answer.
- Values outside the range of the mean plus or minus one standard deviation
- Values whose z-score equals zero
- Values equal to the median of the feature
Explanation
The Tukey rule flags points more than 1.5 interquartile ranges beyond the first or third quartile, which is robust to extreme values. Standard-deviation bands are themselves distorted by outliers, and a zero z-score is simply the mean.
Question 44Data Preparation, Feature Engineering, and Model Evaluation
A categorical feature has 40 distinct levels with no natural order. Which encoding produces a dense representation of a fixed width independent of the number of levels?
- Ordinal integer encoding
- Learned embedding vectors Correct answer.
- One-hot encoding
- Frequency encoding
Explanation
Embeddings map each level to a low-dimensional real-valued vector whose width is chosen in advance, so it does not grow with cardinality. One-hot width grows with the number of levels, ordinal encoding imposes false order, and frequency encoding collapses distinct levels that share a count.
Question 45Data Preparation, Feature Engineering, and Model Evaluation
A model is trained on data where a feature was standardized using statistics computed from the full dataset including the test split. What is the primary consequence?
- Information leakage that inflates test performance estimates Correct answer.
- A reduction in model variance without any bias
- Improved calibration of predicted probabilities
- A guaranteed increase in training loss
Explanation
Using test-set statistics during preprocessing leaks information about the evaluation data into training. The reported test performance becomes optimistic and no longer reflects behavior on truly unseen data.
Question 46Data Preparation, Feature Engineering, and Model Evaluation
In k-fold cross-validation with k = 5 on a dataset of 1,000 rows, how many rows are used for validation in each individual fold?
- 1,000
- 800
- 200 Correct answer.
- 500
Explanation
Each fold holds out one fifth of the observations for validation, so 1,000 divided by 5 equals 200 rows. The remaining 800 rows form the training portion for that iteration.
Question 47Data Preparation, Feature Engineering, and Model Evaluation
A binary classifier is evaluated on a dataset with 950 negatives and 50 positives. Which metric is most informative when the goal is to assess how well positives are ranked above negatives?
- Negative predictive value
- Area under the ROC curve Correct answer.
- Raw accuracy
- Mean squared error of the labels
Explanation
The ROC AUC measures the probability that a randomly chosen positive is scored above a randomly chosen negative, so it directly reflects ranking quality. Accuracy is dominated by the majority class, and the other metrics do not capture ranking.
Question 48Data Preparation, Feature Engineering, and Model Evaluation
Which practice correctly prevents target leakage when engineering features from a time-ordered dataset?
- Compute each feature over the entire dataset and then split into train and test
- Randomly shuffle rows before computing rolling aggregates
- Use the target mean of the full dataset to fill missing feature values
- Compute each feature using only data available before the timestamp of the row being predicted Correct answer.
Explanation
Point-in-time correctness requires that a feature for a given row use only information that existed before that row's prediction time. Computing statistics over the full history, or shuffling time order, lets future information contaminate the inputs.
Question 49Data Preparation, Feature Engineering, and Model Evaluation
A feature column contains the values 2, 4, 6, 8, and 100. Which summary best illustrates why the median is preferred over the mean for locating the center?
- The median is 24 while the mean is 6
- The median is 6 while the mean is 24 Correct answer.
- The median and mean are both 6
- The median and mean are both 24
Explanation
The sorted middle value is 6, whereas the sum of 120 divided by five gives a mean of 24. The single large value pulls the mean far above the typical observation while the median stays robust.
Question 50Data Preparation, Feature Engineering, and Model Evaluation
A model shows strong performance on the training set but much worse performance on held-out data. Which pair of changes most directly addresses this gap?
- Expand the feature set with higher-order interactions only
- Reduce model complexity and add regularization Correct answer.
- Increase model complexity and remove regularization
- Lower the learning rate while keeping capacity unchanged
Explanation
A large train-versus-holdout gap signals overfitting, so constraining capacity through simpler models or regularization is the standard remedy. Adding complexity or interaction terms would typically widen the gap.