Skip to content
Tech Interview Prep
Technical interview guide

Regularization (L1/L2, Dropout)

Penalizing model complexity to fight overfitting: L1/L2 weight penalties and dropout.

Read
24 min
Practice MCQs
25
Interview Q&A
25
Edition
v4
Editorial status
Reviewed

Scope: scikit-learn stable linear-model and cross-validation guidance and Google ML Crash Course overfitting guidance accessed 2026-08-31..

Curated: · Written: · Reviewed:

25 questions

MCQ-3A team fits a linear model on 300 samples with 4,000 individual features and no predefined feature groups. Most features are believed irrelevant, and the serving code skips any feature whose coefficient is exactly zero. The team wants a single convex optimization that zeroes as many individual coefficients as possible. Which objective should they use?
MCQ-1A linear model has a single weight w = 3.0. Training minimizes L = data_loss + (λ/2)·w² with λ = 0.5, using gradient descent with learning rate η = 0.1. At the current step the gradient of the data loss with respect to w is +0.4. What is w after one update?
MCQ-2A ridge regression is trained on two samples: (x1, x2, y) = (1, 1, 1) and (-1, -1, -1). The two features are perfectly correlated. With no regularization, the minimum-norm least-squares solution is w1 = w2 = 0.5. The team sets the L2 penalty strength to λ = 6. What weights does ridge regression learn?
MCQ-22A ridge regression is fit on standardized features. The centered design matrix has singular values 8, 2, and 0.5. Ridge shrinks the coefficient along the i-th right-singular direction by the factor s_i²/(s_i²+λ): the mechanism behind the bias-variance tradeoff. With λ = 4, what fraction of its unregularized value does the coefficient along the smallest-singular-value direction (s = 0.5) retain?
MCQ-16A team fits a Lasso model on 200 samples with 5 orthonormal features (XᵀX = 200 I), minimizing (1/(2n))‖y − Xβ‖² + λ‖β‖₁. The correlations Xᵀy/200 are f1 = 0.80, f2 = 0.30, f3 = −0.45, f4 = 0.12, f5 = −0.05. They plot the coefficient path as λ decreases from 0.9 to 0.05. What does the path show at λ = 0.35?
MCQ-25A team standardizes 40 predictors that are mutually orthogonal and fits two models with objective (1/2)‖y − Xβ‖² + λ·R(β), where R is the L1 norm for Lasso and the squared L2 norm for Ridge. Sweeping λ upward from 0, they record the λ at which each coefficient first becomes exactly zero. What do they find?
MCQ-15A team fits ridge regression (L2 penalty, intercept unpenalized) on 400 rows and 5,000 standardized features, sweeping λ from 0.01 to 10^4. At λ = 10^4 the largest fitted coefficient is 0.002 and the smallest is 4×10^-7; none is exactly zero. A downstream service can evaluate at most 50 features, so the team needs a model with at most 50 nonzero coefficients. What should they do next?
MCQ-5A regularized logistic regression is trained on a distance feature in metres (0.1–10) and a count feature in thousands (1–50). Standardizing both features changes the fitted model. Why?
MCQ-23A team fits L2-regularized logistic regression (λ = 1.0, intercept unpenalized) on two raw features: account balance in dollars (std ≈ 120,000) and days since signup (std ≈ 8). The fitted coefficients are w_balance = 4e-6 and w_days = 0.08. They then standardize both features to unit variance and refit, keeping λ = 1.0. What happens to the effective penalty on the balance coefficient?
MCQ-14A team trains an L2-regularized logistic regression by minimizing J(w) = Σᵢ sᵢ·ℓ(yᵢ, wᵀxᵢ) + λ‖w‖², with λ = 0.01 and no normalization of the weighted loss. They rerun on the same data with every sᵢ multiplied by 10, same λ and optimizer settings. What happens to the fitted coefficients?
MCQ-6A team fits scikit-learn `LogisticRegression` twice on the same 20,000 standardized rows, same solver and tolerance, changing only `C`. Fit A ends with training log-loss 0.02 and validation log-loss 0.51; Fit B ends with training log-loss 0.31 and validation log-loss 0.34. One fit used `C=1.0`, the other `C=1000`. Which assignment and reason is correct?
MCQ-7A team must choose the L2 penalty strength λ for a ridge model on a 10,000-row tabular dataset and then report one final generalization number. Which selection-and-evaluation procedure is correct?
MCQ-8A team sweeps the L2 penalty λ on a 1.2M-row click model, changing nothing else, and measures held-out log-loss on a time split. Results: λ=0.001 → train 0.28, held-out 0.55; λ=0.03 → 0.41, 0.47; λ=0.3 → 0.52, 0.44; λ=3.0 → 0.62, 0.63. A constant-rate predictor scores 0.64 on both. Which observation indicates the penalty is too strong?
MCQ-13A team fits a lasso on 40 observational features from 200k production telemetry rows, standardizing each feature before fitting. After tuning λ by 5-fold CV, `db_size` keeps a nonzero coefficient in all five folds, and the model is well calibrated on held-out data. The team plans to shrink the database because 'the model says db_size drives latency'. Why does the nonzero coefficient not support that plan?
MCQ-17An engineer fits `LogisticRegression(penalty='elasticnet', l1_ratio=0.3, solver='lbfgs')` on a 2.4M-row, 600-feature standardized dataset and gets `ValueError: Solver lbfgs supports only 'l2' or 'none' penalties, got elasticnet penalty.` The elastic-net penalty must stay exactly as configured. Which change makes the fit run?
MCQ-4A team fits a linear model on 200 samples with 40 features. Twelve of the features are near-duplicates of one another (pairwise correlation 0.98) and jointly carry the signal; the other 28 are noise. With lasso at alpha = 0.1, cross-validation selects a model with 1 nonzero coefficient and test R² = 0.61. Elastic net at the same alpha = 0.1 with l1_ratio = 0.5 selects 12 nonzero coefficients and reaches test R² = 0.78. What explains the difference?
MCQ-9A team fits a lasso on 200 samples where two predictors correlate at r = 0.97 and each correlates similarly with the target. Refitting on bootstrap resamples flips which of the two gets the nonzero coefficient, while held-out error barely moves. Which explanation fits?
MCQ-10A team fits a linear model on 200 rows with two predictors, x1 and x2, that correlate at 0.99, plus 4,998 noise features. Lasso with alpha chosen by 10-fold CV selects x1 in 11 of 20 bootstrap resamples and x2 in 9, never both, and its held-out RMSE is 0.42. They refit with elastic net at l1_ratio = 0.5 and the same CV budget. Which result is the elastic net most likely to produce?
MCQ-18A team trains a 6-layer MLP with dropout on every hidden layer. The training code zeroes each hidden unit with probability 0.2 and multiplies the surviving activations by 1.25. At serving time dropout is disabled. One hidden unit's activation before the dropout mask is applied is 10.0. What is the unit's expected activation during training, and what is its activation at serving?
MCQ-20A team trains an MLP with dropout p = 0.25 on its hidden layers. The serving runtime has no dropout operator, so the exported inference graph is just the plain layer stack, and the same checkpoint is later reloaded to continue training with dropout still active. Training and inference must produce matching expected activations. What should the training forward pass do?
MCQ-19A team trains a CNN to distinguish left-turn from right-turn traffic signs on 5,000 labeled images and adds augmentation to reduce overfitting. Which augmentation choice would hurt rather than help?
MCQ-11A team trains a 3-layer MLP for 12 epochs on 200,000 rows, holding out 20,000 rows for validation and keeping a separate 20,000-row test set untouched. Training loss falls every epoch, from 0.61 to 0.08. Validation loss falls from 0.62 at epoch 1 to 0.45 at epoch 4, then rises to 0.46 at epoch 5, 0.49 at epoch 6, and 0.53 by epoch 12. Which action applies early stopping as a capacity control?
MCQ-12Two runs of the same 3-layer MLP on the same 12,000-example dataset, same seed and batch order, differ only in learning rate. Losses by epoch (1–8): | epoch | A train | A val | B train | B val | | --- | --- | --- | --- | --- | | 1 | 1.20 | 1.25 | 1.20 | 1.30 | | 2 | 0.61 | 0.68 | 2.90 | 3.40 | | 3 | 0.40 | 0.47 | 0.80 | 0.90 | | 4 | 0.29 | 0.39 | 4.10 | 5.00 | | 5 | 0.23 | 0.37 | 1.10 | 1.40 | | 6 | 0.19 | 0.38 | 6.30 | 7.80 | | 7 | 0.16 | 0.42 | 1.70 | 2.10 | | 8 | 0.14 | 0.49 | 9.80 | 11.60 | Run A uses lr 0.01, Run B lr 0.80. The team must report one checkpoint as an early-stopping regularization result. Which choice is correct?
MCQ-21A team trains a 4-layer MLP on 50k examples with dropout p=0.5 on every hidden layer, weight decay 1e-2, and early stopping with patience=3 monitoring validation loss. Validation loss over the first five epochs is 0.62, 0.58, 0.61, 0.59, 0.63, and training loss at epoch 2 is 0.55 and still falling. Training stops at epoch 5 with the epoch-2 checkpoint. A rerun with the same dropout and weight decay but patience=20 reaches validation loss 0.41 at epoch 25. Which conclusion do these numbers support?
MCQ-24A team fits a linear regression by gradient descent from w = 0 with a small fixed learning rate. They find that stopping after k steps gives validation error close to that of training to convergence with an L2 penalty λ, and that halving k resembles roughly doubling λ. Which statement best explains this correspondence?