Page 1
CHENNAI MATHEMATICAL INSTITUTE
M.Sc. Data Science Entrance Examination 2025
Solutions
Part (A) - Multiple-choice questions
1. Let X = {1, 2, 3} and Y = {a, b, c, d} be two finite sets. Which of the following statements regarding
functions from X → Y is/are true?
(a) The number of one-to-one functions is 34 .
(b) There are as many one-to-one functions as onto functions.
(c) The number of onto functions is strictly less than the number of one-to-one functions.
(d) The number of one-to-one functions is 24.
Solution: Options (c), (d). Y has more elements hence we can’t have onto functions from X to Y . The
number of one-to-one functions is the same as choosing 3 distinct elements from Y and then assigning
them to the elements of X in 3! ways.
2. The two arguments to the function foo(A, n) in the code below are: (i) an integer array A indexed from
0, and (ii) the number n of elements in A.
function foo (A , n ) {
count = 0;
for i from 0 to (n -1) {
for j from ( i +1) to (n -1) {
if ( A [ i ] > 2 * A [ j ]) {
count = count + 1;
}
}
}
return ( count );
}
Which of the following statements about the function foo(A, n) are correct?
(a) foo(A, n) counts the number of index pairs (i, j) such that i < j and A[i] > 2 × A[j].
(b) For the input A = [1, -4, 3, -5, -2], n = 5, the function returns 7.
(c) For the input A = [1, 2, 3, 4, 5], n = 5, the function returns 0.
(d) For the input A = [10, 5, 1], n = 3, the function returns 2.
Solutions: (a), (c), and (d) are correct.
(a) Correct : The function counts the number of index pairs i < j such that A[i] > 2 × A[j].
(b) Incorrect : Correct answer is 6.
(c) Correct : in [1,2,3,4,5], no element is more than twice any later element.
(d) Correct : in [10,5,1]:
• (10,1): 10 > 2*1 → yes
• (5,1): 5 > 2*1 → yes
So, 2 pairs.
3. What is the domain of the following real valued function?
f (x) = log2 (x2 − 5x + 6).
(a) (−∞, 2)
(b) (3, ∞)
1
Page 2
(c) (−∞, 2) ∪ (3, ∞)
(d) (−∞, ∞)
Solution: Option (c), (−∞, 2) ∪ (3, ∞).
The argument of a logarithmic function must be positive:
x2 − 5x + 6 > 0 ⇐⇒ (x − 2)(x − 3) > 0
The latter condition holds if and only if exactly one of the following holds:
• (x − 2) > 0 and (x − 3) > 0. This happens exactly when x > 3 holds.
• (x − 2) < 0 and (x − 3) < 0. This happens exactly when x < 2 holds.
So the function f (x) is defined exactly when x < 2 or x > 3. This corresponds to the union of intervals
(−∞, 2) ∪ (3, ∞).
a b
4. Let A = be a real matrix which satisfies A−1 = A. Which of the following statements is/are
c d
always true?
(a) a + d = 0
(b) ad − bc = 1
(c) ad − bc ̸= 0
(d) a2 + 2bc + d2 = 2
Solution: Options (c), (d)
1 0
• (a) is not always true. Consider A = .
0 1
0 1
• (b) is not always true. Consider A = .
1 0
• (c) is true. Since A is invertible, det(A) = ad − bc ̸= 0 holds.
• (d) is true. From A−1 = A we get—by multiplying both sides with A—that A2 = I holds. That is:
2
a b a b a + bc ab + bd 1 0
A2 = = = .
c d c d ac + cd d2 + bc 0 1
Thus a2 + bc = 1, d2 + bc = 1. Adding these equations, we get the statement.
5. Let Z be the set of all integers. Let A = {n ∈ Z | n2 + 10n + 21 is divisible by 7}. Which of the following
statements is/are true?
(a) A = {n ∈ Z | (n ≡ 0 mod 7)}
(b) A = {n ∈ Z | (n ≡ 0 mod 7) or (n ≡ 4 mod 7)}
(c) A = {n ∈ Z | (n ≡ 1 mod 7) or (n ≡ 5 mod 7)}
(d) A = {n ∈ Z | (n ≡ 2 mod 7) or (n ≡ 6 mod 7)}
Solution: Option (b), A = {n ∈ Z | (n ≡ 0 mod 7) or (n ≡ 4 mod 7)}.
Factoring the expression, we get n2 + 10n + 21 = (n + 3)(n + 7). Since 7 is a prime number, this product
is divisible by 7 exactly when at least one of the following holds:
• n + 3 is divisible by 7. This is equivalent to n ≡ 4 mod 7
• n + 7 is divisible by 7. This is equivalent to n ≡ 0 mod 7
Since the equivalence classes of N modulo 7 are disjoint, (b) is the only correct answer.
2
Page 3
6. Let n ≥ 3 be an integer, and let x1 , x2 , . . . , xn be variables which take real values with 0 ≤ xi ≤ 1 for all
1 ≤ i ≤ n. Let
A = x1 + x2 + . . . + xn
B = x1 x2 + x2 x3 + . . . + xn−1 xn + xn x1
Which of the following statements is/are true.
(a) A ≥ B is always true.
(b) B > A is true for some values of the xi ’s and A > B is true for some values of the xi ’s.
(c) A = B has a finite number of solutions
(d) A = B has an infinite number of solutions.
Solution: Options (a) and (c) are True. A − B = x1 (1 − x2 ) + x2 (1 − x3 ) + . . . + xn (1 − x1 ), so (a) is
true. For equality. If x1 is not zero, x2 = 1, forcing x3 = 1, and so on, forcing x1 = 1. The same is true
if any other xi is non-zero. On the other hand, if x1 = 0, then xn = 0, forcing xn−1 = 0, and finally
x2 = 0, so (c) is also true
7. Let B = ((bi,j )) be an n × n matrix. Let p : {1, 2, . . . , n} 7→ {1, 2, . . . , n} be a bijection (i.e. a one-to-one
correspondence) and let a matrix A = ((ai,j )) be defined by
ai,j = bp(i),p(j) , 1 ≤ i, j ≤ n.
Which of the following statement(s) is/are true for all choices of B and P .
(a) A admits an inverse if and only if B admits an inverse.
(b) For any x, y ∈ Rn , Ax = y admits a solution if and only if Bx = y admits a solution.
(c) A and B have the same trace.
(d) A and B have the same eigenvectors.
Solution: Options (a), (c). Option (a) is true since the absolute value of the determinant of A is same as
that of B. Option
(c) is true
since
the diagonal elements are preserved. Option (b) is false; for example,
1 2 3 0 0
let ,y and A = . Option (d) is false as the eigenvectors are permuted by the bijection
0 0 0 2 1
p.
8. Let x be a variable that takes real values, and let f (x) = x3 − 3x. Which of the following statements
is/are true?
√
(a) f (x) has a local maximum at x = − 3
(b) f (x) has a local maximum at x = −1
√
(c) f (x) has a local minimum at x = 3
(d) f (x) has a global minimum at x = 1
Solution: Option (b).
Setting f ′ (x) = 3x2 − 3 = 0 we get that the critical points of f (x) are x = ±1. Now f ′′ (x) = 6x, and so
the only local maximum of f (x) is at x = −1. Even x = 1 is a critical point and a local minima since
f ′′ (x) > 0. It is not a global minima since −∞ is a global minimum.
9. A binary relation R defined on a set S is said to be antisymmetric if for x, y ∈ S, xRy and yRx =⇒
x = y. Let R1 , R2 be two binary relations defined on a set S. The union of R1 , R2 is the binary relation
U defined on S as: For x, y ∈ S, xU y ⇐⇒ xR1 y or xR2 y. The intersection of R1 , R2 is the binary
relation I defined on S as: For x, y ∈ S, xIy ⇐⇒ xR1 y and xR2 y.
Which of the following statements is/are true?
(a) A binary relation cannot be both symmetric and antisymmetric.
3
Page 4
(b) A binary relation can be both transitive and antisymmetric.
(c) The union of two equivalence relations is always an equivalence relation.
(d) The intersection of two equivalence relations is always an equivalence relation.
Solution: Options (b) and (d).
• (a) is false. E.g.: the identity relation is both symmetric and antisymmetric.
• (b) is true. E.g.: the “less than” relation on integers is both transitive and antisymmetric.
• (c) is false. E.g.: Consider the following two relations defined on the set S = {1, 2, 3, . . . , 100}:
– xR1 y: x and y are related if (i) x and y are both integral powers of 2, or if (ii) neither x nor y
is an integral power of 2;
– xR2 y if and only if x ≡ y mod 2.
Let U be the union of R1 and R2 . Then: 2U 4 since 2R1 4 and 4U 14 since 4R2 14. But 2 is not
related to 14 by U , since 2 and 14 are not related by either R1 or R2 . Thus U is not transitive, and
hence is not an equivalence relation.
• (d) is true. This follows from a straightforward application of the definitions of set intersection and
an equivalence relation.
10. In how many ways can 10 identical chocolate bars be distributed among 5 children, in such a way that
each child gets at least one chocolate bar?
(a) 50
(b) 126
(c) 252
(d) 3125
Solution: Option (b), 126.
Since the chocolate bars are identical, the only difference between two ways of distributing them to the
children is in the counts of chocolate bars that the children get. Since every child must get at least
one chocolate bar, this uses up 5 of the bars. The remaining n = 5 bars can be distributed in any
manner among the k = 5 children. The number of ways of doing this is, using the textbook formula for
distributing n identical balls into k distinct bins,
n+k−1 5+5−1 9
= = = 126.
k−1 5−1 4
11. Which of the following is/are logically equivalent to ¬(P =⇒ Q)?
(a) ¬P ∨ Q
(b) ¬P ∧ Q
(c) Q =⇒ P
(d) P ∧ ¬Q
Solution: Option (d), P ∧ ¬Q. This can be found, for instance, using truth tables.
√
12. Let f (x) = x. We draw a tangent to the curve y = f (x) at the point on the curve whose x coordinate
is equal to 4. Where does this tangent intersect the X-axis?
(a) x = 4
(b) x = −2
(c) x = −4
(d) x = 2
4
Page 5
Solution: Option (c), x = −4.
√
The derivative of f (x) = x is f ′ (x) = 2√1 x . The slope of the tangent to f (x) at x = 4 is then
f ′ (4) = 2√
1
4
= 41 . The equation of this tangent is thus y = x4 + c, where c is its Y -intercept. Since the
point (4, f (4)) = (4, 2) lies on this tangent, we get that 2 = 44 + c holds, from which we get c = 1. Thus
the equation of the tangent is y = x4 + 1. Setting y = 0 gives us the X-intercept as x = −4.
13. Let n be an integer, n ≥ 4. A is an n × n matrix with real entries. The matrix B is obtained by the
following sequence of operations on A. First, multiply each entry of A by 2. Then add 3 times the second
column to the third column. Finally, swap the first and the fourth columns. If det(A) = 5, which of the
following statements are true?
(a) 10 divides det(B)
(b) det(B) = −5
(c) 100 divides det(B)
(d) det(B) = −2n · 5
Solution: Options (a) and (d) are True.
14. Let x, y, z be positive numbers such that x2 + y 2 = z 2 . Determine the value of the following expression:
logy+z x + logz−y x
.
(logy+z x)(logz−y x)
(a) Undefined.
(b) 12
(c) 41
(d) 2
Solution: Let logz+y x = u and let logz−y x = v. We wish to compute 1/u + 1/v. Then (y + z)u = x and
(z − y)v = x. So y + z = x1/u and z − y = x1/v . So z 2 − y 2 = x2 = x1/u x1/v = x1/u+1/v . So 1/u + 1/v = 2.
Note: One can choose x, z such that z is odd and x2 = 2z − 1. For example, x = 3, z = 5 or x = 5, z = 13
etc. In such cases, z − y = 1 and hence logz−y x = log1 x, an undefined quantity. The way out is to
interchange the roles of x and y. Since, the question did not specifically mentions how x, y are chosen
given z, Option (a) Undefined is also a valid answer. Candidates who picked either (a) or (d) or both (a)
and (d) have received full marks for this question. We thank the candidate who pointed out this case.
15. A game being offered in a casino consists of guessing the outcomes of two tosses of a fair coin. The
gambler wins if she/he has correctly guessed at least one of the two tosses. To play a game, the gambler
has to pay a fee of Rs. 80, and the winner gets a reward of Rs. 100 on winning the game (and nothing
otherwise).
Which of the following statements are correct?
(a) In the first 10 minutes on a given day exactly three gamblers play the game, one after the other.
The probability that the casino owner makes a profit in the first 10 minutes equals 1/4.
(b) One gambler plays the game three times. The probability that she wins exactly two of the three
games is 27/64.
(c) Three friends go together and play the game with each playing once. The probability that all three
win equals 27/64.
(d) If 1200 players play the game on a given day, the expected profit of the casino owner for the day
equals Rs. 6000.
Solution: Options (b), (c), (d) are correct. The distribution of the number of wins of the casino owner
in a sequence of 3 games is binomial with p = 1/4. Thus (b) and (c) are correct. The expected profit
from each game is 80-100× 3/4 =5. (a) is false because the owner loses only when all three win, which
is 27/64 thus the probability that owner makes a profit is 37/64.
5
Page 6
16. In the following code the operator % denotes the remainder after integer division. That is: for positive
integers a,b the value a % b is the remainder obtained when a is divided by b.
function fizzbuzz ( n ) {
count = 0;
for i from 0 to (n -1) {
if (( i % 3) == 0) and (( i % 5) != 0) {
count = count + 1;
}
}
return ( count );
}
What does fizzbuzz(100) return?
(a) 27
(b) 33
(c) 45
(d) 60
Solution: Option (a).
The function returns the number of non-negative integers less than n which are both (i) multiples of 3, and
(ii) not multiples of 5. There are 27 such integers: [3, 6, 9, 12, 18, 21, 24, 27, 33, 36, 39, 42, 48, 51, 54, 57, 63, 66, 69, 72,
17. Alpha and Beta are inhabitants of an island of knights and knaves, where knights always tell the truth
and knaves always lie. Alpha and Beta are alone at a beach when Alpha says: “At least one of us is a
knave.” And Beta says: “We are both knaves.” Which of the following is/are true?
(a) Alpha and Beta are both knights
(b) Alpha and Beta are both knaves
(c) Alpha is a knight and Beta is a knave
(d) Alpha is a knave and Beta is a knight
Solution: Option (c).
If Beta is a knight then both are knaves, a contradiction. So Beta has to be a knave. Thus Beta’s
statement must be false. This means Alpha has to be a knight. And Alpha being a knight and Beta
being a knave is consistent with both their statements.
Questions 18 to 20 are based on the following code.
The two arguments to the function Mystery(A, n) in the code below are: (i) an integer array A indexed from
0, and (ii) the number n of elements in A. Each element of A is an integer from the set {1, 2, . . . , n}. The
expression [0] * (n+1) creates an array, indexed from 0, that contains n + 1 zeroes.
Note: There is a typo in the following code, which results in the code referring to the non-existent array
location A[n]. As a result of this typo, the three Part A questions 18, 19 and 20 based on this pseudocode were
not considered for evaluation.
function Mystery (A , n ) {
found = False ;
value = None ;
B = [0] * ( n +1);
for i from 1 to n {
B [ A [ i ]] = B [ A [ i ]] + 1;
}
for i from 1 to n {
6
Page 7
if ( found == False ) {
if ( B [ A [ i ]] == 1) {
found = True ;
value = A [ i ];
}
}
}
if ( found == True ) {
return ( value );
} else {
return ( None );
}
}
Answer the next three questions about this function.
18. What does the function call Mystery([1, 2, 3, 3, 2, 1], 6) return?
(a) None
(b) 1
(c) 2
(d) 3
19. What does the function call Mystery([1, 2, 4, 3, 2, 1], 6) return?
(a) None
(b) 2
(c) 3
(d) 4
20. What does the function call Mystery([6, 5, 4, 3, 2, 5], 6) return?
(a) 3
(b) 4
(c) 5
(d) 6
7
Page 8
Part (B) - Short-answer questions
For questions in part (B), you have to write your answer with a short explanation in the space
provided for the question in your answer sheet. If you need more space, you may continue on the
pages provided for rough work. Any such overflows must be clearly labeled.
1. A girl writes five consecutive positive integers on a blackboard. She then erases one of them. The sum
of the remaining four numbers is 2025. What number did she erase?
Solution:
We assume the five consecutive integers are n, n + 1, n + 2, n + 3, n + 4. Their total sum is:
S = 5n + 10
One number is erased and the sum of the remaining four numbers is given as 2025.
Let a be an integer between 0 to 4. Then we have
5n + 10 = 2025 + n + a
4n = 2025 + (a − 10)
The RHS is divisible by 4 only when a = 1. Hence, n = 504 and the erased number is 505. Verification:
the numbers are 504, 505, 506, 507, 508, they add up to 2530 and subtracting 505 gives us 2025.
2. A toy company currently sells 1,000 toys each month at a price of |500 per toy. To increase their sales,
the company is considering to lower the price. Market research shows that for every |10 decrease in the
price, the number of toys sold increases by 100. However, the price cut applies to all the toys sold.
(a) By how much should the company reduce the price, so as to maximize its monthly revenue?
(b) What would be the maximum revenue per month that the company can achieve?
Assume that the decrease in price is an integer multiple of |1.
Solution using Derivative Technique:
Let the company reduce the price by |x.
Then,
• New price per toy = |(500 - x)
• Increase in toys sold = 10
x
× 100 = 10x
• Total toys sold = 1000 + 10x
Revenue Function:
Revenue, R(x) = Price per toy × Quantity sold
R(x) = (500 − x)(1000 + 10x)
= 500000 + 5000x − 1000x − 10x2
= 500000 + 4000x − 10x2
Take Derivative
d
R′ (x) = (500000 + 4000x − 10x2 ) = 4000 − 20x
dx
Critical Point
8
Page 9
R′ (x) = 0 ⇒ 4000 − 20x = 0 ⇒ x = 200
Check Maximum
R′′ (200) = −20 < 0
So, the function attains a maximum at x = 200.
Final Answer:
The company should reduce the price by |200 to maximise revenue.
New price = |300
Number of toys sold = 1000 + 10 × 200 = 3000
Maximum revenue = |300 × 3000 = |9,00,000
3. 15 balls are placed independently and uniformly at random into 15 bins numbered from 1 to 15. The
1
probability that a ball ends up in a particular bin is 15 .
(a) What is the probability that the first 5 balls go into different bins, conditioned on the event that
first four balls are in different bins?
(b) What are the possible values of the expected number of balls in bin 1 conditioned on the event that
the first 13 balls are in different bins?
Solution: Problem (a) 11/15. Problem (b) Conditioned on X13 , the first bin may have 0 or 1 balls. If
the first bin is empty, then it may have 0, 1 or 2 balls finally. 1 ball is with probability 2 ∗ 1/15 ∗ (14/15).
30
2 balls is with probability 1/225. So the expected value of Y1 is then 225 .
On the other hand, if it already has 1, then the final number can be 1 (w.p 196/225), 2 (w.p 2∗1/15∗14/15
and 3 w.p 1/225. So the expected value is 196/225 + 56/225 + 3/225 which is 255/225.
4. There are 18 chocolates in a bag, of which 7 are green, 6 are blue, and 5 are red. We pick chocolates one
at a time from the bag without replacement.
(a) What is the probability that the first and the third chocolate are green?
(b) What is the probability that after picking twelve chocolates, only chocolates of one colour remain
in the bag?
Solution:
• 5!6!5!
16! 18
divided by 7!6!5! 7∗6
which turns out to be 17∗18 . Another way to see this. If the first three are
7 6 5 7 11 6
green it happens with probability 18 17 16 . If the second is not green the probability is 18 17 16 . These
are disjoint events and the probabilities add to give the same answer.
• We can have all blue or all green left in the bag. If the chocolates remaining are all blue, this can
12!
happen in x := 7!5! ways of picking the first 12. If the remaining chocolates are all green, then in
12!
the first twelve we have picked all red, one green and all blue. Those can be picked in y := 5!6! ways.
x+y
So it is N .
5. Let M be an n × n matrix. We define an elementary row operation on M to be one of the following:
i Interchanging some two rows of M .
ii Multiplying a row in M by a non-zero scalar.
iii Adding a scalar multiple of one row of M to another row of M .
An n × n matrix is said to be elementary if it is the result of a single elementary row operation performed
on the n × n identity matrix.
Which of the following statements is/are true? Justify your answer with a short proof, if the statement
is true, otherwise, provide a counterexample.
9
Page 10
a Every elementary operation on a n×n matrix A can be performed by multiplying A by an elementary
n × n matrix on the right.
b An elementary row operation on a n × n matrix A results in a matrix with the same determinant
as that of A.
1 0
Solution: Both are false. Example and interchanging the two rows. Scaling changes determinant.
2 0
6. Consider the following polynomial of positive degree n
Pn (x) = 1 + 2x + 3x2 + . . . + (n + 1)xn .
Show that there is no real number r such that Pn (r) = 0 when n is even.
Solution:
1 − xn+1
(1 − x)Pn (x) = − (n + 1)xn+1
1−x
So
1 − (n + 2)xn+1 + (n + 1)xn+2
Pn (x) =
(1 − x)2
From the given expression of Pn (x) there are no zeros when x > 0. From the above expression, when n
is even, and x < 0, the numerator is positive, so there are no roots.
7. How many positive integers less than 1000 are neither divisible by 3 nor divisible by 5? Explain how
you arrived at your answer.
Solution: The answer is 533.
Let U = {1, 2, . . . , 999}. Let A be the set of all elements of U which are divisible by 3, and let B be
the set of all elements of U which are divisible by 5. Then |A| = ⌊ 999 999
3 ⌋ = 333, |B| = ⌊ 5 ⌋ = 199, and
999
|A ∩ B| = ⌊ 15 ⌋ = 66. The number of elements of U which are divisible by at least one of {3, 5} is
|A ∪ B| = |A| + |B| − |A ∩ B| = 333 + 199 − 66 = 466. The number of elements of U which are divisible
by neither 3 nor 5 is thus |U \ (A ∪ B)| = |U | − |A ∪ B| = 999 − 466 = 533.
8. Three hostel friends Amar, Prem and Raj are suspected of breaking a window. They made the following
statements when questioned by the warden:
• Amar: I did not break it. Prem is lying.
• Prem: Amar is telling the truth. Raj broke the window.
• Raj: I did not break it. Either Amar is telling the truth or Prem is telling the truth.
You know that exactly one of them lied and the other two told the truth. Then, who broke the window?
Justify.
Solution: Prem broke the window. In addition, he is the one who lied.
Justification: since we are told that exactly one of them lied, so we can assume each of them lied to see
which assumptions lead to contradiction. If Amar lied then Prem is speaking the truth. Which implies
Amar is speaking the truth. A clear contradiction.
Suppose Raj lied. This implies either Raj broke the window or both Amar and Prem are lying, again a
contradiction.
Finally, suppose Prem lied, which means either Amar is telling the truth is false or Raj broke the window
is false. Raj did not break the window doesn’t contradict anything. However, Amar lying certainly
contradicts Prem lying. However, both Amar and Raj are speaking the truth do not contradict anything.
Hence, Prem is lying and his ”Raj broke the window” statement is false, and more importantly, Prem
broke the window.
9. A cloth bag labeled X contains two apples, bag Y contains two oranges and bag Z one apple and one
orange. You pick a bag at random and then remove one fruit from that bag at random. Suppose you
removed an apple. What is the probability that the fruit remaining in the bag is also an apple? Justify.
10
Page 11
Solution: The answer is 23 .
Justification: Let p(BX ) denote the probability of picking bag X and p(A) be the probability of removing
an apple on the first draw. Hence, we want to calculate
p(A|BX ) · p(BX )
p(BX |A) = .
p(A)
Note that p(A) = 22 · 13 + 02 · 31 + 12 · 13 . Hence the answer is
1 · 1/3 2
p(BX |A) = = .
1/2 3
Questions 10 and 11 are based on the following description.
The following question appeared in a quiz:
“Write the pseudocode for a function Closest(A,n,x) that takes an array A, a positive integer n,
and an integer x as arguments. The elements of A are all integers less than 264 , and n is the number
of elements in A. The call Closest(A,n,x) should return an integer y such that: (i) y ̸= x, (ii) y
is present in A, and (iii) there is no z ̸= x in A where |z − x| < |y − x| holds. If A has no such
element y, then the function should return the special value None.”
A student submitted the code below as the answer to this question. In the code the array A is indexed from 0,
and MAXINT = 264 − 1. The call abs(z) returns the absolute value |z| of integer z.
function Closest (A , n , x ) {
minVal = MAXINT ;
for i from 0 to (n -1) {
absDiff = abs ( x - A [ i ]);
if ( absDiff < minVal ) {
minVal = absDiff ;
y = A [ i ];
}
}
if ( minVal != MAXINT ) {
return ( y );
} else {
return ( None );
}
}
This answer turned out to be wrong; this function gives the correct answer for some valid inputs, and wrong
answers for other valid inputs. Answer the next two questions about this function.
10. What do the following function calls return?
(a) Closest([-10,2,10], 3, 8)
(b) Closest([0,-5,4], 3, 7)
Solution: For both these inputs the function returns the correct answer, namely: 10 for part (a) and 4
for part (b). A complete solution will also explain (e.g., using dry runs) as to why the function returns
these values.
11. Give one example of (i) an input array A with exactly 3 elements and (ii) an integer x for which the call
Closest(A, 3, x) returns a wrong answer. What is this wrong answer? What is the correct answer?
Solution: Some examples of such inputs are:
• A = [1, 2, 3], x = 1. The function returns 1. The correct value is 2.
11
Page 12
• A = [5, 10, 3], x = 5. The function returns 5. The correct value is 3.
If x is present in A then this pseudocode always outputs x, even if a different number is there in A.
A different kind of input for which this pseudocode gives a wrong answer, is one where the magnitude of
of x is so large that absDiff is larger than MAXINT. For such inputs the function may return None, even
if there is an element of A that satisfies the requirements for a closest element to x.
12. A sequence of five natural numbers s1 ≤ s2 ≤ s3 ≤ s4 ≤ s5 satisfy the following conditions:
P5
• i=1 si = 35
P3
• i=1 si = 15
P5
• i=3 si = 27
• s2 is even
• s4 − s2 = 2
Find all such sequences that satisfy the above conditions.
Solution: The answer is 2, 6, 7, 8, 12. Step 1 -
3
X 5
X 5
X
+si si − si = s3 = 7.
i=1 i=3 i=1
Using this we get, s1 + s2 = 8 and s4 + s5 = 20. Now we have s3 < s4 =⇒ s3 < s2 + 2, which gives us
5 < s2 < 7.
Hence s2 = 6, and we can use it to find other values.
13. Five executives of a company namely CEO (chief executive officer), CFO (chief financial officer), COO
(chief operating officer), CTO (chief technology officer), CMO (chief marketing officer) are to be seated
around a circular table.
• The CEO must sit next to the CFO.
• The COO must not sit next to the CTO.
• The CTO must not sit next to the CEO.
In how many distinct ways can they be seated? (Rotations of the same arrangement are considered the
same).
Solution: There are 2 distinct ways. There are total 5 people so, without restrictions there will be 24
circular permutations. One can begin by considering CEO and CFO has a single unit. Hence, there are
6 ways to arrange (CEO, CFO), COO, CTO, CMO. The unit (CEO, CFO) can be arranged in 2 ways,
hence, in total there are 12 ways in which CEO is seated next to CFO. Now, proceed by adding one
restriction at a time. We get the following 2 valid seating arrangements:
• CEO-CFO-CTO-CMO-COO-CEO
• CEO-COO-CMO-CTO-CFO-CEO
14. Evaluate the following limit:
e2x − 2x − cos x
lim .
x→0 x sin x
Solution: One has to use the L’Hospital rule in order to get the answer 25 .
15. Find the determinant of the following matrix:
1 1 4 3
5 8 26 21
A=
2
3 10 8
3 5 16 13
Solution: det(A) = 0; the 3rd column is twice the sum of first and second column.
12
Page 13
16. Let f : R → R be a function which is twice differentiable everywhere and suppose that f ′ (q) = 0 for
every rational number q. Find the value of f (π 2 ) − f (π).
Solution: 0. Since f ′ exists everywhere and is continuous, its value can’t be nonzero on irrationals. As
the derivative is identically zero the function f is constant.
17. Consider the following 2 × 2 matrix
0 r
B= ,
−1 0
where r is a nonzero real number. Find B 2025 , i.e., the matrix obtained by multiplying B with itself 2025
times.
Solution: One has to realize that B 4k = r2k I, by explicitly computing B 2 , B 3 and B 4 . Hence, B 2025 =
r1012 B as 2025 is congruent to 1 mod 4.
Instructions for Questions 18,19, and 20:
Read the following description carefully and answer the questions that follow. Use all the information
provided. Clearly show all your calculations.
Description:
NorthCool Beverages Pvt. Ltd. is a leading beverage company that operates across six northern
states of India. During the past summer the company launched an aggressive marketing campaign to
promote its range of flavoured drinks. The charts below summarise the sales data collected during this
campaign.
Lemon Flavour Sales By State (Rs. Lakhs)
Uttar Pradesh
Haryana
Punjab
States
Himachal Pradesh
Delhi
Uttarakhand
0 5 10 15 20 25 30
Sales
Figure 1: Revenue share by flavour, and sales of lemon-flavoured drink by state
18. What is the revenue from the sales of Mango flavour drinks.
Solution: Let total revenue be R. Given:
• Lemon revenue = |120 lakhs
• Lemon accounts for 28% of total revenue
28 120 × 100 12000
× R = 120 ⇒ R = = ≈ 428.57 lakhs
100 28 28
Total revenue = |428.57 lakhs. Now, the share of mango flavoured drink is 15%, which amounts to 64.28
lakhs.
13
Page 14
19. NorthCool Beverages plans to launch a new variant, “Lemon Max”, in the two states with the highest
sales of the lemon flavour. The company expects Lemon Max to generate additional revenue equal to
20% of the current lemon flavour sales in those two states. What would be the percentage revenue share
of lemon flavour drinks if their expectations are met?
Solutions:
Top 2 states by lemon sales:
• Uttar Pradesh: |30 lakhs
• Haryana: |25 lakhs
• Total = |55 lakhs
Lemon Max will generate 20% additional revenue over this; which is 11 lakhs. So, if the expectations are
met then the total revenue generated by lemon flavoured drinks is 131 lakhs. The total expected revenue
is 439.57 lakhs. Hence, the increased share of lemon flavoured drink is approximately 30% (29.8% to be
precise).
20. On average, for every |1 lakh in total revenue from the lemon-flavoured drink, 10,000 litres of lemon-
flavoured drink are sold across the six states. Estimate the total volume (in litres) of lemon-flavoured
drink sold by NorthCool Beverages across all six states.
solutions: Given:
• |1 lakh revenue = 10,000 litres
• Total lemon revenue = |120 lakhs
Total volume = 120 × 10,000 = 1,200,000 litres
Total volume of lemon beverage sold = 12,00,000 litres.
14