Unit 2: Data Preparation and Machine Learning Workflow - Practice Quiz

CSE252 — Introduction To Artificial Intelligence And Machine Learning 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 Which Python library is mainly used for efficient numerical array operations?

Introduction to NumPy, Pandas and Matplotlib Easy
A. Flask
B. NumPy
C. Matplotlib
D. Pandas

2 What is the main array object provided by NumPy?

Introduction to NumPy, Pandas and Matplotlib Easy
A. Figure
B. Dictionary
C. DataFrame
D. ndarray

3 Which Pandas data structure represents data in rows and columns?

Introduction to NumPy, Pandas and Matplotlib Easy
A. Series
B. DataFrame
C. Histogram
D. ndarray

4 Which library is commonly used to create line charts, bar charts, and scatter plots in Python?

Introduction to NumPy, Pandas and Matplotlib Easy
A. Requests
B. Matplotlib
C. Pandas
D. NumPy

5 Which type of dataset has a known target value for each training example?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Easy
A. Synthetic dataset
B. Labeled dataset
C. Empty dataset
D. Unlabeled dataset

6 Which of the following is an example of structured data?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Easy
A. A collection of photographs
B. A set of video clips
C. A folder of audio files
D. A customer table

7 What is the main purpose of Exploratory Data Analysis (EDA)?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Easy
A. To deploy a final model
B. To create new hardware
C. To understand data patterns
D. To encrypt stored records

8 Which plot is commonly used to examine the distribution of one numerical variable?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Easy
A. Network diagram
B. Flowchart
C. Histogram
D. Gantt chart

9 Which method collects data by asking people a prepared set of questions?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Easy
A. Survey
B. Simulation
C. Compilation
D. Normalization

10 Which value is commonly used to fill missing entries in a numerical column?

Data Preprocessing (Handling missing values and Detecting outliers) Easy
A. File type
B. Column mean
C. Column name
D. Row label

11 What is an outlier in a dataset?

Data Preprocessing (Handling missing values and Detecting outliers) Easy
A. A duplicate name in a table
B. A value equal to the mean
C. A value far from most values
D. A label used for a column

12 Which visualization is commonly used to detect possible outliers in numerical data?

Data Preprocessing (Handling missing values and Detecting outliers) Easy
A. Line chart
B. Area chart
C. Pie chart
D. Box plot

13 Which action is a valid way to handle rows containing missing values?

Data Preprocessing (Handling missing values and Detecting outliers) Easy
A. Duplicate the affected rows
B. Remove the affected rows
C. Reverse the row order
D. Rename every feature

14 What is the purpose of feature scaling?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Easy
A. To collect additional observations
B. To convert rows into labels
C. To place features on similar scales
D. To remove every numerical feature

15 Min-max scaling commonly transforms values into which range?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Easy
A.
B.
C.
D.

16 Why is feature encoding used in machine learning?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Easy
A. To increase every feature value
B. To replace models with charts
C. To divide data into files
D. To convert categories into numbers

17 What is the main goal of feature selection?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Easy
A. To enlarge the test dataset
B. To retain relevant input features
C. To draw every feature as a chart
D. To create missing target labels

18 What is the purpose of the training set?

Training and Validation (Train-Test Split and Cross Validation) Easy
A. To report final accuracy
B. To store chart titles
C. To fit the model
D. To encode missing labels

19 What is the purpose of the test set?

Training and Validation (Train-Test Split and Cross Validation) Easy
A. To replace missing values
B. To select column names
C. To evaluate unseen-data performance
D. To train model parameters

20 In -fold cross-validation, into how many subsets is the dataset divided?

Training and Validation (Train-Test Split and Cross Validation) Easy
A.
B.
C.
D.

21 Given arr = np.array([2, 4, 6, 8]), which expression returns the mean of the elements?

Introduction to NumPy, Pandas and Matplotlib Medium
A. arr.median()
B. arr.average_index()
C. arr.sum(axis=1)
D. arr.mean()

22 What is the result of np.array([1, 2, 3]) * 2 in NumPy?

Introduction to NumPy, Pandas and Matplotlib Medium
A. [2, 4, 6]
B. [3, 4, 5]
C. [1, 2, 3, 1, 2, 3]
D. [1, 1, 1]

23 A Pandas DataFrame contains a column named age. Which command selects rows where the age is greater than 30?

