AI Computer Institute
Expert-curated CS & AI curriculum aligned to CBSE standards. A bharath.ai initiative. About Us

Grade 10 AI & Computer Science Practice Questions — Set 9

20 questions from the Grade 10 bank, each with its answer and a full explanation. Set 9 of 11 · 221 questions in this grade.

Reading is revision; testing is practice. Take the same questions as a timed quiz →

Question 161 · LightGBM: Lightweight but Mighty · hard

LightGBM's Gradient-based One-Side Sampling (GOSS) speeds up training by not scanning every instance's gradient at each split. Suppose a team training a LightGBM fraud-detection model on N = 50,000 UPI transactions is at a boosting round where GOSS keeps the top a = 20% of instances by |gradient| in full (set A, 10,000 instances) and randomly samples b = 10% of the total N (set B, 5,000 instances) from the remaining 40,000 low-gradient instances. To keep the estimated information gain of a candidate split an unbiased estimator of the gain that would be computed using the complete 50,000-instance dataset, by what constant factor must each sampled instance's gradient in set B be multiplied before it is summed into the gain calculation, and what is the correct justification for that factor?

  1. (1-a)/b = 8, because sampling 5,000 of the 40,000 low-gradient instances is a 1-in-8 draw, so scaling each sampled gradient by 8 undoes the under-representation and restores an unbiased sum.
  2. a/b = 2, because it directly compares the 20% kept in set A against the 10% sampled into set B, correcting for their relative sizes.
  3. 1/b = 10, because set B contains only 10% of the full 50,000-instance training set, so dividing by that global sampling fraction rescales the sampled sum back to population size.
  4. (1-a)×b = 0.08, because multiplying the excluded fraction by the sampled fraction down-weights the noisy low-gradient instances so they cannot dominate the split-gain estimate.

Answer: A. (1-a)/b = 8, because sampling 5,000 of the 40,000 low-gradient instances is a 1-in-8 draw, so scaling each sampled gradient by 8 undoes the under-representation and restores an unbiased sum.

ExplanationThe remaining low-gradient pool has M = (1-a)N = 0.8 x 50,000 = 40,000 instances, and set B draws m = bN = 0.1 x 50,000 = 5,000 of them uniformly at random. Each low-gradient instance therefore has inclusion probability m/M = 5,000/40,000 = 1/8, equivalently b/(1-a) = 0.1/0.8 = 0.125. A Horvitz-Thompson-style estimator restores an unbiased total by weighting each observed unit by the reciprocal of its inclusion probability, M/m = (1-a)/b = 0.8/0.1 = 8. Multiplying every sampled low-gradient instance's gradient by 8 before summing makes the expected weighted sum over the 5,000 sampled instances equal to the true sum over all 40,000 low-gradient instances, so the split-gain estimate GOSS uses matches what full-data gradient boosting would compute, letting LightGBM skip most low-information instances without biasing which feature and threshold get chosen for the tree split. Using a/b = 2 mixes up which fraction is being corrected — a describes set A's size relative to N, not the sampling rate inside the remaining low-gradient pool. Using 1/b = 10 forgets that b is defined as a fraction of the full N, not of the (1-a)N pool actually being sampled from, so it over-corrects and inflates set B's influence beyond what unbiasedness requires. Multiplying by (1-a)xb = 0.08 moves in the wrong direction entirely — it shrinks rather than inflates the under-sampled gradients, which would systematically bias the split-gain estimate toward zero in low-gradient regions of the feature space, exactly the opposite of what GOSS's correction is designed to do.

Question 162 · t-SNE and UMAP: Beautiful Data Visualization · hard

You are using t-SNE to visualize a high-dimensional ISRO satellite telemetry dataset as a 2D scatter plot. In the resulting embedding, two sensor readings i and j land at squared Euclidean distance ||y_i − y_j||² = 1, while two other readings k and l land at squared distance ||y_k − y_l||² = 4. Using t-SNE's actual low-dimensional similarity kernel q ∝ (1 + ||y_a − y_b||²)⁻¹ (a Student's t-distribution with 1 degree of freedom), what is the ratio of the unnormalized similarity of pair (i, j) to that of pair (k, l), and what does this reveal about how t-SNE avoids the crowding problem that a Gaussian-based low-dimensional kernel would cause?

  1. Using 1/d² instead of the t-SNE kernel gives similarities of 1 and 0.25, a ratio of 4; this shows that t-SNE's low-dimensional kernel is an inverse-square decay law with no offset term, so it behaves exactly like Coulomb's law in physics.
  2. The correct low-dimensional similarities are e⁻¹ ≈ 0.368 and e⁻⁴ ≈ 0.018, a ratio of about 20; this steep drop-off is precisely the mechanism that lets t-SNE keep every pairwise distance in the 2D map proportional to the corresponding distance in the original high-dimensional space.
  3. The unnormalized t-distribution similarities are 0.5 and 0.2, giving a near-to-far ratio of 2.5, versus a Gaussian-kernel ratio of about 4.48 for the same two distances; because the t-distribution punishes the farther pair less severely, moderately distant points are not dragged inward as strongly, which is what prevents the crowding problem.
  4. The unnormalized similarities are 0.5 and 0.2, a ratio of 2.5, and because this ratio is smaller than the Gaussian kernel's, the t-distribution penalizes distant pairs more harshly than a Gaussian would, which is why t-SNE embeddings show tightly separated clusters.

Answer: C. The unnormalized t-distribution similarities are 0.5 and 0.2, giving a near-to-far ratio of 2.5, versus a Gaussian-kernel ratio of about 4.48 for the same two distances; because the t-distribution punishes the farther pair less severely, moderately distant points are not dragged inward as strongly, which is what prevents the crowding problem.

ExplanationPlug the two squared distances directly into t-SNE's low-dimensional kernel, q ∝ (1 + d²)⁻¹, which is the density of a Student's t-distribution with one degree of freedom (equivalently a Cauchy distribution): For pair (i, j): d² = 1, so unnormalized similarity = (1 + 1)⁻¹ = 1/2 = 0.5. For pair (k, l): d² = 4, so unnormalized similarity = (1 + 4)⁻¹ = 1/5 = 0.2. Ratio = 0.5 / 0.2 = 2.5. Now compare this to what a Gaussian kernel (the kind used for the high-dimensional similarities, and the kernel original SNE mistakenly also used in the low-dimensional map) would give for the same two distances, using q ∝ exp(−d²/2): exp(−1/2) ≈ 0.6065, exp(−4/2) = exp(−2) ≈ 0.1353. Ratio ≈ 0.6065 / 0.1353 ≈ 4.48. The key comparison is 2.5 versus 4.48: the Gaussian kernel drives the far pair's relative weight down almost twice as fast as the t-kernel does. This is the crowding problem in action. In a high-dimensional space, the volume available at moderate distances from any point grows enormously (roughly as r^(m−1) in m dimensions), so a great many points end up at "medium" pairwise distance from one another. A 2D map has far less room, so it cannot honor all of those medium distances simultaneously. If the low-dimensional kernel has thin, exponentially-decaying Gaussian tails, the optimization is forced to squeeze these medium-distance points in close just to keep their similarity from collapsing to near zero — which crushes genuinely distinct clusters into one crowded blob near the center of the map. Because the t-distribution's tail decays polynomially (as 1/d² for large d) instead of exponentially, moderately separated points can sit farther apart in the 2D embedding while still retaining a non-negligible share of similarity (ratio 2.5 rather than 4.48), so the optimizer is not forced to drag them inward. That extra "breathing room" in the tails is exactly why van der Maaten and Hinton (2008) chose the 1-degree-of-freedom Student-t distribution for the map space while keeping the Gaussian for the original high-dimensional similarities — and it is the same heavy-tailed intuition (via fuzzy simplicial sets) that lets UMAP produce well-separated clusters too.

Question 163 · ARIMA: Time Series Forecasting · hard

