OCI AI Foundations study materials
OCI AI Foundations study resources

OCI AI Foundations practice questions

One question at a time. Build your OCI AI Foundations understanding.

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 1AI and Machine Learning Fundamentals

A model is trained on a dataset where every row contains both input features and the correct output value. Which learning approach does this describe?

  1. Reinforcement learning
  2. Self-supervised pretraining
  3. Unsupervised learning
  4. Supervised learning Correct answer.

Explanation

Supervised learning trains on labeled examples, pairing each input with the correct target output so the model can learn a mapping from inputs to outputs. The presence of the correct answer for every row is what makes the data labeled.

Question 2AI and Machine Learning Fundamentals

Which machine learning task produces a continuous numeric output, such as estimating a house price?

  1. Regression Correct answer.
  2. Classification
  3. Image segmentation
  4. Clustering

Explanation

Regression models predict continuous numeric values, so estimating a price from input attributes is a regression task. Classification instead predicts discrete categories.

Question 3AI and Machine Learning Fundamentals

In a dataset built to predict customer churn, what is the column recording whether each customer left or stayed called?

  1. Hyperparameter
  2. Feature vector
  3. Label Correct answer.
  4. Embedding

Explanation

The label is the target variable the model is trained to predict, which in this case is the churn outcome. Inputs used to make that prediction are the features.

Question 4AI and Machine Learning Fundamentals

Which task groups customers by similarity without using any predefined group assignments?

  1. Clustering Correct answer.
  2. Linear regression
  3. Binary classification
  4. Named entity recognition

Explanation

Clustering is an unsupervised task that partitions unlabeled records into groups based on similarity. Because no group assignments are provided, the algorithm discovers the structure itself.

Question 5AI and Machine Learning Fundamentals

Why is a dataset typically divided into a training portion and a held-out test portion?

  1. To estimate performance on unseen data Correct answer.
  2. To reduce the storage size of the dataset
  3. To speed up each training epoch
  4. To increase the number of input features

Explanation

Evaluating on data the model never trained on gives an indication of how it will generalize to new records. Training-set scores alone tend to be optimistic.

Question 6AI and Machine Learning Fundamentals

A model scores 99% on its training data but only 62% on held-out data. What does this gap most likely indicate?

  1. Overfitting to the training data Correct answer.
  2. Underfitting from too little capacity
  3. Severe class imbalance in the labels
  4. Data leakage between the two splits

Explanation

A large gap between very high training accuracy and much lower held-out accuracy is the classic signature of overfitting, where the model memorizes training-specific detail instead of general patterns. Regularization, more data, or a simpler model typically reduces the gap.

Question 7AI and Machine Learning Fundamentals

A high-bias model typically shows which pattern of results?

  1. Near-perfect fit to the training data
  2. Improvement only after many more epochs
  3. Poor results on both training and test data Correct answer.
  4. Strong results on both training and test data

Explanation

Bias reflects error from overly simplistic assumptions, so a high-bias model underfits and performs poorly on training data and on unseen data alike. Adding capacity or better features usually helps more than further tuning.

Question 8AI and Machine Learning Fundamentals

What is the main purpose of adding L2 regularization to a model's loss function?

  1. To remove the need for validation
  2. To boost the model's capacity
  3. To penalize large weight values Correct answer.
  4. To speed up feature engineering

Explanation

L2 regularization adds a penalty proportional to the squared magnitude of the weights, which discourages very large weights and reduces overfitting. It works by constraining the model rather than expanding it.

Question 9AI and Machine Learning Fundamentals

What is the primary advantage of k-fold cross-validation compared with a single train/test split?

  1. Removal of the need for labels
  2. Faster training than one split
  3. A more reliable performance estimate Correct answer.
  4. Guaranteed freedom from overfitting

Explanation

Cross-validation trains and evaluates the model across several different folds and averages the results, which reduces the dependence of the estimate on one particular split. It does not eliminate overfitting or remove the need for labeled data.

Question 10AI and Machine Learning Fundamentals

A spam filter flags 100 emails, of which 80 really are spam. There are 120 spam emails in total. What is the filter's precision?

  1. 0.80 Correct answer.
  2. 0.40
  3. 0.25
  4. 0.67

Explanation

Precision is the fraction of positive predictions that are actually positive: 80 correctly flagged emails out of 100 flagged, or 0.80. Recall would instead divide by the 120 truly spam emails and give about 0.67.

Question 11AI and Machine Learning Fundamentals

