MauryaHub PYQ Practice

Algorithms for Data Science · End Term · May 2026 · AN

Algorithms for Data Science · End Term · May 2026 AN

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

17 / 18 published solutions

Question 2 MCQ · 0.0 marks

**(BONUS Question)** Consider a non-zero data-matrix
Source diagram or notation
of shape
Source diagram or notation
that is invertible. Which of the following is true?
Source diagram or notation
denotes the spectral norm.
6406537408582.Source diagram or notation
6406537408583.Source diagram or notation
6406537408584.Source diagram or notation
6406537408585.Source diagram or notation

Published solution

**1. Use a norm identity:** Since A is invertible, \(AA^{-1}=I\). The spectral norm is submultiplicative, so \(\|I\|_2\le\|A\|_2\|A^{-1}\|_2\). **2. Rearrange:** \(\|I\|_2=1\) and A is nonzero, hence \[\|A^{-1}\|_2\ge\frac1{\|A\|_2}.\] **3. Explain possible strictness:** The two norms involve the reciprocal of the smallest singular value and the largest singular value. They need not be equal unless all singular values coincide. For diag(2,1), inverse norm is 1 while reciprocal original norm is 1/2. **Answer: A.** A: **Correct:** This follows from submultiplicativity and AA inverse equal to identity. B: **Incorrect:** The reverse bound fails for diag(2,1). C: **Incorrect:** Equality holds for special matrices, not every invertible matrix. D: **Incorrect:** A=2I has inverse norm 1/2 and original norm 2.

Report a correction for Q2

Question 3 MCQ · 2.0 marks

Let
Source diagram or notation
be a dataset sampled from a joint distribution
Source diagram or notation
over features and labels for a binary classification problem. Consider two finite hypothesis classes
Source diagram or notation
and
Source diagram or notation
such that
Source diagram or notation
. It is given that if
Source diagram or notation
, then
Source diagram or notation
with a high probability for classifiers drawn from
Source diagram or notation
. Which of the following is most likely to be true?
6406537408565.
If
Source diagram or notation
, then
Source diagram or notation
with a high probability for classifiers drawn from
Source diagram or notation
6406537408566.
There exists
Source diagram or notation
such that, if
Source diagram or notation
, then
Source diagram or notation
with a high probability for classifiers drawn from
Source diagram or notation
6406537408567.
The hypothesis class
Source diagram or notation
is too big for any guarantees to hold on the generalization error.

Published solution

**1. State a finite-class guarantee:** For independent samples and binary loss, a typical uniform-convergence bound is \[P\!\left(\sup_{h\in\mathcal H}|er_S(h)-er_D(h)|\ge\epsilon\right)\le2|\mathcal H|e^{-2n\epsilon^2}.\] **2. Compare class sizes:** The second class has 10,000 times as many hypotheses. The union-bound factor is larger, so the old sample size is not automatically enough for the same accuracy/confidence. **3. Increase sample size:** Both classes are finite, so a sufficiently large sample still gives a guarantee. One may choose \(n_2\ge n_1\); the sufficient increase in this bound is proportional to \(\ln(10{,}000)/(2\epsilon^2)\), not necessarily a 10,000-fold sample increase. **Answer: B.** A: **Incorrect:** The original sample guarantee need not transfer unchanged to a larger class. B: **Correct:** A sufficiently large sample exists for the larger finite class as well. C: **Incorrect:** Every fixed finite class admits finite-sample uniform-convergence guarantees.

Report a correction for Q3

Question 4 MCQ · 2.0 marks

If we want a strong privacy guarantee in the randomized response mechanism with privacy parameter
Source diagram or notation
, which of the following is a good course of action?
6406537408568.
Increase
Source diagram or notation
6406537408569.
Decrease
Source diagram or notation
6406537408570.
Keep
Source diagram or notation
constant
6406537408571.
The privacy guarantee is independent of
Source diagram or notation

