MauryaHub PYQ Practice

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

Algorithms for Data Science · End Term · May 2026 FN

← 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.

16 / 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.
6406537372654.Source diagram or notation
6406537372655.Source diagram or notation
6406537372656.Source diagram or notation
6406537372657.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

Is the following statement true or false? Using the uniform convergence theorem for finite hypothesis classes, one can conclude that the train error is a good proxy for the Bayes' error for very large datasets, for every finite hypothesis class.
6406537372642.
True
6406537372643.
False

Published solution

**1. State what uniform convergence controls:** For a finite hypothesis class and enough independent samples, empirical error is close to population error simultaneously for every classifier in the class. **2. Distinguish Bayes error:** Bayes error is the best possible population error over all measurable classifiers. A restricted finite class may not contain a classifier close to that optimum. **3. Give a counterexample:** A class containing only a constant-zero classifier can have large error on a perfectly predictable task. Its train and test errors converge to each other, while the Bayes error is zero. More data does not remove this approximation error. **Answer: B — Selected: False.** A: **Incorrect:** Uniform convergence does not guarantee that an arbitrary hypothesis class approximates the Bayes rule. B: **Correct:** It links empirical and population errors within the class, not necessarily Bayes error.

Report a correction for Q3

Question 4 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.
6406537372644.
True
6406537372645.
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 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?
6406537372646.Source diagram or notation
for all
Source diagram or notation
6406537372647.Source diagram or notation
for all
Source diagram or notation
6406537372648.
There is at least one classifier
Source diagram or notation
such that
Source diagram or notation
6406537372649.
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

Let
Source diagram or notation
be the Laplacian of a graph
Source diagram or notation
with non-negative edge weights. If
Source diagram or notation
and
Source diagram or notation
, which of the following is true?
6406537372650.Source diagram or notation
for all
Source diagram or notation
6406537372651.Source diagram or notation
for all
Source diagram or notation
6406537372652.Source diagram or notation
for all
Source diagram or notation
6406537372653.
There exists some
Source diagram or notation
such that
Source diagram or notation
and
Source diagram or notation

Published solution

**1. Expand the Laplacian quadratic form:** For an undirected graph with nonnegative weights, \[x^{\mathsf T}Lx=\sum_{\{u,v\}\in E}w_{uv}(x_u-x_v)^2.\] **2. Check signs:** Every weight and squared difference is nonnegative, so their sum is nonnegative for every real vector x. **3. Conclude:** L is positive semidefinite. Constant vectors give zero; graphs with a positive-weight edge also admit vectors giving a positive value. Negative values cannot occur. **Answer: A.** A: **Correct:** Every term in the quadratic form is nonnegative. B: **Incorrect:** The form is not universally nonpositive for a graph with a positive edge. C: **Incorrect:** It is zero on special vectors, not all vectors for a nontrivial graph. D: **Incorrect:** A negative quadratic-form value is impossible under these assumptions.

Report a correction for Q6

Question 7 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?
6406537372658.Source diagram or notation
6406537372659.Source diagram or notation
6406537372660.Source diagram or notation
6406537372661.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 Q7

Question 8 MSQ · 2.0 marks

Which of the following hypothesis classes have finite VC dimensions? The feature space is
Source diagram or notation
and all classifiers in the options are from
Source diagram or notation
to
Source diagram or notation
.
6406537372662.
The set of all decision trees classifiers, where each tree can be trained to arbitrary depth.
6406537372663.
The set of all functions from
Source diagram or notation
to
Source diagram or notation
.
6406537372664.
The set of all linear classifiers.
6406537372665.
The set of all classifiers whose decision boundary is a circle centered at the origin.

Published solution

**1. Define finite VC dimension:** A class has finite VC dimension if there is a fixed upper limit on how many arbitrary point labels it can realize simultaneously. **2. Identify unbounded classes:** Arbitrarily deep decision trees can isolate arbitrarily many distinct points. The set of all binary functions can assign arbitrary labels to any finite point set. Both have infinite VC dimension on the stated continuous feature space. **3. Identify constrained classes:** Affine linear separators in the plane have VC dimension 3. Origin-centered circles have only radius and a possible label orientation to vary, giving a finite-capacity radial threshold family. Thus C and D are finite. **Answer: C, D — Selected: The set of all linear classifiers.; The set of all classifiers whose decision boundary is a circle centered at the origin.** A: **Incorrect:** Unlimited tree depth permits unbounded shattering capacity. B: **Incorrect:** All functions can realize every labeling of any finite set. C: **Correct:** Planar affine halfspaces have finite VC dimension. D: **Correct:** Radius-based circular boundaries form a constrained finite-VC family.

Report a correction for Q8

Question 9 MSQ · 2.0 marks

Consider a survey of
Source diagram or notation
users of a product. The users respond to the survey by saying "Yes" (1) if they find the product useful and "No" (0) if they don't. The trusted curator of the survey uses the Laplace mechanism with the average function to ensure privacy even while he publishes a report on the usefulness of the product. Which of the following is/are true?
6406537372666.
The curator outputs the exact average value of the inputs he receives from the users.
6406537372667.
The curator outputs a noisy version of the average value of the inputs he receives from the users.
6406537372668.
The curator is given a randomized version of the users' data.
6406537372669.
The curator is given the users' data exactly without any randomization.