A classifier achieves precision 0.60 and recall 0.40. What is its F1 score?

  1. 0.48 Correct answer.
  2. 0.50
  3. 0.20
  4. 0.24

Explanation

F1 is the harmonic mean of precision and recall: 2 x (0.60 x 0.40) / (0.60 + 0.40) = 0.48. The harmonic mean stays closer to the smaller of the two values, which is why the result is below the simple average of 0.50.

Question 12AI and Machine Learning Fundamentals

What is the role of an activation function in a neural network?

  1. It stores the training labels
  2. It normalizes input features
  3. It adds non-linearity between layers Correct answer.
  4. It sets the learning rate

Explanation

Activation functions transform each layer's output, introducing non-linearity that lets stacked layers model complex relationships. Without them, a deep network would collapse into an effectively linear model.

Question 13AI and Machine Learning Fundamentals

What primarily distinguishes deep learning from classical machine learning?

  1. It requires no labeled data of any kind
  2. It always trains faster on CPUs than classical models
  3. It learns layered features from raw data Correct answer.
  4. It can only be applied to numeric tables

Explanation

Deep neural networks learn hierarchical representations directly from raw inputs, reducing reliance on hand-crafted features. Classical methods often depend on domain experts to define those features in advance.

Question 14AI and Machine Learning Fundamentals

In natural language processing, what does tokenization do?

  1. Removes all punctuation from text
  2. Splits text into words or subwords Correct answer.
  3. Translates text between languages
  4. Compresses text into a smaller file

Explanation

Tokenization breaks text into the discrete units, such as words or subword pieces, that a model processes. Those tokens are then mapped to numeric identifiers or embeddings.

Question 15AI and Machine Learning Fundamentals

What does a text embedding represent?

  1. A dense vector capturing semantic meaning Correct answer.
  2. A compressed archive of the source text
  3. A list of stopwords to be removed
  4. A parse tree of the sentence's grammar

Explanation

An embedding maps text into a fixed-length dense vector space where semantically similar items end up close together. Similarity between vectors then approximates similarity in meaning.

Question 16AI and Machine Learning Fundamentals

Which mechanism lets a transformer model weigh the relevance of different tokens in a sequence?

  1. Convolution
  2. Recurrence
  3. Self-attention Correct answer.
  4. Max pooling

Explanation

Self-attention computes relevance scores between every pair of tokens, so each position can aggregate information from the positions that matter most. This replaces the sequential recurrence used by older architectures.

Question 17AI and Machine Learning Fundamentals

Which approach most directly reduces hallucination by grounding a model's answers in retrieved documents?

  1. Raising the sampling temperature
  2. Using a smaller context window
  3. Retrieval-augmented generation Correct answer.
  4. Shortening the user prompt

Explanation

Retrieval-augmented generation fetches relevant source passages and supplies them to the model at answer time, so responses can be grounded in verifiable content. This reduces fabricated claims compared with relying on parametric memory alone.

Question 18AI and Machine Learning Fundamentals

What effect does raising the temperature parameter have on a language model's text generation?

  1. It makes output more deterministic
  2. It reduces the context window size
  3. It shortens the number of tokens produced
  4. It makes output more random and diverse Correct answer.

Explanation

Temperature scales the randomness of token sampling: higher values flatten the probability distribution so less likely tokens are chosen more often. Lower values concentrate probability on the most likely tokens, producing more repeatable output.

Question 19AI and Machine Learning Fundamentals

Which computer vision task assigns a class label to every individual pixel of an image?

  1. Object detection
  2. Image classification
  3. Semantic segmentation Correct answer.
  4. Image generation

Explanation

Semantic segmentation produces a per-pixel class map, so each pixel is assigned to a category such as road or sky. Image classification instead returns one label for the entire image.

Question 20AI and Machine Learning Fundamentals

In reinforcement learning, which signal tells an agent whether an action taken in an environment was good?

  1. Label
  2. Gradient
  3. Reward Correct answer.
  4. Embedding

Explanation

The agent learns a policy by maximizing cumulative reward received from the environment after its actions. No correct action is supplied in advance, so the reward acts as the learning signal.

Question 21AI and Machine Learning Fundamentals

What characterizes a foundation model?

  1. Tunable only through reinforcement learning from humans
  2. Built without any pretraining data
  3. Broadly pretrained and adaptable to many tasks Correct answer.
  4. Trained only for a single narrow task with no reuse

Explanation

Foundation models are pretrained on large, broad corpora and then adapted, through prompting or fine-tuning, to many downstream tasks. This broad pretraining plus adaptation is what distinguishes them from single-purpose models.