Published solution

**1. Read the privacy parameter:** Epsilon-differential privacy bounds the likelihood ratio of the same output under neighboring inputs by \(e^\varepsilon\). **2. Interpret smaller epsilon:** Decreasing epsilon moves this bound toward one, making outputs harder to distinguish between different private inputs. **3. Select the action:** Reduce epsilon for stronger privacy. This generally requires more randomization and can reduce statistical utility at a fixed sample size. **Answer: B.** A: **Incorrect:** Increasing epsilon allows a larger distinguishability bound and weakens privacy. B: **Correct:** A smaller epsilon gives the stronger guarantee. C: **Incorrect:** Keeping it unchanged does not strengthen the existing guarantee. D: **Incorrect:** Epsilon directly controls the differential-privacy bound.

Report a correction for Q4

Question 5 MCQ · 2.0 marks

In the context of a binary classification problem with an underlying joint distribution
Source diagram or notation
over features and labels, let
Source diagram or notation
be a dataset of
Source diagram or notation
points. If
Source diagram or notation
denotes the Bayes' error and
Source diagram or notation
denotes the train error of some classifier
Source diagram or notation
, and
Source diagram or notation
is the set of all binary classifiers, which of the following is true?
6406537408572.Source diagram or notation
for all
Source diagram or notation
6406537408573.Source diagram or notation
for all
Source diagram or notation
6406537408574.
There is at least one classifier
Source diagram or notation
such that
Source diagram or notation
6406537408575.
There is no classifier
Source diagram or notation
such that
Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q5

Question 6 MCQ · 2.0 marks

Is the given statement true or false? “Given a desired utility and privacy, the number of users who need to be surveyed is quadratically smaller in the case of the randomized response mechanism than for the Laplace mechanism.”
6406537408576.
True
6406537408577.
False

Published solution

**1. Distinguish privacy settings:** Randomized response randomizes each user’s report before the curator sees it, giving local privacy. The central Laplace mechanism lets a trusted curator compute the true aggregate before adding noise. **2. Compare estimation noise:** For a binary mean, central Laplace noise scales as \(1/(n\varepsilon)\). Standard locally private randomized-response estimation has noise of order \(1/(\varepsilon\sqrt n)\) in the high-privacy regime, alongside ordinary sampling variation. **3. Judge the direction:** Local randomized response generally needs more, not quadratically fewer, users for comparable accuracy/privacy. Exact sample bounds also depend on confidence and the error criterion, so the stated blanket advantage is false. **Answer: B — Selected: False.** A: **Incorrect:** The asserted randomized-response sample advantage has the wrong direction. B: **Correct:** Local reporting noise generally makes randomized response less sample-efficient than the trusted-curator mechanism.

Report a correction for Q6

Question 7 MCQ · 2.0 marks

Which of the following represents the time complexity of transforming
Source diagram or notation
data-points in
Source diagram or notation
to
Source diagram or notation
using the linear, approximate isometry provided by the JL lemma? Assume that the approximate isometry is already given to you.
6406537408578.Source diagram or notation
6406537408579.Source diagram or notation
6406537408580.Source diagram or notation
6406537408581.Source diagram or notation

Published solution

**1. Represent the linear map:** A dense JL map from dimension d to k is a k-by-d matrix, already supplied by the question. **2. Count one transformed point:** Computing k outputs, each a dot product of length d, takes order dk arithmetic operations. **3. Transform n points:** Total work is \(O(ndk)\) using ordinary dense multiplication. Generating the map is excluded. Specialized sparse/structured projections could have different costs but are not specified here. **Answer: B.** A: **Incorrect:** nk omits the d-term work in each output dot product. B: **Correct:** n points times k coordinates times d products gives O(ndk). C: **Incorrect:** A second factor of k is unnecessary. D: **Incorrect:** Dividing by k does not describe dense matrix-vector multiplication.

