Data Preprocessing & Feature Engineering
Time Limit: 20 minutes Total Marks: 30
Section A — Multiple Choice (1 mark each)
Choose the single best answer.
Q1. Which of the following is an example of ordinal data?
- (a) Blood type (A, B, AB, O)
- (b) T-shirt size (S, M, L, XL)
- (c) Temperature in °C
- (d) Customer ID number
Q2. Z-score normalization (standardization) transforms a feature so that it has:
- (a) Minimum 0 and maximum 1
- (b) Mean 0 and standard deviation 1
- (c) Median 0 and range 1
- (d) Sum equal to 1
Q3. Min-max scaling maps a value to which formula?
- (a)
- (b)
- (c)
- (d)
Q4. One-hot encoding a categorical feature with 5 distinct categories produces how many new binary columns (no drop)?
- (a) 1
- (b) 4
- (c) 5
- (d) 25
Q5. SMOTE is primarily used to address:
- (a) Missing values
- (b) Outliers
- (c) Class imbalance
- (d) Multicollinearity
Q6. Which imputation strategy is most appropriate for a categorical feature with missing values?
- (a) Mean imputation
- (b) Mode (most frequent) imputation
- (c) Log transformation
- (d) Min-max scaling
Q7. Fitting a scaler on the entire dataset before splitting into train/test sets is an example of:
- (a) Feature creation
- (b) Data leakage
- (c) Binning
- (d) Undersampling
Q8. A log transformation is commonly applied to a feature that is:
- (a) Normally distributed
- (b) Right-skewed with positive values
- (c) Binary
- (d) Perfectly symmetric
Q9. Target encoding replaces a category with:
- (a) A random integer
- (b) The mean of the target variable for that category
- (c) A one-hot vector
- (d) The category's alphabetical rank
Q10. By the IQR method, an outlier is typically a value lying outside:
- (a)
- (b)
- (c)
- (d)
Section B — Matching (1 mark each, 6 marks)
Q11. Match each technique in Column X to its correct purpose in Column Y.
| Column X | Column Y |
|---|---|
| (i) Label encoding | (A) Reduce class imbalance by removing majority samples |
| (ii) Binning | (B) Assign integer codes to categories |
| (iii) Undersampling | (C) Convert continuous values into discrete intervals |
| (iv) Interaction term | (D) Product/combination of two features |
| (v) VIF | (E) Detect multicollinearity |
| (vi) Stratified split | (F) Preserve class proportions across sets |
Section C — True / False with justification (2 marks each, 14 marks)
(1 mark correct T/F, 1 mark valid justification)
Q12. Standardization is bounded between 0 and 1. (T/F + justify)
Q13. Deleting all rows with any missing value can bias the dataset if data is not missing completely at random. (T/F + justify)
Q14. One-hot encoding is preferable to label encoding for a nominal feature fed into a linear model. (T/F + justify)
Q15. The test set should be used to decide which features to keep during preprocessing. (T/F + justify)
Q16. Two features with a correlation coefficient of indicate strong multicollinearity. (T/F + justify)
Q17. Min-max scaling is more robust to outliers than z-score standardization. (T/F + justify)
Q18. In EDA, examining distributions and missingness comes before modelling. (T/F + justify)
Answer keyMark scheme & solutions
Section A (10 marks)
Q1 — (b) T-shirt size. Why: Sizes have a meaningful order (S<M<L<XL) but no numeric magnitude → ordinal. Blood type is nominal; °C is numerical; ID is a nominal label. (1)
Q2 — (b) Mean 0, SD 1. Why: centres at 0 and scales to unit variance. (1)
Q3 — (b) . Why: This rescales the range to . (1)
Q4 — (c) 5. Why: One binary column per distinct category when none is dropped. (1)
Q5 — (c) Class imbalance. Why: SMOTE synthesises minority-class samples. (1)
Q6 — (b) Mode imputation. Why: Mean is undefined for categories; most-frequent value is the natural fill. (1)
Q7 — (b) Data leakage. Why: Test statistics leak into training via the scaler fit on all data. (1)
Q8 — (b) Right-skewed positive. Why: Log compresses large values, reducing right skew. (1)
Q9 — (b) Mean of target for that category. Why: That is the definition of (mean) target encoding. (1)
Q10 — (a) . Why: Standard Tukey fence for outliers. (1)
Section B (6 marks)
Q11: (i)→B, (ii)→C, (iii)→A, (iv)→D, (v)→E, (vi)→F. (1 mark each)
Section C (14 marks)
Q12 — False. Justify: Standardization has no fixed bounds; values can exceed 1 or be negative. Min-max scaling is the bounded [0,1] method. (1+1)
Q13 — True. Justify: If missingness correlates with the target/features (MAR/MNAR), dropping rows removes a non-random subset → biased/unrepresentative sample. (1+1)
Q14 — True. Justify: Label encoding imposes a false ordinal ranking on nominal categories, which a linear model misinterprets as magnitude; one-hot avoids this. (1+1)
Q15 — False. Justify: Feature selection using the test set leaks information and inflates performance; selection must use only training (or validation) data. (1+1)
Q16 — True. Justify: is very high, meaning near-linear dependence between the features → multicollinearity. (1+1)
Q17 — False. Justify: Min-max uses min and max, which are extreme values directly set by outliers, so it is more sensitive; z-score (or robust scaling) handles outliers comparatively better/robust scaling best. (1+1)
Q18 — True. Justify: EDA (distributions, missingness, correlations) is performed before modelling to inform preprocessing choices. (1+1)
[
{"claim":"Min-max scaling of x=7 with min=2,max=12 gives 0.5","code":"x,mn,mx=7,2,12; result=((x-mn)/(mx-mn))==Rational(1,2)"},
{"claim":"Z-score of value equal to mean is 0","code":"mu,sig,x=10,3,10; result=((x-mu)/sig)==0"},
{"claim":"One-hot of 5 categories yields 5 columns","code":"result=(5)==5"},
{"claim":"IQR upper fence for Q1=10,Q3=20 is 35","code":"Q1,Q3=10,20; IQR=Q3-Q1; result=(Q3+Rational(3,2)*IQR)==35"}
]