Question 22AI and Machine Learning Fundamentals

Why is feature scaling usually applied before training a distance-based algorithm such as k-means?

  1. To remove duplicate rows from the training dataset
  2. To choose the optimal number of clusters automatically
  3. To convert categorical labels into numbers
  4. So large-range features do not dominate distance Correct answer.

Explanation

Distance-based methods compare records using a metric such as Euclidean distance, so a feature measured in the thousands can outweigh one measured between 0 and 1. Scaling puts features on comparable ranges so each contributes fairly.

Question 23AI and Machine Learning Fundamentals

Why is stratified sampling used when splitting a highly imbalanced dataset?

  1. It preserves class proportions in each split Correct answer.
  2. It guarantees identical rows in every split
  3. It balances classes by duplicating minority rows
  4. It removes outlier rows before splitting the data

Explanation

Stratified sampling keeps the class distribution approximately the same in the training and evaluation portions, so the rare class is represented in both. A plain random split can otherwise leave very few minority examples in one portion.

Question 24AI and Machine Learning Fundamentals

A practitioner fits a feature scaler on the entire dataset and only then splits it into training and test sets. What problem does this introduce?

  1. Test information leaks into the training process Correct answer.
  2. The model trains more slowly than usual
  3. The labels become unbalanced across classes
  4. The test set becomes too small to use

Explanation

Fitting the scaler on all rows lets statistics from the test data influence preprocessing applied to the training data, which is a form of data leakage. Evaluation scores then look better than they would on truly unseen data.

Question 25AI and Machine Learning Fundamentals

Which statement about hyperparameters is correct?

  1. They are identical to the model's learned weights
  2. They are set before training and not learned Correct answer.
  3. They matter only in unsupervised learning settings
  4. They are updated by gradient descent at every step

Explanation

Hyperparameters such as learning rate, regularization strength, and number of layers are chosen by the practitioner before training and govern how learning proceeds. Model parameters, by contrast, are learned from the data during training.

Question 26AI and Machine Learning Fundamentals

Which learning paradigm trains a model on labeled examples so that it can predict a target value for new inputs?

  1. Supervised learning from labeled examples Correct answer.
  2. Reinforcement learning from reward signals
  3. Unsupervised learning from unlabeled records
  4. Self-supervised learning from raw text

Explanation

Supervised learning requires a dataset where each example carries the correct answer, and the model learns a mapping from inputs to that answer. The other paradigms either lack labels or generate their own supervision signal.

Question 27AI and Machine Learning Fundamentals

A dataset records house size, location and sale price, and the team must predict the price of new listings. Which task type does this represent?

  1. Regression Correct answer.
  2. Binary classification
  3. Clustering
  4. Dimensionality reduction

Explanation

Predicting a continuous numeric quantity such as a price is a regression task. Classification predicts discrete class membership, while clustering and dimensionality reduction are unsupervised techniques.

Question 28AI and Machine Learning Fundamentals

In a dataset used to train a model, what is a feature?

  1. An input attribute describing each example Correct answer.
  2. A weight that the model learns during training
  3. The fraction of rows held out for final evaluation
  4. The target value the model is trained to predict

Explanation

Features are the input variables or attributes that describe each example and are supplied to the model. The value being predicted is the label, and learned weights are model parameters rather than data.

Question 29AI and Machine Learning Fundamentals

In neural network training, what does one epoch consist of?

  1. One forward and backward pass on a single example
  2. One evaluation run on the held-out test set
  3. One full pass over the training dataset Correct answer.
  4. One adjustment of the learning rate schedule

Explanation

An epoch is completed once the training algorithm has processed every example in the training set, usually across several mini-batches. A single example pass is one training step, not an epoch.

Question 30AI and Machine Learning Fundamentals

What is the role of a loss function during training?

  1. To choose which features the model may use
  2. To set the number of layers in the network
  3. To quantify prediction error against targets Correct answer.
  4. To store the training data in compressed form

Explanation

The loss function converts the difference between predictions and targets into a number that the optimizer minimizes. Feature choice and architecture are design decisions made outside the loss.

Question 31AI and Machine Learning Fundamentals

Which task is an example of unsupervised learning?

  1. Estimating a price from labeled sales records
  2. Grouping customers by behavior without labels Correct answer.
  3. Predicting loan default from past labeled defaults
  4. Classifying emails as spam using labeled messages

Explanation

Unsupervised learning works with data that has no target labels, seeking structure such as groups or latent dimensions. The other options all require a known correct answer for each training example.