Report a correction for Q7

Question 8 MSQ · 2.0 marks

Let
Source diagram or notation
be an
Source diagram or notation
-spectral sparsification of
Source diagram or notation
.
Source diagram or notation
is the set of vertices.
Source diagram or notation
Source diagram or notation
and
Source diagram or notation
are the edge sets of
Source diagram or notation
and
Source diagram or notation
respectively. For
Source diagram or notation
, , where
Source diagram or notation
is the probability of retaining the edge
Source diagram or notation
in
Source diagram or notation
. If
Source diagram or notation
and
Source diagram or notation
denote the Laplacians of the graphs
Source diagram or notation
and
Source diagram or notation
respectively, which of the following is/are true for all
Source diagram or notation
?
6406537408586.Source diagram or notation
6406537408587.Source diagram or notation
6406537408588.Source diagram or notation
6406537408589.Source diagram or notation

Published solution

**1. Express each sampled edge’s contribution:** Let its indicator be \(I_e\), inclusion probability \(p_e>0\), and retained weight \(w_e/p_e\). Its Laplacian contribution is \(I_e(w_e/p_e)b_eb_e^{\mathsf T}\). **2. Take expectation:** Since \(E[I_e]=p_e\), the expected contribution is \(w_eb_eb_e^{\mathsf T}\). Summing edges gives \(E[L_H]=L_G\), hence \(E[x^{\mathsf T}L_Hx]=x^{\mathsf T}L_Gx\) for each fixed x under this sampling process. **3. Compare edge sets:** H retains/reweights edges of G, so \(F\subseteq E\). Unbiasedness does not say a particular random H equals G exactly. **Answer: A, C.** A: **Correct:** Inverse-probability reweighting gives the stated unbiased quadratic-form identity. B: **Incorrect:** The deterministic G side cannot equal every realization of a randomly sampled H. C: **Correct:** Sampling retains a subset of the original edges. D: **Incorrect:** H need not retain every original edge, so E need not be contained in F.

Report a correction for Q8

Question 9 MSQ · 2.0 marks

Which of the following hypothesis classes have infinite VC dimension? The feature space is
Source diagram or notation
. All classifiers mentioned in the options are from
Source diagram or notation
to
Source diagram or notation
.
6406537408594.
The set of all decision trees classifiers, where each tree can be trained to arbitrary depth.
6406537408595.
The set of all functions from
Source diagram or notation
to
Source diagram or notation
.
6406537408596.
The set of all linear classifiers.
6406537408597.
The set of all classifiers whose decision boundary is a circle centered at the origin.

Published solution

**1. Recall shattering:** Infinite VC dimension means arbitrarily large finite sets can receive every binary labeling using members of the class. **2. Identify unrestricted capacity:** Arbitrarily deep decision trees can isolate any finite collection of distinct points; all binary functions can directly specify any labels. Their VC dimensions are infinite. **3. Compare restricted boundaries:** Linear separators in the plane have finite VC dimension 3. Origin-centered circular boundaries give a constrained radial-threshold class with finite VC dimension. Thus only A and B are infinite. **Answer: A, B.** A: **Correct:** Unbounded tree depth allows arbitrarily large finite samples to be shattered. B: **Correct:** The class of all functions realizes every finite labeling. C: **Incorrect:** Planar linear separators have finite capacity. D: **Incorrect:** A radius-controlled circular family has finite capacity.

Report a correction for Q9

Question 10 MSQ · 3.0 marks

Let
Source diagram or notation
be a finite hypothesis class in a binary classification problem and let
Source diagram or notation
be a dataset of
Source diagram or notation
points sampled from the underlying joint distribution
Source diagram or notation
. Let
Source diagram or notation
be a hypothesis trained deterministically on
Source diagram or notation
. Consider the following events for some
Source diagram or notation
Source diagram or notation
Which of the following is/are true?
6406537408590.Source diagram or notation
6406537408591.Source diagram or notation
6406537408592.Source diagram or notation
6406537408593.Source diagram or notation