Published solution

**1. Identify the trusted-curator model:** Users send their original binary answers to the curator. This differs from locally randomized reporting. **2. Compute sensitivity:** Changing one binary answer changes the average by at most \(1/n\). **3. Privatize the released statistic:** The curator publishes \(\bar x+Z\), where \(Z\sim\operatorname{Laplace}(1/(n\varepsilon))\). The private output is noisy even though the curator’s input data are exact. **Answer: B, D — Selected: The curator outputs a noisy version of the average value of the inputs he receives from the users.; The curator is given the users' data exactly without any randomization.** A: **Incorrect:** Publishing the exact average alone is not the stated Laplace mechanism. B: **Correct:** Noise is added to the average before release. C: **Incorrect:** The stated trusted-curator mechanism does not randomize user data before collection. D: **Correct:** The curator receives the true inputs and protects the published aggregate.

Report a correction for Q9

Question 10 MSQ · 2.0 marks

Consider a dataset
Source diagram or notation
of
Source diagram or notation
data-points in
Source diagram or notation
. Given
Source diagram or notation
, let
Source diagram or notation
be a linear map from
Source diagram or notation
, a linear, approximate isometry as guaranteed by the JL lemma, with
Source diagram or notation
. Which of the following is/are true?
6406537372670.Source diagram or notation
6406537372671.Source diagram or notation
, for all
Source diagram or notation
and all
Source diagram or notation
6406537372672.Source diagram or notation
, for all
Source diagram or notation
6406537372673.Source diagram or notation
, for all
Source diagram or notation

A published solution is not available for this question yet.

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 Markov's inequality for a random variable? Select all that apply.
6406537372674.
The non-negativity of the random variable.
6406537372675.
Availability of the variance of the random variable.
6406537372676.
Availability of the third moment of the random variable.
6406537372677.
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 of classifiers from
Source diagram or notation
that predict
Source diagram or notation
on at most
Source diagram or notation
distinct points. Formally, let
Source diagram or notation
, where
Source diagram or notation
Find the VC dimension of
Source diagram or notation
.

Published solution

**1. Show five points can be shattered:** Choose any five distinct real inputs. For any desired labeling, put exactly the positively labeled inputs into S. Since \(|S|\le5\), the corresponding hypothesis realizes the labeling. **2. Show six cannot be shattered:** The all-positive labeling of six distinct inputs would require S to contain six points, violating the class definition. **3. Conclude:** The largest shattered size is exactly 5, so \(VCdim(\mathcal H)=5\). **Answer: 5.**

Report a correction for Q12

Question 13 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
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 least
Source diagram or notation
. Enter the value of
Source diagram or notation
.

Published solution

**1. Recall locality-sensitive hashing:** An \((r,c,p_1,p_2)\)-sensitive family has collision probability at least \(p_1\) for points within distance r, and at most \(p_2\) for points at least cr apart. **2. Match the near-point condition:** Here \((r,c,p_1,p_2)=(1,3,0.9,0.1)\) and \(\|x-y\|\le1=r\). **3. Read the guaranteed lower bound:** \(P[h(x)=h(y)]\ge p_1=0.9\). This is a bound, not necessarily the exact probability. **Answer: 0.9.**

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
.
6406537372682.Source diagram or notation
6406537372683.Source diagram or notation
6406537372684.Source diagram or notation
6406537372685.Source diagram or notation

Published solution

**1. Complete the conditionals:** The class priors are P(y=0)=0.6 and P(y=1)=0.4. At x=-1,0,1, class-zero conditional probabilities are 0.6,0.2,0.2; class-one probabilities are 0.2,0.2,0.6. **2. Compare joint class masses:** Multiply conditional probability by prior. The class-zero masses are (0.36,0.12,0.12); class-one masses are (0.08,0.08,0.24). **3. Choose the larger at each input:** Predict zero at -1 and 0, and one at 1. Bayes classification minimizes the probability of error pointwise; posterior normalization is unnecessary because the denominator is the same for both classes. **Answer: A.** A: **Correct:** It predicts one only at x=1, matching all three joint-mass comparisons. B: **Incorrect:** It reverses the required labels at every feature value. C: **Incorrect:** Always-one ignores the larger zero-class mass at -1 and 0. D: **Incorrect:** Always-zero is wrong at x=1, where one-class mass is larger.

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. Compute joint masses:** At x=-1,0,1, the class-zero joint probabilities are (0.36,0.12,0.12) and the class-one probabilities are (0.08,0.08,0.24), using priors 0.6 and 0.4 and the supplied conditionals. **2. Identify unavoidable error at each x:** The Bayes rule chooses the larger class mass, leaving the smaller mass as errors. These smaller masses are 0.08,0.08 and 0.12. **3. Sum:** \[er_D^*=\sum_x\min_yP(x,y)=0.08+0.08+0.12=0.28.\] The requested two-decimal value is 0.28. **Answer: 0.28.**

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