wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PrelimExam - AppDev - FCPC

Total questions: 43

Worksheet time: 43mins

Name
Class
Date
1.

Supervised learning is best described as:

a)

Learning with no labeled data

b)

Learning from labeled examples to predict outputs for new inputs

c)

Learning to cluster similar items without labels

d)

Learning by random guessing

2.

Which of the following is a typical supervised learning task?

a)

Clustering

b)

Dimensionality reduction

c)

Classification

d)

Anomaly detection (unsupervised)

3.

In supervised learning terminology, the input variables are called:

a)

Targets

b)

Labels

c)

Features

d)

Losses

4.

In supervised learning terminology, the output variable we predict is called:

a)

Features

b)

Labels (or targets)

c)

Hyperparameters

d)

Pipelines

5.

Which algorithm family does Naive Bayes belong to?

a)

Instance-based learning

b)

Probabilistic classifiers

c)

Decision trees

d)

Neural networks

6.

The "naive" assumption in Naive Bayes refers to:

a)

Features are sorted

b)

Features are independent given the class label

c)

Labels are independent of features

d)

The algorithm uses no probabilities

7.

Which Naive Bayes variant is typically used for continuous (real-valued) features?

a)

MultinomialNB

b)

BernoulliNB

c)

GaussianNB

d)

CategoricalNB

8.

Which Naive Bayes variant is commonly used for text classification with word counts?

a)

GaussianNB

b)

MultinomialNB

c)

BernoulliNB

d)

KNeighborsNB

9.

BernoulliNB is particularly suitable when features are:

a)

Continuous numeric counts

b)

Binary (presence/absence) indicators

c)

Multi-class labels

d)

Time series

10.

In scikit-learn, which method trains a classifier?

a)

transform()

b)

fit()

c)

predict_proba()

d)

score()

11.

In scikit-learn, which method is used to predict class labels for new samples?

a)

fit()

b)

transform()

c)

predict()

d)

inverse_transform()

12.

Which scikit-learn function splits data into training and testing sets?

a)

cross_val_score

b)

GridSearchCV

c)

train_test_split

d)

KFold

13.

The smoothing parameter (commonly called alpha) in MultinomialNB is used to:

a)

Scale features

b)

Prevent zero probabilities by Laplace smoothing

c)

Normalize labels

d)

Decrease training time

14.

Which metric is most appropriate for balanced binary classification to measure overall correctness?

a)

Precision

b)

Recall

c)

Accuracy

d)

Log loss

15.

The confusion matrix contains:

a)

Feature correlations

b)

Predicted vs actual counts for each class

c)

Hyperparameter values

d)

Loss per epoch

16.

Which of the following transforms raw text to a matrix of token counts in scikit-learn?

a)

StandardScaler

b)

CountVectorizer

c)

PCA

d)

OneHotEncoder

17.

TfidfVectorizer produces features that:

a)

Are raw counts only

b)

Are TF-IDF weighted scores for terms

c)

Encode categorical variables

d)

Perform feature selection automatically

18.

In a typical text classification pipeline, the correct order is:

a)

Vectorize → fit classifier → predict

b)

Fit classifier → vectorize → predict

c)

Predict → vectorize → fit classifier

d)

Vectorize → predict → fit classifier

19.

Which scikit-learn class implements Multinomial Naive Bayes?

a)

GaussianNB

b)

MultinomialNB

c)

BernoulliNB

d)

NaiveBayesClassifier

20.

Which Naive Bayes variant models binary features (0/1) and can use smoothing?

a)

GaussianNB only

b)

BernoulliNB

c)

MultinomialNB only

d)

LinearNB

21.

If a MultinomialNB model gives zero probability to a feature for a class, what happens without smoothing?

a)

Nothing - model still works fine

b)

The posterior probability for the class can become zero (ruin predictions)

c)

Accuracy improves

d)

The model converts to GaussianNB

22.

Which scikit-learn function helps build a repeatable sequence of preprocessing and estimator steps?

a)

GridSearchCV

b)

Pipeline

c)

fit_transform

d)

cross_val_score

23.

In Python, which library is commonly used for Naive Bayes and many supervised algorithms?

a)

tensorflow

b)

scikit-learn (sklearn)

c)

nltk only

d)

seaborn

24.

Which method of a trained scikit-learn classifier gives a simple performance score on test data (by default accuracy)?