Published solution

**1. Compare the events:** E1 says the classifier selected by the training algorithm has an error gap at least epsilon. E2 says at least one classifier in the whole hypothesis class has such a gap. **2. Use membership:** The trained classifier belongs to that class. Therefore whenever E1 occurs, its classifier also witnesses E2, giving \(E_1\subseteq E_2\). **3. Take probabilities:** Event inclusion implies \(P(E_1)\le P(E_2)\). The reverse inclusion need not hold because a badly generalizing classifier may exist without being chosen. **Answer: A, C.** A: **Correct:** A bad selected classifier is also a bad member of the class. B: **Incorrect:** A bad classifier somewhere in the class need not be the trained one. C: **Correct:** Probability respects event inclusion. D: **Incorrect:** The reverse probability inequality is not guaranteed.

Report a correction for Q10

Question 11 MSQ · 1.0 marks

Which of the following pieces of information are indispensable if we need to apply the Markov inequality? Select all that apply.
6406537408598.
The non-negativity of the random variable.
6406537408599.
Availability of the variance of the random variable.
6406537408600.
Availability of the third moment of the random variable.
6406537408601.
Availability of the expected value of the random variable.

Published solution

**1. State Markov’s inequality:** For a nonnegative random variable X and a>0, \[P(X\ge a)\le\frac{E[X]}a.\] **2. Explain the conditions:** Nonnegativity lets a probability be bounded using the contribution of large values to the expectation. A finite known expectation, or a usable upper bound on it, supplies the numerical bound. **3. Distinguish other moments:** Variance and the third moment are unnecessary for this direct inequality. They belong to other tail bounds or applications to transformed variables. **Answer: A, D — Selected: The non-negativity of the random variable.; Availability of the expected value of the random variable.** A: **Correct:** Nonnegativity is a condition of this direct Markov bound. B: **Incorrect:** Variance is not required by the formula. C: **Incorrect:** A third moment is not required. D: **Correct:** The expectation, or a bound on it, is what appears in the bound.

Report a correction for Q11

Question 12 NAT · 3.0 marks

Consider a binary classification problem with features in
Source diagram or notation
and labels in
Source diagram or notation
. Let
Source diagram or notation
be the hypothesis class that consists of all linear classifiers that pass through the origin having the following property: the slope of the decision boundary of the classifier, denoted by
Source diagram or notation
, satisfies
Source diagram or notation
. Find the VC-dimension of
Source diagram or notation
.

Published solution

**1. Count distinct decision boundaries:** The line passes through the origin and has slope m with |m|=1, so its boundary is either y=x or y=-x. Each line permits two label orientations, giving four distinct half-plane classifiers away from boundary conventions. **2. Shatter two points:** Choose (1,0) and (0,1). The two orientations of y=x produce opposite labels on these points; the two orientations of y=-x produce the two equal-label patterns. All four labelings occur. **3. Bound larger sets:** Three points require eight labelings, but this class has at most four distinct classifiers. It cannot shatter three points, so VC dimension is 2. This assumes the usual consistent boundary-label convention. **Answer: 2.**

Report a correction for Q12

Question 13 NAT · 3.0 marks

Consider a binary classification problem with a single feature in
Source diagram or notation
and labels in
Source diagram or notation
. Let
Source diagram or notation
be a hypothesis class.
Source diagram or notation
is defined as:
Source diagram or notation
If
Source diagram or notation
has a sample compression scheme of size
Source diagram or notation
, find
Source diagram or notation
.

Published solution

