Loading

Quipoin Menu

Learn • Practice • Grow

python-for-ai / Datasets and Train-Test Split
mcq
Direction: Choose the correct option

Q1.

How do you load the iris dataset in scikit-learn?
A. iris = load_iris()
B. from sklearn.datasets import load_iris; iris = load_iris()
C. Both A and B
D. iris = sklearn.datasets.load_iris()
Direction: Choose the correct option

Q2.

What does `train_test_split` do?
A. Tests a model
B. Splits data into training and test sets
C. Trains a model
D. Preprocesses data
Direction: Choose the correct option

Q3.

Which import is needed for train_test_split?
A. from sklearn.model_selection import train_test_split
B. from sklearn.cross_validation import train_test_split
C. Both A and B (deprecated)
D. from sklearn.data import train_test_split
Direction: Choose the correct option

Q4.

What is the typical usage of `train_test_split`?
A. train_test_split(X, y)
B. Both A and B
C. X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
D. split(X, y, test=0.2)
Direction: Choose the correct option

Q5.

What does `random_state` parameter do in `train_test_split`?
A. Sets test size
B. Shuffles data
C. Seeds the random number generator for reproducibility
D. None
Direction: Choose the correct option

Q6.

How do you split the data into training, validation, and test sets?
A. Use two calls to `train_test_split`
B. Both A and B
C. Use `train_test_split` once with test_size and then split the train again
D. Use `KFold`
Direction: Choose the correct option

Q7.

What is the advantage of the `stratify` parameter?
A. Stratifies numerical features
B. Removes outliers
C. None
D. Maintains class proportions in the splits
Direction: Choose the correct option

Q8.

Which attribute of a Bunch object (like iris) contains the feature data?
A. DESCR
B. feature_names
C. target
D. data
Direction: Choose the correct option

Q9.

What is the shape of the target array in classification datasets?
A. (n_samples, 1)
B. (1, n_samples)
C. (n_samples, n_targets)
D. (n_samples,)
Direction: Choose the correct option

Q10.

Which function generates synthetic datasets for regression?
A. make_blobs
B. make_classification
C. Both A and B
D. make_regression