Introduction to NumPy, Pandas and Matplotlib Medium
A. df.where(age > 30)
B. age
C. `df[df[
D. df.select(age > 30)

24 Which Matplotlib plot is most appropriate for examining the relationship between two numerical variables?

Introduction to NumPy, Pandas and Matplotlib Medium
A. A scatter plot
B. A bar chart
C. A box plot
D. A pie chart

25 A dataset records the monthly electricity usage of 500 households for three consecutive years. What type of data structure does this primarily represent?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Medium
A. Categorical data
B. Time-series data
C. Unstructured text data
D. Cross-sectional data

26 A researcher wants to estimate customer satisfaction across an entire country but can survey only a smaller group. Which practice improves the representativeness of the collected data?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Medium
A. Select participants using random sampling
B. Ask participants to recruit similar people
C. Remove responses with average ratings
D. Survey only frequent customers

27 During exploratory data analysis, a histogram of income is strongly skewed to the right. What does this most likely indicate?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Medium
A. Most values are low with a few high values
B. The variable contains only categories
C. The values are evenly distributed
D. Most values are unusually large

28 Which EDA technique is most useful for identifying a strong linear relationship between two numerical features?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Medium
A. A frequency table
B. A missing-value count
C. A class-label encoder
D. A correlation matrix

29 A numerical feature has 2% missing values, and its distribution is approximately symmetric without important extreme values. Which imputation method is generally reasonable?

Data Preprocessing (Handling missing values and Detecting outliers) Medium
A. Delete the entire feature
B. Replace values with the mean
C. Replace values with zero
D. Encode values as categories

30 A numerical feature is highly skewed because of several extreme values. Which statistic is usually safer than the mean for filling missing values?

Data Preprocessing (Handling missing values and Detecting outliers) Medium
A. The minimum
B. The variance
C. The maximum
D. The median

31 For a feature with first quartile and third quartile , which value would be flagged as an outlier using the rule?

Data Preprocessing (Handling missing values and Detecting outliers) Medium
A. A value of 20
B. A value of 0
C. A value of 2
D. A value of 25

32 A dataset contains a missing age value for a customer. Which approach can preserve the row while allowing a model to recognize that the value was originally missing?

Data Preprocessing (Handling missing values and Detecting outliers) Medium
A. Copy the age from the next row
B. Drop the customer and all features
C. Impute the age and add a missingness indicator
D. Replace the age with the customer ID

33 A nearest-neighbor model uses income in dollars and age in years. Why is feature scaling important before training the model?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Medium
A. It removes all duplicate observations
B. It prevents large-unit features from dominating distances
C. It converts labels into features
D. It guarantees that every feature becomes normally distributed

34 Which scaling method transforms a feature using its mean and standard deviation so that it commonly has mean and standard deviation ?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Medium
A. Min-max clipping
B. Standardization
C. One-hot encoding
D. Label encoding

35 A feature contains the unordered categories red, blue, and green. Which encoding is most appropriate for a linear model?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Medium
A. Converting categories to random integers
B. One-hot encoding into separate binary columns
C. Replacing every category with its frequency rank
D. Ordinal encoding as 1, 2, and 3

36 A categorical feature contains small, medium, and large, where the categories have a meaningful order. Which encoding best represents this relationship?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Medium
A. Random hashing
B. Ordinal encoding
C. Missing-value imputation
D. One-hot encoding only

37 A feature-selection method removes one of two features that have a correlation of . What is the main reason for this removal?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Medium
A. To convert numerical values to text
B. To reduce redundant information
C. To guarantee perfect predictions
D. To increase the number of features

38 Why should the test set generally remain unused until the final model evaluation?

Training and Validation (Train-Test Split and Cross Validation) Medium
A. To eliminate the need for validation
B. To provide an unbiased estimate of generalization
C. To ensure the model memorizes all examples
D. To make the training set larger

39 A binary classification dataset has 90% negative and 10% positive examples. Which train-test split strategy helps preserve this class ratio in both subsets?

Training and Validation (Train-Test Split and Cross Validation) Medium
A. A split using only positive examples
B. A split based on feature magnitude
C. A stratified split
D. A sequential split without shuffling

40 In 5-fold cross-validation, how many times is each observation used for validation?

Training and Validation (Train-Test Split and Cross Validation) Medium
A. Five times
B. Twice
C. Once
D. Four times

41 Consider the NumPy arrays a = np.array([[1, 2], [3, 4]]) and b = np.array([10, 20]). What is the result of a * b?

Introduction to NumPy, Pandas and Matplotlib Hard
A. [[11, 22], [13, 24]]
B. [[10, 40], [30, 80]]
C. A broadcasting error occurs because the shapes differ
D. [[10, 20], [30, 80]]

42 Which operation creates a view rather than an independent copy in standard NumPy behavior?

Introduction to NumPy, Pandas and Matplotlib Hard
A. b = a[1:4]
B. b = np.array(a)
C. b = a.astype(float)
D. b = a.copy()

43 A Pandas column contains values such as "12.5", "13.0", and "missing". Which transformation is most appropriate before numerical analysis?

Introduction to NumPy, Pandas and Matplotlib Hard
A. df["x"].fillna("missing")
B. df["x"].astype(str)
C. pd.to_numeric(df["x"], errors="coerce")
D. df["x"].astype(int)

44 A Matplotlib line plot appears to connect observations in a misleading order because the x-values are unsorted. What is the most appropriate correction?

Introduction to NumPy, Pandas and Matplotlib Hard
A. Sort the data by x before plotting
B. Increase the line width
C. Normalize the y-values first
D. Replace the line plot with a histogram

45 A dataset records monthly electricity usage for 500 households over 24 months. Which description best classifies its structure?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Hard
A. Unstructured text data
B. Pure time-series data
C. Pure cross-sectional data
D. Panel data with household and time dimensions

46 A hospital dataset is collected only from patients who returned for a follow-up appointment. Which problem is most directly indicated?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Hard
A. Survivorship or selection bias
B. Random measurement noise
C. Label encoding failure
D. Feature scaling error

47 In exploratory analysis, a feature has a strong correlation with the target, but the relationship disappears after grouping by customer segment. What is the most likely interpretation?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Hard
A. The target contains no predictive information
B. The feature must be normally distributed
C. The grouping operation always introduces leakage
D. The aggregate correlation may reflect confounding

48 A box plot shows a long upper whisker and many unusually large values, while the median lies closer to the lower quartile. Which distribution is most consistent with this pattern?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Hard
A. Uniform distribution
B. Right-skewed distribution
C. Symmetric normal distribution
D. Left-skewed distribution

49 During EDA, a feature has nearly identical values for 99.9% of records but differs substantially for the remaining 0.1%. Which investigation is most important before removing it?

Understanding Data (Types of Datasets, Data Collection and Exploratory Data Analysis) Hard
A. Whether its variance is exactly zero
B. Whether the target is stored as integers
C. Whether its column name contains spaces
D. Whether the rare values encode a meaningful subgroup

50 A numerical feature is missing for 40% of observations, and missingness is strongly associated with the target. Which approach best preserves potentially useful information?

Data Preprocessing (Handling missing values and Detecting outliers) Hard
A. Replace all missing values with zero
B. Use imputation together with a missingness indicator
C. Drop every row with a missing value
D. Replace missing values with the global maximum

51 Why should an imputer be fitted only on the training data during model development?

Data Preprocessing (Handling missing values and Detecting outliers) Hard
A. To reduce the number of columns
B. To prevent validation statistics from entering training
C. To force every feature to have zero mean
D. To ensure missing values remain unchanged

52 For a feature with first quartile and third quartile , which value is flagged as an upper outlier by the rule?

Data Preprocessing (Handling missing values and Detecting outliers) Hard
A. 31
B. 27
C. 30
D. 29

53 A fraud dataset contains legitimate extreme transaction amounts and fraudulent extreme amounts. Which preprocessing strategy is least likely to destroy useful signal?

Data Preprocessing (Handling missing values and Detecting outliers) Hard
A. Investigate extremes and use a robust model or transformation
B. Delete every observation outside the IQR fences
C. Replace every extreme value with the median
D. Clip all values at the 95th percentile

54 A k-nearest-neighbors classifier uses income measured in dollars and age measured in years. Why is feature scaling important?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Hard
A. It prevents income from dominating distance calculations
B. It converts categorical variables into labels
C. It guarantees that the classes become linearly separable
D. It removes all correlations among features

55 A numeric feature has heavy tails and several extreme values. Which scaling method is generally most resistant to those extremes?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Hard
A. Min-max scaling using observed endpoints
B. Robust scaling using median and IQR
C. Standardization using mean and standard deviation
D. Binary threshold encoding

56 A categorical variable contains 50,000 unique customer identifiers. Which treatment is most defensible for a model intended to generalize to new customers?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Hard
A. Apply ordinary integer encoding to all identifiers
B. Sort identifiers alphabetically and use their ranks
C. One-hot encode every identifier without regularization
D. Drop the identifier unless it has a justified predictive meaning

57 When one-hot encoding a categorical feature with categories for a linear regression model with an intercept, why is one column commonly dropped?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Hard
A. To force the target mean to zero
B. To remove all category information
C. To ensure every category has equal frequency
D. To avoid perfect multicollinearity

58 A feature-selection method ranks variables using their correlation with the target before cross-validation. What is the main methodological problem?

Feature Engineering (Introduction to feature scaling, feature encoding and feature selection) Hard
A. The selected variables may use information from validation folds
B. Correlation cannot be computed for numeric features
C. Feature selection always increases model bias
D. Cross-validation requires all features to be categorical

59 For a binary classification problem with a 5% positive class, which train-test split is most appropriate when the dataset is independently and identically distributed?

Training and Validation (Train-Test Split and Cross Validation) Hard
A. A split based on the target value itself
B. A stratified random split preserving class proportions
C. A random split without preserving class proportions
D. A chronological split that shuffles timestamps

60 A time-dependent forecasting dataset is randomly shuffled before train-test splitting. Why can this produce an invalidly optimistic estimate?

Training and Validation (Train-Test Split and Cross Validation) Hard
A. Time-series models cannot use numerical features
B. Random shuffling always reduces sample size
C. Future observations may influence evaluation of past behavior
D. Shuffling automatically creates missing values