**1. Identify the class:** A hypothesis labels the union of two intervals positive and all other real points negative. **2. Compress each positive block:** In a realizable sample, retain the leftmost and rightmost positive examples in each of the at most two positive blocks. Reconstruct the union of the two resulting closed intervals. No sample point with a negative label lies between the retained endpoints within a true positive block. **3. Count stored examples:** At most two endpoints per block times two blocks gives four retained examples. Thus the standard endpoint-based sample compression scheme has size k=4. Empty blocks require fewer retained points; the scheme’s size is its worst-case bound. **Answer: 4.**

Report a correction for Q13

Question 14 NAT · 3.0 marks

Students who have just received their board exam results are being surveyed about their performance. Each student has either passed or failed. The students have to reply with one of two answers to the surveyor: pass/fail. To guarantee privacy, the surveyor asks each student to follow the randomized mechanism given below: 1. Flip a fair coin. 2. If tails, respond truthfully. 3. If heads, then flip a fair coin again. Respond "pass" if heads and "fail" if tails. This randomized response mechanism is
Source diagram or notation
-differentially private, where
Source diagram or notation
. Enter the most appropriate integer
Source diagram or notation
.

Published solution

**1. Compute reporting probabilities:** A truthful report is used with probability 1/2. The other half uses a fair second coin. Thus a passed student reports pass with probability \(1/2+1/4=3/4\), while a failed student reports pass with probability 1/4. **2. Bound the likelihood ratio:** The largest ratio for the same report under the two possible true inputs is \((3/4)/(1/4)=3\). The fail report gives the symmetric ratio. **3. Find epsilon:** Differential privacy needs \(e^\varepsilon\ge3\), with tight parameter \(\varepsilon=\ln3\). Since the question writes \(\varepsilon=\log_e k\), the requested integer is k=3. **Answer: 3.**

Report a correction for Q14

Question 15 NAT · 2.0 marks

Let
Source diagram or notation
be a hash family that is
Source diagram or notation
-sensitive with
Source diagram or notation
. Let
Source diagram or notation
be two points such that
Source diagram or notation
. The probability that both these points are hashed to the same value by a hash function sampled from this family is at most
Source diagram or notation
. Enter the value of
Source diagram or notation
.

Published solution

**1. State the far-point LSH condition:** An \((r,c,p_1,p_2)\)-sensitive family has collision probability at most \(p_2\) when distance is at least cr. **2. Substitute:** Here r=1, c=3 and \(\|x-y\|\ge3=cr\), so the far-point condition applies. **3. Read the bound:** \(P[h(x)=h(y)]\le p_2=0.1\). This is a guaranteed upper bound rather than an assertion of exact equality. **Answer: 0.1.**

Report a correction for Q15

Question 16 MCQ · 3.0 marks

Consider a binary classification problem with labels in
Source diagram or notation
with a single feature that can take one of three values in the set
Source diagram or notation
. The underlying distribution,
Source diagram or notation
, over the feature-label space is given as follows: 1. the prior probability for choosing class-
Source diagram or notation
is given as:
Source diagram or notation
. 2. the class conditional values for the probability mass function are given for a few values of
Source diagram or notation
and
Source diagram or notation
: •
Source diagram or notation
,
Source diagram or notation
•
Source diagram or notation
,
Source diagram or notation
Based on the above data, answer the given subquestions.
Find the Bayes' classifier,
Source diagram or notation
.
6406537408606.Source diagram or notation
6406537408607.Source diagram or notation
6406537408608.Source diagram or notation
6406537408609.Source diagram or notation

Published solution

**1. Complete the distributions:** P(y=0)=0.3 and P(y=1)=0.7. At x=-1,0,1, class-one conditionals are (0.6,0.2,0.2); class-zero conditionals are (0.2,0.2,0.6). **2. Compute joint masses:** For class zero the masses are (0.06,0.06,0.18); for class one they are (0.42,0.14,0.14). **3. Choose the more probable class:** Predict one at -1 and 0, and zero at 1. This minimizes error separately at each feature value. **Answer: B.** A: **Incorrect:** It selects the opposite class at each of the three feature values. B: **Correct:** It predicts zero only at x=1, matching the joint-mass comparisons. C: **Incorrect:** Always-one fails at x=1 where class-zero mass is 0.18 versus 0.14. D: **Incorrect:** Always-zero fails at -1 and 0.

