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. Matplotlib
B. Pandas
C. Flask
D. NumPy

2 What is the main array object provided by NumPy?

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

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

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

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. NumPy
D. Pandas

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. Empty dataset
B. Synthetic dataset
C. Unlabeled dataset
D. Labeled 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 folder of audio files
B. A set of video clips
C. A customer table
D. A collection of photographs

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 create new hardware
B. To encrypt stored records
C. To understand data patterns
D. To deploy a final model

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. Gantt chart
D. Histogram

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. Compilation
C. Normalization
D. Simulation

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

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

11 What is an outlier in a dataset?

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

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. Rename every feature
C. Remove the affected rows
D. Reverse the row order

14 What is the purpose of feature scaling?

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

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 replace models with charts
B. To convert categories into numbers
C. To increase every feature value
D. To divide data into files

17 What is the main goal of feature selection?

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

18 What is the purpose of the training set?

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

19 What is the purpose of the test set?

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

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.mean()
D. arr.sum(axis=1)

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

Introduction to NumPy, Pandas and Matplotlib Medium
A. [1, 2, 3, 1, 2, 3]
B. [2, 4, 6]
C. [3, 4, 5]
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.select(age > 30)
D. `df[df[

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

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

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. Unstructured text data
C. Cross-sectional data
D. Time-series 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. Survey only frequent customers
B. Ask participants to recruit similar people
C. Remove responses with average ratings
D. Select participants using random sampling

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. The values are evenly distributed
B. Most values are low with a few high values
C. Most values are unusually large
D. The variable contains only categories

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 missing-value count
B. A correlation matrix
C. A class-label encoder
D. A frequency table

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. Encode values as categories
D. Replace values with zero

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 median
C. The maximum
D. The variance

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 25
B. A value of 0
C. A value of 20
D. A value of 2

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. Replace the age with the customer ID
B. Drop the customer and all features
C. Impute the age and add a missingness indicator
D. Copy the age from the next row

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 guarantees that every feature becomes normally distributed
B. It removes all duplicate observations
C. It converts labels into features
D. It prevents large-unit features from dominating distances

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. One-hot encoding
B. Standardization
C. Label encoding
D. Min-max clipping

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. Ordinal encoding as 1, 2, and 3
B. Converting categories to random integers
C. Replacing every category with its frequency rank
D. One-hot encoding into separate binary columns

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. One-hot encoding only
C. Ordinal encoding
D. Missing-value imputation

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 reduce redundant information
B. To convert numerical values to text
C. To increase the number of features
D. To guarantee perfect predictions

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 ensure the model memorizes all examples
B. To eliminate the need for validation
C. To make the training set larger
D. To provide an unbiased estimate of generalization

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 sequential split without shuffling
B. A split based on feature magnitude
C. A split using only positive examples
D. A stratified split

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. Four times
B. Once
C. Five times
D. Twice

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"].astype(str)
B. pd.to_numeric(df["x"], errors="coerce")
C. df["x"].astype(int)
D. df["x"].fillna("missing")

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. Normalize the y-values first
B. Sort the data by x before plotting
C. Increase the line width
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. Panel data with household and time dimensions
B. Unstructured text data
C. Pure cross-sectional data
D. Pure time-series data

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. Feature scaling error
B. Survivorship or selection bias
C. Random measurement noise
D. Label encoding failure

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 feature must be normally distributed
B. The grouping operation always introduces leakage
C. The aggregate correlation may reflect confounding
D. The target contains no predictive information

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. Symmetric normal distribution
B. Uniform distribution
C. Left-skewed distribution
D. Right-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 the rare values encode a meaningful subgroup
B. Whether its column name contains spaces
C. Whether its variance is exactly zero
D. Whether the target is stored as integers

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 missing values with the global maximum
B. Drop every row with a missing value
C. Replace all missing values with zero
D. Use imputation together with a missingness indicator

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. 29
B. 30
C. 31
D. 27

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. Replace every extreme value with the median
C. Delete every observation outside the IQR fences
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 guarantees that the classes become linearly separable
C. It converts categorical variables into labels
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. Binary threshold encoding
C. Standardization using mean and standard deviation
D. Robust scaling using median and IQR

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. One-hot encode every identifier without regularization
B. Sort identifiers alphabetically and use their ranks
C. Drop the identifier unless it has a justified predictive meaning
D. Apply ordinary integer encoding to all identifiers

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 remove all category information
B. To force the target mean to zero
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. Feature selection always increases model bias
B. Cross-validation requires all features to be categorical
C. The selected variables may use information from validation folds
D. Correlation cannot be computed for numeric features

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 random split without preserving class proportions
C. A chronological split that shuffles timestamps
D. A stratified random split preserving class proportions

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. Shuffling automatically creates missing values
C. Random shuffling always reduces sample size
D. Future observations may influence evaluation of past behavior