a)

fit()

b)

evaluate()

c)

score()

d)

transform()

25.

In text classification, a "bag-of-words" representation means:

a)

Word order is preserved exactly

b)

Word counts or presence are used, ignoring order

c)

Only the first word is used

d)

Sentences are converted to audio

26.

What is a prior in the context of Naive Bayes?

a)

The loss function used for training

b)

The prior probability of each class before seeing features

c)

A metric for model selection

d)

A tokenizer for text

27.

The Naive Bayes posterior is proportional to:

a)

Prior × Likelihood

b)

Likelihood × Loss

c)

Prior ÷ Likelihood

d)

Only the likelihood

28.

Which preprocessing is commonly necessary before GaussianNB?

a)

Converting continuous features to counts

b)

Scaling/standardizing continuous features (often useful)

c)

Tokenizing text into words

d)

One-hot encoding text into TF-IDF

29.

How does MultinomialNB treat feature values?

a)

As continuous Gaussian variables

b)

As counts or frequencies (discrete non-negative)

c)

As binary only

d)

As time series signals

30.

Which of these is a sign of overfitting?

a)

High train accuracy, much lower test accuracy

b)

Low training and high test accuracy

c)

Identical train/test accuracies both low

d)

Model training takes very little time

31.

To save a trained scikit-learn model to disk, one common tool is:

a)

pandas.to_csv

b)

joblib.dump or pickle

c)

numpy.load

d)

matplotlib.savefig

32.

If you want probability predictions and to choose a threshold other than 0.5, which output do you use?

a)

predict()

b)

fit()

c)

predict_proba() (or decision_function for some models)

d)

score()

33.

For binary text sentiment classification using word presence (1 or 0), which model is a natural choice?

a)

GaussianNB

b)

BernoulliNB

c)

MultinomialNB with continuous smoothing disabled

d)

KMeans

34.

Which tokenizer/transform pair converts text into TF-IDF features in scikit-learn?

a)

OneHotEncoder + LabelEncoder

b)

CountVectorizer + TfidfTransformer OR TfidfVectorizer

c)

StandardScaler + PCA

d)

MinMaxScaler + PolynomialFeatures

35.

Which evaluation metric combines precision and recall into one number?

a)

Accuracy

b)

ROC AUC

c)

F1-score

d)

Mean Absolute Error

36.

If classes are imbalanced, which scikit-learn parameter during train/test splitting helps preserve class proportions?

a)

shuffle=False

b)

stratify parameter in train_test_split

c)

random_state=None

d)

test_size=1.0

37.

In scikit-learn, which object can bundle preprocessing and a classifier into one, allowing fit() to include both steps?

a)

FeatureUnion

b)

Pipeline

c)

ColumnTransformer

d)

TransformerMixin

38.

Which of these is NOT true about Naive Bayes?

a)

It is simple and fast to train

b)

It always requires a lot of data preprocessing to run at all

c)

It can work surprisingly well for text classification

d)

It outputs class probabilities (for supported implementations)

39.

When performing text classification, removing stop words generally:

a)

Always hurts performance

b)

Has no effect on pipeline runtime

c)

May reduce feature size and sometimes improve performance

d)

Converts text to lowercase automatically

40.

Which Python code snippet shows the correct way to import MultinomialNB from scikit-learn?

a)

from sklearn.naive_bayes import MultinomialNB

b)

import sklearn.naive_bayes.MultinomialNB

c)

from sklearn import MultinomialNB

d)

from sklearn.classifier import MultinomialNB

41.

Which of the following best explains why Naive Bayes is fast?

a)

It avoids using probabilities

b)

It computes class-conditional probabilities using simple counts and closed-form formulas (no iterative optimization)

c)

It trains a deep neural network under the hood

d)

It only supports binary classification

42.

For new words in test data not seen in training, smoothing ensures:

a)

An error is thrown

b)

They are ignored completely during prediction

c)

They receive a small non-zero probability instead of zero

d)

They convert to uppercase automatically

43.

When using scikit-learn with text data, a typical supervised workflow is:

a)

Raw text → fit classifier → vectorize → predict

b)

Raw text → vectorize → train (fit) classifier → evaluate on test set → predict on new text

c)

Raw text → PCA → predict

d)

Raw text → cluster → label → predict