Report a correction for Q16

Question 17 NAT · 3.0 marks

Consider a binary classification problem with labels in
Source diagram or notation
with a single feature that can take one of three values in the set
Source diagram or notation
. The underlying distribution,
Source diagram or notation
, over the feature-label space is given as follows: 1. the prior probability for choosing class-
Source diagram or notation
is given as:
Source diagram or notation
. 2. the class conditional values for the probability mass function are given for a few values of
Source diagram or notation
and
Source diagram or notation
: •
Source diagram or notation
,
Source diagram or notation
•
Source diagram or notation
,
Source diagram or notation
Based on the above data, answer the given subquestions.
Compute the Bayes' error,
Source diagram or notation
. Enter your answer correct to two decimal places.

Published solution

**1. Find joint probabilities:** Multiplying the supplied conditionals by priors 0.3 and 0.7 gives class-zero masses (0.06,0.06,0.18) and class-one masses (0.42,0.14,0.14) at x=-1,0,1. **2. Select unavoidable errors:** The Bayes rule predicts the larger mass and misclassifies the smaller. The three smaller masses are 0.06,0.06 and 0.14. **3. Sum:** \[er_D^*=0.06+0.06+0.14=0.26.\] The two-decimal answer is 0.26. **Answer: 0.26.**

Report a correction for Q17

Question 18 NAT · 3.0 marks

Consider a binary classification problem with features in
Source diagram or notation
and labels in
Source diagram or notation
. Let
Source diagram or notation
be a hypothesis class.
Source diagram or notation
is defined as:
Source diagram or notation
A dataset
Source diagram or notation
that has
Source diagram or notation
points, where each point is a feature-label pair denoted as
Source diagram or notation
, is given below:
Source diagram or notation
Based on the above data, answer the given subquestions.
Find
Source diagram or notation
. Enter your answer correct to one decimal place.

Published solution

**1. Reduce the data to the tested feature:** The rule predicts one when \(z=x_1+x_3\ge a\). The five (z,label) pairs are (-2,1), (0,1), (0,1), (0,1), (2,0). **2. Check threshold regions:** If a≤-2, all predictions are one, so only the final negative example is wrong: one error. If -2<a≤0, the first positive and final negative are wrong: two errors. If 0<a≤2, all five are wrong. If a>2, the four positive examples are wrong. **3. Minimize:** The minimum is one error among five, giving \(er_S[h^{ERM}]=1/5=0.2\). **Answer: 0.2.**

Report a correction for Q18

Question 19 NAT · 2.0 marks

Consider a binary classification problem with features in
Source diagram or notation
and labels in
Source diagram or notation
. Let
Source diagram or notation
be a hypothesis class.
Source diagram or notation
is defined as:
Source diagram or notation
A dataset
Source diagram or notation
that has
Source diagram or notation
points, where each point is a feature-label pair denoted as
Source diagram or notation
, is given below:
Source diagram or notation
Based on the above data, answer the given subquestions.
Find the largest integer
Source diagram or notation
such that
Source diagram or notation
.

Published solution

**1. Compute the relevant scalar values:** The supplied sample has (x1+x3,label) pairs (-2,1), three copies of (0,1), and (2,0). **2. Identify empirical-risk minimizers:** To avoid misclassifying the positive at -2, the threshold must satisfy a≤-2. Such a threshold predicts one on all five sample inputs and makes one error, the minimum possible for this upward-threshold family. Higher thresholds make at least two errors. **3. Select the largest integer:** The minimizing region is \(( -\infty,-2]\), so its largest integer is -2. Inclusion of equality follows from the rule’s greater-than-or-equal sign. **Answer: -2.**

Report a correction for Q19