NPCI's data-science team fits an ARIMA(1,1,0) model to the daily UPI transaction volume X_t (in crore transactions). Because the raw series trends upward, they first-difference it once (d=1) and fit an AR(1) model to the differenced series with no constant term: (X_t − X_{t-1}) = 0.5 × (X_{t-1} − X_{t-2}) + ε_t The last three recorded days give X_{t-2} = 240, X_{t-1} = 250, X_t = 265 (all in crore transactions). Using this fitted model, what is the one-step-ahead forecast X̂_{t+1} for tomorrow's UPI transaction volume?

  1. ≈272.5 crore transactions, found by adding the AR(1)-forecasted change (0.5 × 15) to today's actual volume of 265 crore
  2. ≈270 crore transactions, found by adding 0.5 times yesterday's change (250 − 240 = 10) to today's actual volume of 265 crore
  3. 7.5 crore transactions, the AR(1) equation's direct output for tomorrow's change in transaction volume
  4. ≈132.5 crore transactions, found by multiplying today's actual volume of 265 crore by the AR coefficient 0.5

Answer: A. ≈272.5 crore transactions, found by adding the AR(1)-forecasted change (0.5 × 15) to today's actual volume of 265 crore

ExplanationThe "I" in ARIMA(1,1,0) means the AR(1) equation is not fitted to X_t itself but to its first difference, ΔX_t = X_t − X_{t-1}. So the first job is to build the differenced series from the three given levels: ΔX_{t-1} = X_{t-1} − X_{t-2} = 250 − 240 = 10 ΔX_t = X_t − X_{t-1} = 265 − 250 = 15 The fitted AR(1) model says each differenced value depends on the immediately preceding differenced value, so the forecast for tomorrow's change uses the most recent difference, ΔX_t = 15, not the older one: ΔX̂_{t+1} = 0.5 × ΔX_t = 0.5 × 15 = 7.5 This 7.5 is a forecast of the change in volume, not the volume itself — stopping here (as in the 7.5-crore option) skips the "integration" step that undoes the differencing. To recover a level forecast, add the predicted change back onto the last known level, X_t = 265: X̂_{t+1} = X_t + ΔX̂_{t+1} = 265 + 7.5 = 272.5 So NPCI's model forecasts tomorrow's UPI volume at ≈272.5 crore transactions. The 270-crore option comes from an off-by-one error — plugging in ΔX_{t-1} = 10 (yesterday's change) instead of ΔX_t = 15 (today's change) into the AR(1) equation, which would use stale information the model has already moved past. The 132.5-crore option comes from ignoring differencing altogether and applying the AR coefficient straight to the raw level (0.5 × 265), which corresponds to a stationary AR(1) model on X_t itself — not what ARIMA(1,1,0) specifies, since d=1 was chosen precisely because the raw series is non-stationary and trending, so a model that shrinks the level toward zero each step is structurally wrong for this data.

Question 164 · Causal Inference: Cause vs Correlation · hard

In a district of Rajasthan, a public-health researcher collects 12 months of data on three variables: X = number of air-conditioner (AC) units sold, Y = number of snake-bite cases reported, and Z = average monthly temperature. The simple (zero-order) correlation coefficients computed from the data are r_XY = 0.85, r_XZ = 0.95, and r_YZ = 0.90. Using the first-order partial correlation formula r_XY.Z = (r_XY − r_XZ·r_YZ) / √[(1 − r_XZ²)(1 − r_YZ²)], what does the partial correlation between AC sales and snake-bite cases, after controlling for temperature, reveal about the raw correlation r_XY = 0.85?

  1. r_XY.Z ≈ 0.85, exactly unchanged after controlling for temperature, which confirms that AC sales directly cause a rise in snake-bite incidents
  2. r_XY.Z ≈ -0.04, which is close enough to zero to show that temperature is a confounding variable that fully accounts for the raw correlation between AC sales and snake-bite cases, with no direct causal link between them
  3. The partial correlation cannot be calculated from r_XY, r_XZ, and r_YZ alone, because computing r_XY.Z additionally requires knowing the sample size used to estimate each coefficient
  4. r_XY.Z ≈ 0.99, an even stronger association than the raw correlation, which proves that snake-bite cases are actually the cause driving people to buy more AC units

Answer: B. r_XY.Z ≈ -0.04, which is close enough to zero to show that temperature is a confounding variable that fully accounts for the raw correlation between AC sales and snake-bite cases, with no direct causal link between them

ExplanationSubstituting the three simple correlations into the first-order partial correlation formula isolates the X-Y relationship with Z's influence removed. The numerator is r_XY − r_XZ·r_YZ = 0.85 − (0.95)(0.90) = 0.85 − 0.855 = −0.005. The denominator is √(1 − 0.95²)·√(1 − 0.90²) = √0.0975 · √0.19 = 0.3123 × 0.4359 ≈ 0.1361. Dividing gives r_XY.Z = −0.005 / 0.1361 ≈ −0.04. A raw correlation of 0.85 looked like strong evidence linking AC purchases to snake bites, but once temperature (Z) is held statistically constant, the association collapses to essentially zero. That is exactly the algebraic signature of confounding: rising temperature independently drives both AC sales (people buy cooling equipment when it's hot) and snake-bite reports (snakes are more active and humans work outdoors more in heat), which manufactures a spurious correlation between X and Y even though neither causes the other. This is the same logic behind the classic "ice-cream sales vs. drowning deaths" example, where summer heat is the hidden common cause. The claim that r_XY.Z stays at 0.85 ignores what conditioning on a confounder does to a correlation and wrongly asserts direct causation from an unadjusted number. The claim that r_XY.Z rises to 0.99 misapplies the formula — subtracting the product r_XZ·r_YZ from r_XY here produces a value close to zero, not a larger one — and additionally proposes an implausible reverse-causal story. The claim that sample size is needed to compute r_XY.Z confuses the point estimate of a partial correlation (which needs only the three zero-order correlation coefficients, as used above) with a significance test of that estimate (which is where sample size would matter, e.g., for a t-test on r_XY.Z).

Question 165 · A/B Testing: Statistical Experiments · hard

Vidya, a CBSE exam-prep app, A/B tests a redesigned "Start Mock Test" button. Group A (2,500 students, existing blue button) recorded 300 conversions; Group B (2,500 students, new orange button) recorded 348 conversions. Using a two-proportion z-test with the pooled standard error, and testing at the 95% confidence level (two-tailed, z_crit = 1.96), what is the z-statistic and the correct conclusion?

  1. The raw gap between the two conversion rates is 1.92 percentage points, which is smaller than the critical value of 1.96, so the difference is not statistically significant.
  2. Although z ≈ 2.02 exceeds 1.96, it falls short of the stricter two-tailed 99% threshold of 2.576, so the result should be treated as inconclusive and the button change should not ship.
  3. Pooling the two groups gives p̂ = 648/5000 = 0.1296, so the standard error is sqrt(0.1296 × 0.8704 × (1/2500 + 1/2500)) ≈ 0.0095, and z = (0.1392 − 0.12)/0.0095 ≈ 2.02, which exceeds 1.96, so the improvement is statistically significant at 95% confidence.
  4. Computing the standard error as sqrt(p̂(1−p̂)/2500), which accounts for only one group's sampling variability, gives SE ≈ 0.0067 and z ≈ 2.86, also significant at 95% confidence.

Answer: C. Pooling the two groups gives p̂ = 648/5000 = 0.1296, so the standard error is sqrt(0.1296 × 0.8704 × (1/2500 + 1/2500)) ≈ 0.0095, and z = (0.1392 − 0.12)/0.0095 ≈ 2.02, which exceeds 1.96, so the improvement is statistically significant at 95% confidence.

