Skip to content
Tech Interview Prep
Technical interview guideNew

Principal Component Analysis (PCA)

Linear dimensionality reduction that rotates features onto orthogonal directions of maximum variance, so a few components keep most of the information. Interviews probe the covariance and SVD derivation, scaling and leakage discipline, and what PCA cannot do.

Read
14 min
Practice MCQs
25
Interview Q&A
25
Edition
v1
Editorial status
Reviewed

Scope: Mathematics is version-independent. Code examples target scikit-learn 1.5 or later (sklearn.decomposition.PCA with svd_solver auto, full, arpack, randomized and covariance_eigen; whiten and n_components as documented). Default behaviour: centres features, does not scale them, and fits on the data passed to fit..

Curated: · Written: · Reviewed:

25 questions · Flow follows Relevance until this set has a learning order.

MCQ-1A team runs PCA on 500 adults using two unscaled features: height in centimetres (standard deviation about 8) and annual income in dollars (standard deviation about 40,000). The first principal component loads 0.999 on income and 0.04 on height, and it explains 99.9% of the variance. What should the team do before interpreting the components?
MCQ-2A dataset of 500 points in two features has been centred, and its covariance matrix is `[[4, 0], [0, 1]]`. What does the first principal component maximise?
MCQ-3A churn model has 400 rows and 60 features. The pipeline is a StandardScaler, then PCA with 20 components, then logistic regression. The scaler and PCA are both fitted on all 400 rows before a 300/100 train-test split, and test accuracy is 0.91, which a colleague calls optimistic. What is the smallest change that gives an honest test score?
MCQ-4A 40-feature sensor table has PCA eigenvalues that fall gradually with no clear elbow, and a ridge regressor needs a fixed number of components. Five-fold validation RMSE, with PCA refitted inside each training fold, is 0.91 at k=3, 0.74 at k=6, 0.73 at k=8 and 0.78 at k=12, with a fold standard error of 0.03. Which rule should set k?
MCQ-5A centred dataset with eight features gives covariance eigenvalues, listed in the order the library returned them: 0.5, 6, 0.2, 1, 0.1, 2, 0.05 and 0.15. What share of total variance do the first two principal components keep?
MCQ-6A centred dataset has covariance eigenvalues 5.0, 2.0, 0.6 and 0.4. A regression on the scores of its first two components has high test error, and the team reports reconstruction error for those two components. What mean squared reconstruction error per row does keeping two components leave?
MCQ-7A PCA was fit on three sensor features using training rows, where the per-feature means were (10, 50, 200) and the standard deviations were (2, 5, 40). The PC2 loadings are (0.6, -0.8, 0.0). A new reading arrives as raw values (12, 45, 240), and the team needs its PC2 score. Which score should they report?
MCQ-8A nightly job refits PCA on 12 sensor features, scores each reading on PC1, and feeds those scores to a linear alarm whose PC1 weight was learned last month. Tonight every component's loadings are the negative of last month's, and the alarm fires on every reading. Which change stops the false alarms?
MCQ-9A gene-expression table has 50 samples and 20000 features, and the team wants its top principal components quickly. The data is already centred. Which computation should they run?
MCQ-10A team applies PCA to two-feature crescent-shaped class data and keeps both components, which is all the data has. Which property of PCA explains why the class arcs stay tangled in the new coordinates?
MCQ-11A centred, standardised 12-feature table has covariance eigenvalues 6.0, 3.0, 1.5, 0.5 and 0.01, with the other seven effectively zero. The team's rule keeps at least 90% of variance, and the downstream linear model needs whitened inputs. With five whitened components, test RMSE rose from 0.8 to 3.1 while training RMSE fell. Which setting meets the rule and the model's needs?
MCQ-12A churn classifier on 500 rows and 80 features is scored with 5-fold cross-validation. Pipeline A runs PCA on all 500 rows, keeps 10 components, then cross-validates a logistic regression on those scores. Pipeline B wraps PCA and the logistic regression in one estimator that is refitted on each training fold. Which pipeline gives an honest cross-validated score?
MCQ-13A credit-risk model starts with 300 raw features. The regulator requires every model input to be an original named column traceable to a source system, the validation AUC must stay within 0.01 of the full model, and the auditor wants a short list. Which approach should the team use to choose the inputs?
MCQ-14A team plots the two UMAP coordinates of 5,000 customers and wants to tell stakeholders that the horizontal axis measures total spend. How should they report that axis?
MCQ-15A standardised sensor table has six columns: temperature, pressure, flow, vibration, humidity and voltage. PC1 loads between 0.48 and 0.52 on the first four and near 0 on humidity and voltage, and explains 71% of variance. PC2 loads about 0.9 on humidity and 0.7 on voltage, and explains 22%. A legacy controller accepts only three raw columns, and each must keep its original name. Which three should the team keep?
MCQ-16A team runs PCA on 100 rows of two sensor channels. Both channels have spread near 1 and look uncorrelated, but one row reads (30, 30). The mean is already subtracted. PC1 comes out as (1, 1)/√2 and explains 95% of total variance. What should the team do before using PC1?
MCQ-17A centred dataset's covariance matrix has eigenvalues 4, 1 and 0.5, and the team wants to keep two principal components. What share of total variance do those two components retain?
MCQ-18A team runs PCA on a centred data matrix `X` with a condition number near 10^12 by eigendecomposing `X^T X`, and the leading components flip sign and drift between runs. Which change makes the component computation numerically stable?
MCQ-19A PCA was fit on training rows whose covariance eigenvalues are 36 for PC1 and 9 for PC2, after centring on the training means (10, 50). The PC2 loadings are (0.6, -0.8). A raw reading of (20, 50) arrives, and the team wants its whitened PC2 score. Which value should they report?
MCQ-20A fraud model fits a StandardScaler and a PCA on 400 training rows, then a logistic regression on the component scores. Each week a batch of 100 new rows arrives with feature means drifted from the training means, and the scores must feed the same classifier unchanged. How should the team compute the batch scores?
MCQ-21A logistic regression on 500 raw features scores 0.90 on held-out rows. A candidate swaps in PCA scores from 10 components that keep 95% of the variance, and test accuracy falls to 0.74. They argue the dropped 5% was noise, so the classifier must be at fault. What should the team do next?
MCQ-22A team standardises 50 features and runs PCA on the correlation matrix. The eigenvalues of the top five components are 14.0, 6.5, 3.0, 1.8 and 1.2. The team keeps those five components and drops the rest. What share of the total variance in the standardised data do the kept components retain?
MCQ-23A sensor dataset has 3,000 rows and 20 standardised features forming three tight clusters that differ mainly along low-variance directions. Standardised PCA projected to two components shows the clusters overlapping, and the team must present a 2D plot where they separate. Which 2D view should they present?
MCQ-24A centred dataset has 51 rows, and its sample covariance (divisor n-1) has eigenvalues 3.0, 1.2, 0.5 and 0.3. You keep the top 2 principal components, project each row onto them, and reconstruct the rows from those scores. What is the total squared reconstruction error summed over all 51 rows?
MCQ-25An engineer proposes feeding the 2-D t-SNE output for 5,000 customers into a production churn classifier. A rerun with a different random seed gives coordinates that look different, and new customers must be scored daily without re-embedding the whole table. Which change gives features that are stable and usable at scoring time?