Question 32AI and Machine Learning Fundamentals

What is the main purpose of a validation set?

  1. To replace the test set when data is abundant
  2. To supply the examples from which weights are learned
  3. To tune model choices without touching the test set Correct answer.
  4. To store predictions the model made in production

Explanation

The validation set provides an unbiased estimate of performance during model development, so design and hyperparameter choices can be made before a final check on the test set. Repeatedly using the test set for these decisions would contaminate it.

Question 33AI and Machine Learning Fundamentals

A trained model is deployed and used to score new incoming records. What is this phase called?

  1. Backpropagation
  2. Inference Correct answer.
  3. Regularization
  4. Pre-training

Explanation

Inference is the phase in which a trained model computes outputs for new inputs without updating its weights. Backpropagation and pre-training are training-time activities.

Question 34AI and Machine Learning Fundamentals

A categorical feature takes the values red, green and blue. Why is one-hot encoding commonly applied before training?

  1. It avoids implying an order among the categories Correct answer.
  2. It reduces the number of input features
  3. It removes rows that contain missing categories
  4. It guarantees that the model cannot overfit

Explanation

One-hot encoding creates a separate binary column per category, so the model does not treat the integer codes as quantities with a meaningful ordering. It typically increases the number of features and does nothing by itself to prevent overfitting.

Question 35AI and Machine Learning Fundamentals

A model's training loss oscillates and grows instead of settling down. Which hyperparameter is most likely set too high?

  1. Size of the test set
  2. Number of output classes
  3. Number of epochs
  4. Learning rate Correct answer.

Explanation

When the learning rate is too large, each update overshoots the minimum and the loss can increase or oscillate rather than converge. Reducing the rate typically restores stable descent.

Question 36AI and Machine Learning Fundamentals

Averaging the predictions of many fully grown decision trees in a random forest primarily reduces which quantity?

  1. Bias arising from an overly simple model
  2. The number of features available to each tree
  3. The time needed to train a single tree
  4. Variance of the ensemble's predictions Correct answer.

Explanation

Deep trees have low bias but high variance, and averaging many trees that make different errors cancels much of that variability. Bagging therefore targets variance rather than bias.

Question 37AI and Machine Learning Fundamentals

What is the purpose of dropout during training?

  1. To drop rows with missing feature values
  2. To permanently remove the least useful neurons
  3. To lower the learning rate in later epochs
  4. To randomly deactivate units during each update Correct answer.

Explanation

Dropout temporarily zeroes random units on each update so the network cannot rely too heavily on any single pathway, which acts as a regularizer. The dropped units are restored at inference time.

Question 38AI and Machine Learning Fundamentals

What is the main purpose of principal component analysis?

  1. To expand the number of features given to a model
  2. To project data onto fewer, uncorrelated dimensions Correct answer.
  3. To estimate the generalization error of a model
  4. To label unlabeled points by their nearest cluster

Explanation

PCA finds orthogonal directions of greatest variance and re-expresses the data in a smaller number of those directions, discarding the rest. It is a dimensionality-reduction technique, not a supervised predictor.

Question 39AI and Machine Learning Fundamentals

Early stopping ends training when which condition is met?

  1. The learning rate has decayed to a fixed floor
  2. Validation performance stops improving Correct answer.
  3. The training loss has reached exactly zero
  4. Every layer has been trained at least once

Explanation

Early stopping monitors a validation metric and halts training once it fails to improve for a set number of epochs, keeping the best checkpoint. This limits overfitting without an explicit penalty term.

Question 40AI and Machine Learning Fundamentals

A team adapts an already trained image model to a small set of medical scans. What is this practice called?

  1. Transfer learning Correct answer.
  2. Model quantization
  3. Feature scaling
  4. Data augmentation

Explanation

Transfer learning reuses representations learned on a large source task and adapts them to a new, usually smaller, target dataset. This often yields better results than training from scratch with limited data.

Question 41AI and Machine Learning Fundamentals

For a rare positive class where ranking quality matters most, which metric is generally the most informative?

  1. Mean squared error of the scores
  2. Coefficient of determination (R-squared)
  3. Area under the precision-recall curve Correct answer.
  4. Overall accuracy across both classes

Explanation

With strong class imbalance, accuracy can look high while the model misses the rare class, and ranking-oriented metrics that focus on the positive class are more informative. The precision-recall curve and its area summarize exactly that trade-off.

Question 42AI and Machine Learning Fundamentals