ExplanationPool the two groups since the null hypothesis assumes both buttons share the same true conversion rate: p̂ = (300+348)/(2500+2500) = 648/5000 = 0.1296. The pooled standard error is SE = sqrt[p̂(1−p̂)(1/nA + 1/nB)] = sqrt[0.1296 × 0.8704 × (1/2500 + 1/2500)] = sqrt(0.11280384 × 0.0008) = sqrt(0.0000902431) ≈ 0.0095. The test statistic is z = (p̂B − p̂A)/SE = (0.1392 − 0.12)/0.0095 = 0.0192/0.0095 ≈ 2.02. Since 2.02 exceeds the two-tailed critical value of 1.96 (the boundary for a 5% significance level), the null hypothesis of equal conversion rates is rejected — the orange button's higher conversion rate is statistically significant at 95% confidence. The distractors trade on real mistakes: comparing the raw 1.92-percentage-point gap directly against 1.96 skips the standard-error calculation entirely — percentage points and z-scores are different units that happen to look numerically similar here, which is exactly what makes this error tempting; silently substituting the 99% critical value (2.576) applies a stricter bar than the 95% level the problem specifies; and computing the standard error using only 1/nA ignores Group B's sampling variability, which distorts the standard error (and hence z) even though it happens to point to the same significant conclusion.

Question 166 · Confidence Intervals: Uncertainty Quantification · hard

A team analyzing digital payments for a fintech startup samples n = 100 UPI transactions completed through a merchant's app during a weekend festive sale, and computes a sample mean transaction amount x̄ = ₹450 with sample standard deviation s = ₹80. Assuming the sample size is large enough for the Central Limit Theorem to justify treating the sampling distribution of the mean as approximately normal, which of the following correctly computes the 95% confidence interval for the true mean UPI transaction amount μ, and correctly states what that interval means?

  1. Margin of error = 1.96 × (80/√100) = ₹15.68, giving the interval ₹434.32 to ₹465.68; if this sampling procedure were repeated many times, about 95% of the resulting intervals would contain the true mean μ.
  2. Using the same interval, ₹434.32 to ₹465.68, computed correctly, one can additionally state there is a 95% probability that μ itself lies inside this particular fixed interval.
  3. Applying the margin of error as 1.96 × ₹80 = ₹156.80 directly to x̄ gives the interval ₹293.20 to ₹606.80, since the sample standard deviation already estimates the spread of μ across repeated sampling.
  4. Taking the critical value as 1.645 (appropriate for a 90% confidence level) with the standard error ₹8 yields the interval ₹436.84 to ₹463.16 for a 95% confidence claim.

Answer: A. Margin of error = 1.96 × (80/√100) = ₹15.68, giving the interval ₹434.32 to ₹465.68; if this sampling procedure were repeated many times, about 95% of the resulting intervals would contain the true mean μ.

ExplanationThe standard error of the sample mean is SE = s/√n = 80/√100 = 80/10 = ₹8. For a 95% confidence level, the two-tailed critical value from the standard normal distribution is z = 1.96, since Φ(1.96) = 0.975 leaves 2.5% in each tail. The margin of error is therefore ME = z × SE = 1.96 × 8 = ₹15.68, giving the interval x̄ ± ME = 450 ± 15.68, which is ₹434.32 to ₹465.68. The interpretation matters as much as the arithmetic. The true mean μ is a fixed, though unknown, number, not a random variable, so it makes no sense to assign a probability to whether it lies inside one already-computed interval — that interval either contains μ or it does not. The correct frequentist reading is a statement about the procedure: if repeated samples of size 100 were drawn and an interval built the same way each time, approximately 95% of those intervals would contain μ. Claiming there is "a 95% probability that μ lies in this specific interval" converts a statement about the long-run behaviour of the procedure into a statement about a fixed constant — the single most common misreading of confidence intervals in exam settings, even when the underlying arithmetic is done correctly. The two computational distractors fail for different reasons. Using z × s directly (margin ₹156.80, interval ₹293.20 to ₹606.80) skips dividing by √n entirely, so it mistakes the spread of individual transaction amounts for the spread of the sample mean — that interval describes where most single transactions fall, not where μ is likely to lie. Using z = 1.645 (interval ₹436.84 to ₹463.16) borrows the critical value for a 90% confidence level, since Φ(1.645) ≈ 0.95 in a two-tailed sense corresponds to 90% central coverage, not 95%; applying it while claiming 95% confidence understates the true margin of error.

Question 167 · Bootstrapping: Confidence Without Theory · hard

A researcher builds a bootstrap resample by drawing 500 records with replacement from an original dataset of 500 UPI transaction logs, where every one of the 500 draws is independent and any record may be drawn more than once. What is the probability, to the nearest whole percent, that one specific transaction record from the original dataset is left out of this single bootstrap resample entirely?

  1. About 37%, since the probability of missing a specific record on every one of the 500 independent draws is (1 − 1/500)^500, which converges toward 1/e as the sample size grows large.
  2. About 63%, since a record's chance of being excluded is the complement of the roughly 37% probability that it appears at least once in the resample.
  3. About 50%, since with 500 independent draws from 500 records, each record is equally likely overall to end up included or excluded.
  4. About 0.2%, since the record has a 1-in-500 chance of being missed on any single draw and this probability does not compound across the 500 draws.

Answer: A. About 37%, since the probability of missing a specific record on every one of the 500 independent draws is (1 − 1/500)^500, which converges toward 1/e as the sample size grows large.

ExplanationEach of the 500 draws in a bootstrap resample is independent and with replacement, so on any single draw a specific record is chosen with probability 1/500 and missed with probability 1 − 1/500 = 0.998. Because the draws are independent, the probability that the record is missed on all 500 draws is the product (0.998)^500 = (1 − 1/500)^500. Taking logarithms, ln(0.998) ≈ −0.0020020, so 500·ln(0.998) ≈ −1.00100, giving (0.998)^500 ≈ e^(−1.00100) ≈ 0.3675, which is about 36.8% and rounds to 37%. This is the finite-sample version of the classical bootstrap limit (1 − 1/n)^n → e^(−1) ≈ 0.3679 as n grows large, meaning roughly a third of the original data is systematically absent from any single bootstrap resample no matter how large the dataset gets — these left-out points are exactly the "out-of-bag" sample that lets bagged models like random forests validate themselves without a separate holdout set. The 63% figure is the complementary event (inclusion, not exclusion, of the record), the 50% guess wrongly treats inclusion and exclusion as equally likely coin flips with no compounding across draws, and the 0.2% answer mistakes the single-draw miss probability (1/500) for the probability of missing on all 500 draws, ignoring that the exclusion event must hold simultaneously across every draw.

Question 168 · Collaborative Filtering: Learn from Others · hard

Reelverse, a movie-recommendation app popular with Indian college students, uses user-based collaborative filtering to predict how much a viewer will like a movie she hasn't watched yet. To correct for the fact that different raters have different personal baselines — some viewers rate everything generously, others are harsh critics — Reelverse mean-centers each neighbour's rating before combining it, then adds the result back onto the target user's own average: pred(Ananya, movie) = mean(Ananya) + [ Σᵥ sim(Ananya, v) × (r(v, movie) − mean(v)) ] / Σᵥ |sim(Ananya, v)| Ananya's own average rating across all the movies she has scored is 3.5 stars. Her two nearest neighbours by similarity are Rohan, with similarity 0.8 to Ananya and an average rating of 3.0 stars, who rated this particular movie 5 stars, and Priya, with similarity 0.2 to Ananya and an average rating of 4.0 stars, who rated the same movie only 1 star. Applying Reelverse's mean-centered formula exactly as written above, what rating does it predict Ananya will give this movie?

  1. 4.2 stars — found by taking a straight similarity-weighted average of Rohan's and Priya's raw ratings, without adjusting for either neighbour's personal rating bias.
  2. 4.0 stars — found by mean-centering correctly but then dividing the weighted deviation sum by the number of neighbours (2) instead of by the sum of their similarity weights.
  3. 4.5 stars — found by mean-centering each neighbour's rating (subtracting their own average), combining the two deviations in a similarity-weighted average, and adding that average deviation back onto Ananya's own mean rating.
  4. 2.5 stars — found by mean-centering correctly but then subtracting the weighted average deviation from Ananya's mean instead of adding it.

Answer: C. 4.5 stars — found by mean-centering each neighbour's rating (subtracting their own average), combining the two deviations in a similarity-weighted average, and adding that average deviation back onto Ananya's own mean rating.

ExplanationAnanya's own mean rating is 3.5 stars. The mean-centered formula first converts each neighbour's raw rating into a deviation from that neighbour's own baseline, so it measures "did this person like the movie more or less than they usually rate," not the raw number. Rohan rated the movie 5 stars and his own average is 3.0 stars, so his deviation is 5 − 3.0 = 2.0. Priya rated it 1 star and her own average is 4.0 stars, so her deviation is 1 − 4.0 = −3.0. These deviations are then combined using similarity as the weight: (0.8 × 2.0) + (0.2 × −3.0) = 1.6 − 0.6 = 1.0. Dividing by the sum of the similarity weights, 0.8 + 0.2 = 1.0, gives a similarity-weighted average deviation of 1.0 ÷ 1.0 = 1.0. Adding this back onto Ananya's own mean gives the prediction: 3.5 + 1.0 = 4.5 stars. The mean-centering step is what makes this prediction meaningful: Rohan is a comparatively harsh rater (average 3.0) while Priya is a comparatively generous one (average 4.0), so their raw scores of 5 and 1 look far apart even though, relative to each person's own habits, Rohan's rating was only 2 stars above his norm and Priya's was 3 stars below hers. Because Rohan is four times as similar to Ananya as Priya is (0.8 versus 0.2), his relatively enthusiastic, bias-corrected reaction dominates the weighted combination and pulls the prediction up to 4.5, despite Priya's raw score being much lower than Rohan's.

Question 169 · Cold Start: New Users, New Items · hard

An Indian e-commerce app fights the new-item cold-start problem with a Bayesian shrinkage estimator for its "Trending" ranking: WR = (v/(v+m))·R + (m/(v+m))·C, where R is an item's own average rating, v is how many ratings it has received, C is the platform-wide average rating across all items, and m is a prior confidence constant — the number of ratings an item needs before its own average R is trusted more than the global average C. The platform's global average is C = 4.0. A product launched yesterday has received v = 5 ratings so far, all 5 stars, so R = 5.0. Using m = 25, what is the item's shrinkage-adjusted rating WR (rounded to two decimal places), and why does this correctly handle the cold-start item?

  1. WR = 4.17, because with only 5 of the 25 ratings needed for full confidence, the estimator weights R by 5/30 and C by 25/30, pulling the average down from 5.0 toward the global mean until more ratings accumulate.
  2. WR = 5.00, because the item's own 5 observed ratings already reflect genuine customer sentiment, so the estimator should use R directly without blending in the global average.
  3. WR = 4.50, because with limited data the fairest approach is to split confidence evenly between the item's own average and the global average, giving 0.5 weight to each.
  4. WR = 4.83, because the item's own average R is the more specific, directly measured quantity, so it should receive the larger weight m/(v+m), while the global average C gets the smaller weight v/(v+m).

Answer: A. WR = 4.17, because with only 5 of the 25 ratings needed for full confidence, the estimator weights R by 5/30 and C by 25/30, pulling the average down from 5.0 toward the global mean until more ratings accumulate.

ExplanationThe weight on the item's own average R is v/(v+m) = 5/30 = 1/6, and the weight on the global average C is m/(v+m) = 25/30 = 5/6 — m functions as a prior "pseudo-count," the number of ratings the item's own data must accumulate before it outweighs the platform-wide prior. So WR = (1/6)(5.0) + (5/6)(4.0) = 5/6 + 20/6 = 25/6 ≈ 4.17. This is exactly why shrinkage estimators solve the new-item cold start: as v → 0, WR → C, so an item with almost no ratings inherits a safe, statistically grounded default (the global mean) instead of an extreme value driven by a handful of data points. As v grows past m, WR → R, so the estimator gradually shifts trust to the item's own track record. This is the same mechanism behind IMDB's public Top-250 "weighted rating" formula and behind regularized matrix-factorization systems, where an item's latent vector is pulled toward zero (the prior) until enough interactions exist to estimate it reliably. Using R = 5.00 directly treats five ratings as fully reliable, but five 5-star ratings could easily come from friends, family, or early adopters unrepresentative of the wider customer base — precisely the volatility shrinkage is designed to dampen. Splitting the weight 50/50 (giving 4.50) implicitly assumes v equals m, which is false here: v = 5 is far below m = 25, so the global average should dominate far more than an even split allows — the blend must scale with how much evidence the item actually has, not a fixed ratio. Swapping the fractions to get 4.83 inverts the whole design: it assigns R the larger weight m/(v+m) and C the smaller weight v/(v+m). Taken to the extreme, a brand-new item with v = 0 ratings would then get weight m/(m+0) = 1 on R — full trust in an average computed from zero observations, which is undefined and reintroduces the exact cold-start failure the estimator exists to prevent.

Question 170 · Multi-Armed Bandits: Exploration vs Exploitation · hard

A student is comparing three UPI cashback apps — GPay, PhonePe, and Paytm — using an epsilon-greedy bandit strategy (epsilon = 0.15) to decide which app to open for each transaction, aiming to maximize total cashback earned. Over the first 15 transactions, the cashback (in rupees) earned each time an app was chosen was recorded as follows: GPay was used 6 times with cashback ₹12, ₹8, ₹15, ₹10, ₹19, ₹8; PhonePe was used 5 times with cashback ₹14, ₹11, ₹9, ₹16, ₹20; Paytm was used 4 times with cashback ₹5, ₹9, ₹6, ₹8. On trial 16, the algorithm exploits with probability (1 − epsilon) by opening the app with the highest empirical mean cashback so far, and explores with probability epsilon by choosing uniformly at random among all three apps (including the current best). What is the probability that Paytm is opened on trial 16?

  1. 5% (0.05) — because Paytm can only be selected during the exploration phase, whose probability is split evenly among all three UPI apps: 0.15 × (1/3).
  2. 7.5% (0.075) — treating exploration as uniform only over the two non-greedy apps (GPay and Paytm), giving 0.15 × (1/2) instead of dividing by all three arms.
  3. 15% (0.15) — assuming the full exploration probability epsilon is assigned directly to any specific non-greedy arm without splitting it among the K arms.
  4. 0% — assuming epsilon-greedy exploits the best-known app every single time once a leader is found, ignoring that exploration still runs on trial 16.

Answer: A. 5% (0.05) — because Paytm can only be selected during the exploration phase, whose probability is split evenly among all three UPI apps: 0.15 × (1/3).

ExplanationFirst compute each app's empirical mean cashback: GPay's six rewards sum to 12+8+15+10+19+8 = 72, giving a mean of 72/6 = ₹12. PhonePe's five rewards sum to 14+11+9+16+20 = 70, giving a mean of 70/5 = ₹14. Paytm's four rewards sum to 5+9+6+8 = 28, giving a mean of 28/4 = ₹7. PhonePe has the highest empirical mean, so it is the greedy (exploit) choice on trial 16; Paytm, having the lowest mean, is never selected by the exploit branch, which fires with probability 1 − epsilon = 0.85 and always opens PhonePe instead. Paytm can only be opened through the explore branch, which fires with probability epsilon = 0.15 and then picks uniformly among all three apps (GPay, PhonePe, Paytm) — so the chance the explore branch specifically lands on Paytm is 1/3. Multiplying these two independent probabilities gives 0.15 × (1/3) = 0.05, a 5% chance overall. This is the core exploration-exploitation trade-off in bandit algorithms: even a clearly underperforming arm retains a small, deliberate chance of being retried, which is what lets the algorithm detect a changing reward distribution later — but that chance must be epsilon divided by the full arm count K, not by K−1, and not left as the raw value of epsilon itself.

Question 171 · Activation Functions: Non-linearity is Key · hard