Compared with training on small mini-batches, increasing the batch size typically has which effect?

  1. It always improves final model accuracy
  2. It gives fewer, less noisy gradient updates per epoch Correct answer.
  3. It increases the number of parameter updates per epoch
  4. It removes the need for a validation set

Explanation

A larger batch means fewer updates per epoch, and each gradient is averaged over more examples, so the updates are less noisy. Larger batches can also generalize slightly worse than small ones, so improvement is not guaranteed.

Question 43AI and Machine Learning Fundamentals

Why is ReLU commonly preferred to sigmoid in the hidden layers of deep networks?

  1. Gradients stay large for positive inputs Correct answer.
  2. It makes the network entirely linear
  3. It removes the need for regularization
  4. It guarantees the outputs sum to one

Explanation

The sigmoid squashes its input and its gradient becomes very small in saturated regions, which slows learning in deep stacks. ReLU has a constant gradient for positive inputs, so signals propagate more effectively.

Question 44AI and Machine Learning Fundamentals

Sharing the same filter weights across all positions of an image mainly achieves what?

  1. It guarantees invariance to color changes
  2. It increases the number of learnable parameters
  3. It converts the image into a set of text tokens
  4. It detects a pattern wherever it appears Correct answer.

Explanation

A convolutional filter applied at every spatial position learns one detector that fires wherever its pattern occurs, so translation of the pattern does not require new weights. This weight sharing also drastically reduces parameter count.

Question 45AI and Machine Learning Fundamentals

What does fine-tuning a pre-trained language model on domain-specific text typically do?

  1. It erases the knowledge learned during pre-training
  2. It reduces the model to a fixed keyword matcher
  3. It removes the need for any prompt design
  4. It adapts the model's weights to the target domain Correct answer.

Explanation

Fine-tuning continues training a pre-trained model on a narrower dataset so that its weights shift toward the target domain or task. The broad capabilities acquired during pre-training are largely retained and specialized.

Question 46AI and Machine Learning Fundamentals

In k-nearest neighbors, increasing k generally moves the decision boundary in which direction?

  1. Unchanged, because k affects only inference speed
  2. More jagged, with higher variance and lower bias
  3. Smoother, with both bias and variance reduced
  4. Smoother, with lower variance and higher bias Correct answer.

Explanation

A larger k averages over more neighbors, so small local quirks matter less and the boundary becomes smoother. That reduces variance but pulls predictions toward broader averages, raising bias.

Question 47AI and Machine Learning Fundamentals

A team tries 40 model configurations and reports the one with the best score on the test set. What is the main problem with this result?

  1. The reported score is optimistically biased by selection Correct answer.
  2. The test set becomes too small to evaluate
  3. The winning model will certainly underfit the data
  4. The models can no longer be trained again

Explanation

Choosing the best of many runs on the same test set effectively fits the selection to that set, so the reported score overstates performance on truly unseen data. Selection should be done on validation data, with the test set used once at the end.

Question 48AI and Machine Learning Fundamentals

A linear regression is fitted to 50 rows using 40 highly correlated predictors. What is the most likely consequence?

  1. Predictions will be independent of the features
  2. The model will have extremely low variance
  3. The training error will be large and the fit poor
  4. Coefficients will be unstable across samples Correct answer.

Explanation

Collinear predictors let the model shift weight between near-duplicates, so coefficient estimates swing widely when the sample changes, even if fitted values look reasonable. The model has high variance in its parameters and poor interpretability.

Question 49AI and Machine Learning Fundamentals

What is the main reason gradients become difficult to learn in deep recurrent networks?

  1. Gradient signals shrink through many time steps Correct answer.
  2. Recurrent layers contain no learnable parameters
  3. The loss is computed only once per sequence
  4. Sequences are always padded to the same length

Explanation

Backpropagation through time multiplies many Jacobians together, and repeated multiplication of factors below one drives gradients toward zero, while factors above one cause explosion. Gated architectures such as LSTM were designed to mitigate this.

Question 50AI and Machine Learning Fundamentals

A model assigns a probability of 0.90 to 200 cases, and only 120 of them turn out positive. Which statement best describes the model?

  1. It is overfit because training error is too low
  2. Poorly calibrated: confidence is too high Correct answer.
  3. It has high recall and therefore high precision
  4. It has perfect discrimination but no ranking

Explanation

Calibration compares predicted probabilities with observed frequencies: among cases scored 0.90, roughly 90 percent should be positive. Here only 60 percent are, so the scores overstate confidence even if the ranking of cases is good.