A Bengaluru fintech startup builds a toy neural network to score UPI transactions for fraud risk, using two standardized features x1 (transaction amount) and x2 (time-of-day deviation from the user's usual pattern). The network has one hidden layer with two neurons and one output neuron, and — by mistake — every neuron uses the identity activation f(z) = z instead of a non-linear activation like ReLU. The hidden layer computes h1 = 3x1 + 2x2 + 5 and h2 = x1 - 4x2 + 2, and the output neuron combines them as y = h1 + 2h2 - 3. Since f(z) = z everywhere, this two-layer network is mathematically identical to some single-layer model y = w1x1 + w2x2 + b with no hidden layer at all. What are the correct values of w1, w2, and b?

  1. Substituting h1 and h2 directly into y and collecting terms gives w1 = 5, w2 = -6, and b = 6, confirming the collapse into a single affine layer y = 5x1 - 6x2 + 6.
  2. Combining h1 and h2 without applying the output layer's weight of 2 to h2 gives w1 = 4, w2 = -2, and b = 4.
  3. Scaling only the x1 and x2 terms of h2 by the output weight 2 while leaving its constant term unscaled gives w1 = 5, w2 = -6, and b = 4.
  4. The network cannot be collapsed into a single affine layer at all, because composing two affine functions produces a genuinely non-affine result that preserves the extra representational power of the hidden layer.

Answer: A. Substituting h1 and h2 directly into y and collecting terms gives w1 = 5, w2 = -6, and b = 6, confirming the collapse into a single affine layer y = 5x1 - 6x2 + 6.

ExplanationSubstitute the hidden-layer expressions into the output: y = h1 + 2h2 - 3 = (3x1 + 2x2 + 5) + 2(x1 - 4x2 + 2) - 3. Distributing the 2 across every term of h2 (both variable and constant parts) gives 2x1 - 8x2 + 4, so y = (3x1 + 2x2 + 5) + (2x1 - 8x2 + 4) - 3. Collecting the x1 terms: 3x1 + 2x1 = 5x1. Collecting the x2 terms: 2x2 - 8x2 = -6x2. Collecting the constants: 5 + 4 - 3 = 6. So y = 5x1 - 6x2 + 6, meaning w1 = 5, w2 = -6, and b = 6. This works precisely because f(z) = z is itself an affine map, and the composition of any two affine maps is affine: if the hidden layer computes h = Ax + b and the output layer computes y = Ch + d, then y = C(Ax + b) + d = (CA)x + (Cb + d) — a single affine map, no matter how many layers are stacked. This is exactly why identity ("linear") activations make depth pointless: a 100-layer network built entirely from identity activations has no more representational capacity than a single layer with weight matrix CA and bias Cb + d. Only a genuinely non-linear activation — ReLU, sigmoid, tanh — breaks this collapse and lets depth actually build curved, piecewise, or non-monotonic decision boundaries (like a real fraud-risk classifier needs) that no single affine layer could ever represent.

Question 172 · Dropout: Fighting Overfitting · hard

A neural network layer receives 1000 input features and applies dropout during training with dropout rate r = 0.2, meaning each input is independently zeroed with probability 0.2 (kept with probability 0.8). At test time dropout is switched off entirely and all 1000 features pass through unmodified. To make the expected value of the layer's weighted sum z = Σ wᵢxᵢ identical during training and testing, every surviving (non-zeroed) input must be multiplied by a fixed scaling constant c immediately after masking, before the weights are applied. Setting E[z_train] = E[z_test] and solving for c, using the fact that each mask variable mᵢ is an independent Bernoulli random variable with keep probability 0.8, what is the correct numeric value of c that inverted-dropout scaling requires?

  1. c equals 1.25, since scaling by the reciprocal of the keep probability (1/0.8) exactly cancels the 0.8 factor introduced by masking, making E[z_train] = c(0.8)Σwᵢxᵢ = Σwᵢxᵢ = E[z_test].
  2. c equals 0.8, since multiplying by the keep probability itself directly restores the original weighted sum to its unmasked value during training.
  3. c equals 0.2, since scaling every surviving input by the dropout rate compensates for the fraction of inputs that were removed from the sum.
  4. c equals 1.2, since adding the dropout rate to 1 (1 + r = 1.2) accounts for the extra contribution each surviving input must carry to offset the dropped units.

Answer: A. c equals 1.25, since scaling by the reciprocal of the keep probability (1/0.8) exactly cancels the 0.8 factor introduced by masking, making E[z_train] = c(0.8)Σwᵢxᵢ = Σwᵢxᵢ = E[z_test].

ExplanationDuring training, the masked weighted sum is z_train = Σ mᵢ·c·wᵢxᵢ, where each mᵢ ~ Bernoulli(0.8) independently keeps or zeroes input i before it gets scaled by c. Taking the expectation and using linearity, E[z_train] = c·E[mᵢ]·Σwᵢxᵢ = c·(0.8)·Σwᵢxᵢ, since E[mᵢ] equals the keep probability 0.8 for every input. At test time no masking or scaling occurs, so E[z_test] = Σwᵢxᵢ exactly. Setting E[z_train] = E[z_test] gives c·0.8·Σwᵢxᵢ = Σwᵢxᵢ, and dividing both sides by 0.8·Σwᵢxᵢ (nonzero in general) yields c = 1/0.8 = 1.25. This is precisely the inverted-dropout rule: scale surviving activations by 1/(keep probability) during training so that the network's expected signal magnitude matches inference exactly, with no rescaling needed at test time. Using the keep probability itself (0.8) systematically shrinks z_train to 0.64 of z_test's expected scale, scaling by the dropout rate (0.2) shrinks it far more severely to 0.16 of the target, and using 1 + r (1.2) produces c·0.8 = 0.96 — close to but not equal to 1, a subtle mismatch that compounds across many dropout layers in a deep network. Only c = 1.25 makes E[z_train] and E[z_test] equal on the nose, which is why inverted dropout always scales by the reciprocal of the keep probability rather than by the keep probability or dropout rate directly.

Question 173 · Learning Rate Scheduling: Dynamic Speed Control · hard

A Bengaluru fintech team is training a UPI fraud-detection neural network using a cosine-annealing learning-rate schedule (no restarts) over its post-warm-up training phase, governed by η_t = η_min + ½(η_max − η_min)(1 + cos(πt/T)) with η_max = 0.09, η_min = 0.01, and a total post-warm-up run of T = 90 epochs. What is the learning rate η₃₀ at epoch t = 30?

  1. η₃₀ ≈ 0.0700, since the weight (1 + cos(π·30/90))/2 = 0.75 places it three-quarters of the way from η_min toward η_max.
  2. η₃₀ ≈ 0.0300, since cosine annealing here schedules the rate to warm up from η_min toward η_max as training proceeds.
  3. η₃₀ ≈ 0.0675, since η_min sets only the schedule's asymptotic floor and is not part of the epoch-30 weighted calculation itself.
  4. η₃₀ ≈ 0.1300, since the factor (1 + cos(π·30/90)) scales the full η_max − η_min range directly, without a compensating one-half factor.

Answer: A. η₃₀ ≈ 0.0700, since the weight (1 + cos(π·30/90))/2 = 0.75 places it three-quarters of the way from η_min toward η_max.

ExplanationSubstitute t = 30 and T = 90 into the phase angle: πt/T = π·30/90 = π/3 radians = 60°. Since cos(π/3) = 1/2, the bracket becomes (1 + cos(π/3)) = 1 + 0.5 = 1.5. The half-range scale factor is ½(η_max − η_min) = ½(0.09 − 0.01) = ½(0.08) = 0.04. Multiplying, 0.04 × 1.5 = 0.06, and adding the floor η_min gives η₃₀ = 0.01 + 0.06 = 0.07. Equivalently, the normalized weight w(t) = (1 + cos(πt/T))/2 equals 0.75 at t = 30, so η₃₀ sits exactly three-quarters of the way from η_min up to η_max — this is why cosine annealing barely moves the learning rate near t = 0 (θ ≈ 0, w ≈ 1), descends fastest through the midpoint (θ = π/2, w = 0.5), and flattens again as t → T (θ → π, w → 0), unlike a linear schedule that decays at a constant rate throughout. The distractors come from three genuine slips: swapping which endpoint the schedule approaches (producing a warm-up curve that rises from η_min to η_max instead of decaying), dropping η_min from the formula and treating it as a mere reference floor rather than an additive term, and forgetting the ½ that normalizes (1 + cosθ) — which ranges over [0, 2] — down to a proper weight in [0, 1].

Question 174 · Vanishing Gradients: The Deep Learning Crisis · hard

You are training a fully-connected feedforward network with 6 hidden layers, each using the sigmoid activation σ(z) = 1/(1+e^(−z)), to classify handwritten Devanagari digits. Every hidden layer's weight matrix has spectral norm (largest singular value) exactly equal to 1, so matrix multiplication alone never shrinks or amplifies the gradient's magnitude. By the chain rule of backpropagation, the gradient reaching the first hidden layer equals the output-layer gradient multiplied by one attenuation factor contributed by each of the 6 hidden layers, and each factor is bounded by ‖W‖ · max(σ'(z)). Given that σ'(z) = σ(z)(1 − σ(z)) reaches its maximum value of 0.25 at z = 0 (where σ(0) = 0.5), what is the tightest upper bound on the ratio of the first hidden layer's gradient magnitude to the output layer's gradient magnitude, and what does it imply for training?

  1. This chain multiplies six 0.25 factors, giving 0.25⁶ = 1/4096 ≈ 2.44×10⁻⁴ as the tightest bound, so the first layer's gradient can be over 4000 times smaller than the output layer's, meaning early layers effectively stop learning while later layers keep updating normally.
  2. Since σ(0) = 0.5, each layer contributes a factor of 0.5 rather than 0.25, giving a bound of 0.5⁶ = 1/64 ≈ 0.0156, so early-layer gradients are only moderately smaller than late-layer gradients and training remains fairly balanced across depth.
  3. Because every weight matrix has spectral norm exactly 1, matrix multiplication preserves gradient magnitude exactly, and the sigmoid derivatives cancel out algebraically across layers, so the ratio has no fixed upper bound and can equal or even exceed 1.
  4. Treating the six layers' effects as additive rather than multiplicative gives 1 − 6(0.25) = −0.5, implying gradients change sign and grow without bound past the sixth layer, which describes exploding gradients rather than the vanishing-gradient scenario in this setup.

Answer: A. This chain multiplies six 0.25 factors, giving 0.25⁶ = 1/4096 ≈ 2.44×10⁻⁴ as the tightest bound, so the first layer's gradient can be over 4000 times smaller than the output layer's, meaning early layers effectively stop learning while later layers keep updating normally.

ExplanationBackpropagation sends the output-layer gradient backward through every hidden layer via the chain rule, and passing through hidden layer k multiplies the accumulated gradient by a factor whose operator norm is bounded by ‖Wₖ‖ · max_z σ'(z). Here ‖Wₖ‖ = 1 for every layer, and σ'(z) = σ(z)(1 − σ(z)) is maximized where σ(z) = 1/2, giving σ'(0) = (1/2)(1/2) = 0.25 — not 0.5, since 0.5 is the value of σ itself at z = 0, not its derivative. So each of the 6 hidden layers contributes at most a 0.25 attenuation, and because these factors compose multiplicatively (not additively) through the chain rule, the overall bound is 0.25⁶ = (1/4)⁶ = 1/4096 ≈ 2.44×10⁻⁴. Since 4096 is just over 4000, the gradient available to update the first hidden layer's weights can be more than 4000 times weaker than the gradient at the output layer. In practice this means the first layer's weights barely move on each update while the later layers race ahead — the defining symptom of the vanishing gradient problem. It's also why ReLU-family activations (whose derivative is exactly 1, not capped at 0.25, for all positive inputs) and residual/skip connections replaced sigmoid in deep architectures: they remove this repeated 0.25-per-layer attenuation from the backward pass.

Question 175 · Residual Connections: Skip and Learn · hard

A residual network stacks three identical residual blocks, each computing y = x + F(x), where F is the learned transformation inside the block. At the current weights, the local derivative dF/dx = 0.1 at every block's operating point. Using the chain rule, what is dy₃/dx₀ — the gradient of the third block's output with respect to the first block's input — and how does it compare to an equivalent plain (non-residual) network with the same per-layer dF/dx?

  1. The residual network's gradient is dy₃/dx₀ = 1.1³ = 1.331, versus 0.1³ = 0.001 for an equivalent plain network — roughly 1,331 times larger — because each block's local backward derivative is (1 + dF/dx), so the identity term prevents the product from decaying geometrically with depth.
  2. Both networks yield dy₃/dx₀ = 0.1³ = 0.001, since the skip connection only creates an alternate path in the forward pass and does not alter how gradients are computed during backpropagation.
  3. Using the linear approximation dy₃/dx₀ ≈ 1 + 3(0.1) = 1.3, the residual network's gradient grows in proportion to depth rather than through exact multiplicative compounding of the (1 + dF/dx) terms across blocks.
  4. Stacking three residual blocks makes the gradients add rather than multiply, giving dy₃/dx₀ = 3 × (1 + 0.1) = 3.3, since residual connections replace the multiplicative chain rule with a purely additive rule across all layers.

Answer: A. The residual network's gradient is dy₃/dx₀ = 1.1³ = 1.331, versus 0.1³ = 0.001 for an equivalent plain network — roughly 1,331 times larger — because each block's local backward derivative is (1 + dF/dx), so the identity term prevents the product from decaying geometrically with depth.

ExplanationEach residual block computes y = x + F(x). Differentiating with respect to x gives ∂y/∂x = ∂x/∂x + ∂F/∂x = 1 + ∂F/∂x — the identity shortcut contributes exactly 1, and the learned branch contributes ∂F/∂x separately, added within the same block. With ∂F/∂x = 0.1 at each of the three blocks, the local Jacobian per block is 1 + 0.1 = 1.1. Backpropagation across stacked blocks still follows the ordinary chain rule, which multiplies local Jacobians layer by layer, so dy₃/dx₀ = 1.1 × 1.1 × 1.1 = 1.331. In a plain network with no skip connection, each block's output is just F(x), so its local gradient is ∂F/∂x = 0.1 alone, and the compounded gradient over three layers is 0.1 × 0.1 × 0.1 = 0.001. The ratio 1.331 / 0.001 = 1331 is the whole point of the architecture: even when the learned function contributes only a small derivative, the constant "+1" keeps every factor near 1 instead of near 0, so the product across many layers stays bounded away from zero rather than shrinking exponentially with depth. This is the precise mathematical reason ResNet-style architectures (He et al., 2015) could be trained with far more layers than plain feedforward stacks. The three incorrect readings each misapply the calculus in a specific way. Claiming the skip connection leaves backpropagation unchanged (giving 0.001 for both networks) forgets that differentiating x with respect to itself contributes exactly 1 to the local Jacobian — the shortcut affects the backward pass just as much as the forward pass. Using 1 + 3(0.1) = 1.3 applies only the first-order (binomial) term of the expansion (1+0.1)³ = 1 + 3(0.1) + 3(0.1)² + (0.1)³ and drops the higher-order pieces, undercounting the true multiplicative compounding. And treating three blocks as additive, 3 × 1.1 = 3.3, confuses the additive relationship within a single block (identity term plus branch term) with the relationship across blocks, which remains governed by multiplication under the chain rule.

Question 176 · Positional Encoding: Teaching Order · hard

A Transformer built for Hindi–English translation uses the standard sinusoidal positional encoding with model dimension d_model = 4. For dimension pair i, the angular frequency is ω_i = 1/10000^(2i/d_model), with PE(pos, 2i) = sin(pos·ω_i) and PE(pos, 2i+1) = cos(pos·ω_i). Take dimension pair i = 1, so ω_1 = 1/10000^(2·1/4) = 1/100 = 0.01, and a fixed relative offset k = 100 tokens. Using the angle-addition formulas for sine and cosine, PE(pos+k, 2) and PE(pos+k, 3) can be written as M·[PE(pos,2), PE(pos,3)]ᵀ for some 2×2 matrix M that depends only on k, not on pos. To four decimal places, what is M, and why does that pos-independence matter for self-attention?

  1. M = [[0.5403, 0.8415], [-0.8415, 0.5403]] — a rotation by angle kω_1 = 1 radian that is identical for every position pos; since this map is linear and pos-independent, a self-attention layer can implement a fixed relative-offset pattern (e.g. 'attend 100 tokens back') with the same linear operation no matter where in the sentence that offset occurs.
  2. M = [[0.5403, -0.8415], [0.8415, 0.5403]] — a rotation by angle kω_1 = 1 radian that is identical for every pos, letting attention recover relative offsets purely through this pos-free linear map.
  3. M = [[cos(pos·0.01), sin(pos·0.01)], [-sin(pos·0.01), cos(pos·0.01)]] — the rotation angle must include the absolute position pos as well as the offset k, since PE(pos+k) genuinely mixes both quantities and no pos-free linear map can express it.
  4. M = [[1.3818, 0], [0, 1.3818]] — a uniform scaling by sec(1) that stretches both coordinates equally, reflecting that a 100-token relative offset amplifies the magnitude of the positional encoding vector by that same factor.

Answer: A. M = [[0.5403, 0.8415], [-0.8415, 0.5403]] — a rotation by angle kω_1 = 1 radian that is identical for every position pos; since this map is linear and pos-independent, a self-attention layer can implement a fixed relative-offset pattern (e.g. 'attend 100 tokens back') with the same linear operation no matter where in the sentence that offset occurs.

ExplanationWrite A = pos·ω_1 and B = k·ω_1, so PE(pos,2) = sin A, PE(pos,3) = cos A. Using the angle-addition identities, PE(pos+k,2) = sin(A+B) = sin A cos B + cos A sin B = PE(pos,2)·cos B + PE(pos,3)·sin B, and PE(pos+k,3) = cos(A+B) = cos A cos B − sin A sin B = PE(pos,3)·cos B − PE(pos,2)·sin B. Both new coordinates are linear in the old ones with coefficients built only from B = kω_1 — the pos-dependent angle A has completely cancelled out. Substituting ω_1 = 1/10000^(2·1/4) = 0.01 and k = 100 gives B = kω_1 = 1 radian, so cos B = 0.5403 and sin B = 0.8415 to four decimal places, giving exactly M = [[0.5403, 0.8415], [−0.8415, 0.5403]]. This matrix is orthogonal with determinant cos²B + sin²B = 1, confirming it is a genuine rotation that preserves vector length — which is precisely why a 100-token shift cannot show up as a magnitude change (ruling out the uniform-scaling claim, whose sec(1) ≈ 1.3818 factor would violate sin²+cos²=1). Because M depends only on the offset k and never on the absolute position pos, the same fixed linear transformation converts "the encoding at position pos" into "the encoding at position pos+100" everywhere in a sentence, whether that sentence starts at token 3 or token 3000; a linear attention head can therefore learn one weight pattern for "look back 100 tokens" that works uniformly across the whole sequence, without needing pos as an explicit input. The sign-flipped matrix swaps which product gets the minus sign, which actually corresponds to expanding cos(A−B) and sin(A−B) instead of cos(A+B) and sin(A+B) — the wrong angle-addition case for computing pos+k from pos.

Question 177 · Word Embeddings: Meaning in Vectors · hard

A toy word-embedding model represents six words as vectors in ℝ³ (each coordinate is a latent semantic dimension learned during training, not directly interpretable on its own): France = (4, 0, 2), Paris = (5, 3, 2), India = (1, 0, 5), Delhi = (2, 3, 6), Mumbai = (1, 3, 4), Bangalore = (6, 6, 10) To solve the analogy "France is to Paris as India is to ___" using vector arithmetic, you compute the offset vector v = Paris − France + India, then find which candidate word's embedding has the highest cosine similarity to v. (Cosine similarity — not Euclidean distance and not the raw, unnormalised dot product — is the standard metric here, because it measures only the angle between two vectors and ignores differences in vector length, which in real embedding models often arise from how frequently a word appears in the training corpus.) Which of the following correctly identifies the analogy's answer and the reasoning behind it?

  1. Delhi is the correct completion: the offset vector v = Paris − France + India = (2, 3, 5) has cosine similarity ≈0.996 with Delhi's embedding (2, 3, 6), higher than its similarity to any other candidate, so Delhi's direction in the embedding space most closely matches v.
  2. Bangalore is the correct completion: its raw dot product with v is 80, far exceeding Delhi's dot product of 43, so Bangalore's embedding is the most similar to the analogy vector.
  3. Mumbai is the correct completion: as India's most populous and economically dominant city, its embedding should lie closest to any analogy vector built from India's coordinates, regardless of the exact cosine values computed for the other candidates.
  4. India itself is the correct completion: since India's vector is added last when forming v = Paris − France + India, the resulting vector should be dominated by India's own embedding, making India the nearest match to v.

Answer: A. Delhi is the correct completion: the offset vector v = Paris − France + India = (2, 3, 5) has cosine similarity ≈0.996 with Delhi's embedding (2, 3, 6), higher than its similarity to any other candidate, so Delhi's direction in the embedding space most closely matches v.

ExplanationThe offset vector is v = Paris − France + India = (5,3,2) − (4,0,2) + (1,0,5) = (2, 3, 5), with magnitude |v| = √(2²+3²+5²) = √38 ≈ 6.164. Computing cosine similarity — dot product divided by the product of the two vectors' magnitudes — against each candidate: For Delhi (2,3,6): dot product = (2)(2)+(3)(3)+(5)(6) = 4+9+30 = 43, |Delhi| = √(4+9+36) = √49 = 7, so cosine similarity = 43/(6.164×7) ≈ 0.996. For Bangalore (6,6,10): dot product = 12+18+50 = 80 — much larger in absolute terms than Delhi's 43 — but |Bangalore| = √(36+36+100) = √172 ≈ 13.115, giving cosine similarity = 80/(6.164×13.115) ≈ 0.989. Bangalore's vector is simply longer, which inflates the raw dot product without making it more aligned in direction with v; this is precisely why unnormalised dot product is the wrong metric to compare candidates of different magnitude. For Mumbai (1,3,4): dot product = 2+9+20 = 31, |Mumbai| = √26 ≈ 5.099, cosine similarity = 31/(6.164×5.099) ≈ 0.986. For India (1,0,5) itself: dot product = 2+0+25 = 27, |India| = √26 ≈ 5.099, cosine similarity = 27/(6.164×5.099) ≈ 0.859 — the lowest of the four. This confirms that subtracting France's vector and adding India's shifts the result away from India's own position and toward a genuinely new point lying in the "capital-of" direction, rather than collapsing back onto India. Ranked by cosine similarity: Delhi (≈0.996) > Bangalore (≈0.989) > Mumbai (≈0.986) > India (≈0.859). Delhi is the unique best match, correctly completing the analogy. This is exactly why embedding models use cosine similarity rather than raw dot-product magnitude or real-world prominence as the similarity metric: it isolates the angle between vectors — the learned relational direction — from magnitude effects caused by a word's frequency or corpus statistics.

Question 178 · Semantic Similarity: Understanding Meaning · hard

A semantic search engine built for a CBSE doubt-solving app (matching a student's typed question to the closest stored NCERT solution) represents every sentence as a unit-normalized embedding vector, so ||u|| = ||v|| = 1 and cosine similarity is simply the dot product u·v. For two such vectors with cosine similarity cos θ = u·v = 0.6, what is the exact Euclidean distance ||u − v|| between them?

  1. ≈0.89, derived from ||u−v||² = ||u||² + ||v||² − 2(u·v) = 2 − 2cosθ = 2 − 1.2 = 0.8, so ||u−v|| = √0.8.
  2. Exactly 0.4, since Euclidean distance between unit vectors equals the cosine distance 1 − cosθ.
  3. 0.8, because ||u−v||² = ||u||² + ||v||² − 2(u·v) already gives the Euclidean distance without a further square root.
  4. ≈1.79, using ||u−v||² = ||u||² + ||v||² + 2(u·v) = 2 + 2cosθ = 3.2, so ||u−v|| = √3.2.

Answer: A. ≈0.89, derived from ||u−v||² = ||u||² + ||v||² − 2(u·v) = 2 − 2cosθ = 2 − 1.2 = 0.8, so ||u−v|| = √0.8.

ExplanationFor unit vectors, expand the squared Euclidean distance using the dot product: ||u−v||² = (u−v)·(u−v) = u·u − 2u·v + v·v = ||u||² + ||v||² − 2u·v. Since the vectors are normalized, ||u||² = ||v||² = 1, so this reduces to ||u−v||² = 2 − 2cosθ = 2 − 2(0.6) = 0.8. Taking the square root gives ||u−v|| = √0.8 ≈ 0.89. This identity is exactly why nearest-neighbour search libraries like FAISS can index normalized sentence embeddings using either cosine similarity or squared L2 distance and get identical rankings — the two are a linear transform of each other in cosθ, not the same number. The value 0.4 is the cosine distance (1 − cosθ), a separate, commonly used dissimilarity score that happens to share the same input but is not a length measured in Euclidean space. Stopping at 0.8 reports the squared distance, having skipped the final square root. And computing 2 + 2cosθ instead of 2 − 2cosθ (giving √3.2 ≈ 1.79) flips the sign in the dot-product expansion, which is effectively the distance between u and −v rather than between u and v.

Question 179 · POS Tagging: Understanding Grammar · hard

A voice-assistant app used by Indian students to book train and flight tickets tags each word with its part of speech before parsing the command, using a two-tag Hidden Markov Model with tags {Noun (N), Verb (V)}. The model's parameters are: initial probabilities P(N) = 0.6, P(V) = 0.4; emission probabilities P('book'|N) = 0.3, P('book'|V) = 0.2, P('flights'|N) = 0.4, P('flights'|V) = 0.05; and transition probabilities P(N→N) = 0.3, P(N→V) = 0.7, P(V→N) = 0.8, P(V→V) = 0.2. Applying the Viterbi algorithm to the two-word command "Book flights," which tag sequence has the highest joint probability, and what is that probability?

  1. Verb then Noun — joint probability 0.08 × 0.8 × 0.4 = 0.0256, the highest of all four possible tag paths through the trellis.
  2. Noun then Noun — joint probability 0.18 × 0.3 × 0.4 = 0.0216, obtained by picking whichever tag is individually most likely at each word position.
  3. Noun then Verb — joint probability 0.18 × 0.7 × 0.05 = 0.0063, following from the assumption that a lower initial probability at position one forces a tag switch at position two.
  4. Verb then Verb — joint probability 0.08 × 0.2 × 0.05 = 0.0008, on the reasoning that an imperative verb at the start locks every later word into the verb tag.

Answer: A. Verb then Noun — joint probability 0.08 × 0.8 × 0.4 = 0.0256, the highest of all four possible tag paths through the trellis.

ExplanationSince there are only two tags and two words, all four possible tag sequences can be scored directly, and the one with the largest joint probability is exactly what the Viterbi algorithm returns. For Noun→Noun: 0.6 × 0.3 × 0.3 × 0.4 = 0.0216. For Noun→Verb: 0.6 × 0.3 × 0.7 × 0.05 = 0.0063. For Verb→Verb: 0.4 × 0.2 × 0.2 × 0.05 = 0.0008. For Verb→Noun: 0.4 × 0.2 × 0.8 × 0.4 = 0.0256, the largest of the four. This is exactly what the Viterbi recursion produces at each step: at word one, δ₁(N) = 0.6 × 0.3 = 0.18 and δ₁(V) = 0.4 × 0.2 = 0.08, so a purely local, greedy tagger would commit to Noun for "book" because 0.18 exceeds 0.08 — this is the trap behind tagging the whole phrase Noun-Noun. But Viterbi never commits early; it carries both partial scores forward, and at word two it computes δ₂(N) = max(0.18 × 0.3, 0.08 × 0.8) × 0.4 = max(0.054, 0.064) × 0.4 = 0.0256, with the maximum arriving via the Verb branch, not the Noun branch. The strong transition probability P(V→N) = 0.8 — verbs are very often followed by their noun object — outweighs "book" being locally more likely as a noun in isolation, so the globally optimal path tags "book" as a Verb and "flights" as the Noun it acts on, which also matches how the phrase functions as a command (an imperative followed by its object), not as two consecutive nouns or two consecutive verbs.

Question 180 · Dependency Parsing: Grammar Structure · hard

An arc-standard transition-based dependency parser processes the 10-word sentence "ISRO successfully launched the Chandrayaan mission from Sriharikota today morning" one word at a time, using a stack (initialised to contain only a dummy ROOT node) and a buffer (initialised to contain all 10 words in order). At each step the parser applies exactly one of three transitions — SHIFT (move the front buffer word onto the stack), LEFT-ARC (attach the second-from-top stack word as a dependent of the top stack word, then pop the second-from-top word), or RIGHT-ARC (attach the top stack word as a dependent of the second-from-top stack word, then pop the top word) — until the stack contains only ROOT and the buffer is empty. Assuming the sentence's dependency structure is projective and the parser makes no mistakes, how many total transitions does it execute to produce the complete parse?

  1. 19 transitions — 10 SHIFT operations plus only 9 ARC operations, since the sentence's syntactic head word (the one whose head ends up being ROOT) is assumed to need no explicit ARC transition of its own.
  2. 20 transitions — 10 SHIFT operations to move every word onto the stack exactly once, plus 10 LEFT-ARC/RIGHT-ARC operations to assign each of the 10 words its head (including the one word attached directly to ROOT) and pop it off the stack.
  3. 30 transitions — treating each of the 10 words as requiring three separate transitions (shift, arc, and an additional reduce step), which imports the extra REDUCE transition from the arc-eager parsing system into arc-standard parsing.
  4. 21 transitions — 11 SHIFT-type operations plus 10 ARC operations, counting the initial placement of the dummy ROOT node onto the stack as if it were itself a parser transition rather than part of the starting configuration.

Answer: B. 20 transitions — 10 SHIFT operations to move every word onto the stack exactly once, plus 10 LEFT-ARC/RIGHT-ARC operations to assign each of the 10 words its head (including the one word attached directly to ROOT) and pop it off the stack.

ExplanationEvery one of the 10 words must move from the buffer onto the stack before it can take part in any arc, and SHIFT always removes exactly the front-most buffer word — so each word is shifted exactly once. This pins the SHIFT count at 10, independent of the sentence's tree shape. Separately, every one of the 10 words must end up with exactly one head in the final dependency tree — this includes the sentence's own syntactic head word, whose head is the dummy ROOT node. LEFT-ARC and RIGHT-ARC are the only transitions that assign a head and simultaneously pop a word off the stack; each ARC transition finalises the head of exactly one word. Since all 10 words (including the one attached to ROOT) need a head assigned, exactly 10 ARC transitions occur. ROOT itself is never a dependent of anything, so it is never popped — it sits alone on the stack when the buffer empties, giving the terminal configuration stack = [ROOT], buffer = []. Total transitions = 10 SHIFT + 10 ARC = 20. This 2N rule (N = sentence length) can be checked on a 1-word sentence: stack = [ROOT], buffer = [word]. SHIFT puts the word on the stack (1 transition); RIGHT-ARC attaches it to ROOT and pops it (1 transition) — 2 transitions total for N = 1, matching 2N. The SHIFT count and ARC count are each pinned to N independently of the tree's actual shape: SHIFT count because every word enters the stack exactly once, ARC count because every word exits the stack exactly once, via having its head assigned. The 19-transition option undercounts by treating the sentence's syntactic head as needing no arc — but its arc to ROOT (a RIGHT-ARC) is a real transition, not a free pass. The 21-transition option confuses the parser's initial configuration (ROOT already sitting on the stack before any transition runs) with an actual parsing action. The 30-transition option imports the REDUCE transition from the arc-eager transition system, which arc-standard parsing — restricted to SHIFT, LEFT-ARC, and RIGHT-ARC only — never uses.
← Set 8Set 10 →