0% found this document useful (0 votes)
79 views7 pages

Chennai Mathematical Institute: M.Sc. / Ph.D. Programme in Computer Science

The document provides instructions for a computer science entrance exam with two parts (Part A and Part B) consisting of multiple choice and long answer questions respectively. Part A contains 10 questions worth 3 marks each, while Part B contains 7 questions worth 10 marks each, for a total exam time of 3 hours and 100 marks. The summary instructions state to answer all questions, with Part A answers filled on a separate answer sheet and rough work done on blank pages provided.

Uploaded by

Rishi Dey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views7 pages

Chennai Mathematical Institute: M.Sc. / Ph.D. Programme in Computer Science

The document provides instructions for a computer science entrance exam with two parts (Part A and Part B) consisting of multiple choice and long answer questions respectively. Part A contains 10 questions worth 3 marks each, while Part B contains 7 questions worth 10 marks each, for a total exam time of 3 hours and 100 marks. The summary instructions state to answer all questions, with Part A answers filled on a separate answer sheet and rough work done on blank pages provided.

Uploaded by

Rishi Dey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

CHENNAI MATHEMATICAL INSTITUTE

M.Sc. / Ph.D. Programme in Computer Science


Entrance Examination, 18 May 2017

Instructions
− −
• Enter your Admit Card Number : C

• This examination has two parts Part A and Part B.

– The time allowed is 3 hours.


– Total Marks: 100

• Answer all questions.

• Answer questions for Part A in the special answer sheet provided for it.

• Rough Work: The coloured blank pages are to be used for rough work only.

For office use only

Part A Part B Overall Marks

1 1 Part A

2 2 Part B

3 3 Total

4 4

5 5

6 6

7 7

8 Total

10

Total
CHENNAI MATHEMATICAL INSTITUTE
M.Sc. / Ph.D. Programme in Computer Science
Entrance Examination, 18 May 2017

Answer Sheet for Part A

Instructions
• Answer all questions for Part A on this sheet only.

• Tick the appropriate box to indicate your answer.

a b c d

10
CHENNAI MATHEMATICAL INSTITUTE
M.Sc. / Ph.D. Programme in Computer Science
Entrance Examination, 18 May 2017

This question paper has 5 printed sides. Part A has 10 questions of 3 marks each. Part B has
7 questions of 10 marks each. The total marks are 100. Answers to Part A must be filled in
the answer sheet provided.

Part A
1. The regular expression (a∗ + b)∗ is equivalent to which of the following regular expres-
sions:
(a) a∗ b∗ (b) (a∗ b + b)∗ (c) (a + b∗ )∗ (d) (a∗ b)∗

2. An FM radio channel has a repository of 10 songs. Each day, the channel plays 3
distinct songs that are chosen randomly from the repository.
Mary decides to tune in to the radio channel on the weekend after her exams. What
is the probability that no song gets repeated during these 2 days?
10 2 10 −1
 
(a) 3
· 6
10 10 −2
 
(b) 6
· 3
10 7 10 −2
  
(c) 3
· 3
· 3
10 7 10 −1
  
(d) 3
· 3
· 6

3. Four siblings go shopping with their father. If Abhay gets shoes, then Asha does not
get a necklace. If Arun gets a T-shirt, then Aditi gets bangles. If Abhay does not get
shoes or Aditi gets bangles, the mother will be happy. Which of the following is true?

(a) If the mother is happy, then Aditi got bangles.


(b) If Aditi got bangles, then Abhay got shoes.
(c) If the mother is not happy, then Asha did not get a necklace and Arun did not
get a T-shirt.
(d) None of the above.

4. City authorities are concerned about traffic accidents on major roads. They would like
to have ambulances stationed at road intersections to quickly reach the scene of any
accident along these roads. To minimize response time, ambulances are to be located
at intersections with traffic lights so that any segment of road can be reached by at
least one ambulance that does not have to pass through a traffic light to reach the
scene of the accident. If we model the road network as a graph, where intersections
with traffic lights are vertices and edges represent road segments between traffic lights,
the graph theoretic question to be answered is:

(a) Find a spanning tree with minimum number of edges.


(b) Find a spanning tree with minimum cost.

1
(c) Find a minimal colouring.
(d) Find a minimum size vertex cover.

5. Let G be an arbitrary graph on n vertices with 4n − 16 edges. Consider the following


statements:

I There is a vertex of degree smaller than 8 in G.


II There is a vertex such that there are less than 16 vertices at distance exactly 2
from it.

Which of the following is true:


(a) I only (b) II only
(c) Both I and II (d) Neither I nor II
6. What does the following function compute in terms of n and d, for integer values of
d? Note that the operation / denotes floating point division, even if the arguments
are both integers.

function foo(n,d){
if (d == 0){
return 1;
}else{
if (d < 0){
return foo(n,d+1)/n;
}else{
return n*foo(n,d-1);
}}}

(a) logd n if d < 0, nd if d > 0.


(b) nd for all values of d.
(c) n × d if d > 0, n ÷ d if d < 0.
(d) n × d for all values of d.

7. Consider the following functions f() and g().

f(){ g(){
w = 5; z = w+1;
w = 2*z + 2; z = 3*z - w;
} print(z);
}

We start with w and z set to 0 and execute f() and g() in parallel—that is, at each
step we either execute one statement from f() or one statement from g(). Which of
the following is not a possible value printed by g()?
(a) -2 (b) -1 (c) 2 (d) 4

2
8. A stable sort preserves the order of values that are equal with respect to the comparison
function. We have a list of three dimensional points
[(7, 1, 8), (3, 5, 7), (6, 1, 4), (6, 5, 9), (0, 2, 5), (9, 0, 9)].
We sort these in ascending order by the second coordinate. Which of the folllowing
corresponds to a stable sort of this input?

(a) [(9, 0, 9), (7, 1, 8), (6, 1, 4), (0, 2, 5), (6, 5, 9), (3, 5, 7)]
(b) [(0, 2, 5), (3, 5, 7), (6, 1, 4), (6, 5, 9), (7, 1, 8), (9, 0, 9)]
(c) [(9, 0, 9), (7, 1, 8), (6, 1, 4), (0, 2, 5), (3, 5, 7), (6, 5, 9)]
(d) [(9, 0, 9), (6, 1, 4), (7, 1, 8), (0, 2, 5), (3, 5, 7), (6, 5, 9)]

9.
15
Suppose we constructed the binary
search tree shown at the right by start-
ing with an empty tree and inserting 7 28
one element at a time from an input se-
quence, without any rotations or other
manipulations. Which of the following 3 12 19 37
assertions about the order of elements
in the input sequence cannot be true?
1 6 8 14 16 23 29 42

(a) 8 came after 3 and 19 came after 29.


(b) 7 came before 8 and 23 came after 37.
(c) 1 came after 12 and 29 came before 42.
(d) 3 came before 14 and 16 came before 28.

10. We have constructed a polynomial time reduction from problem A to problem B.


Which of the following is a valid inference?

(a) If the best algorithm for B takes exponential time, there is no polynomial time
algorithm for A
(b) If the best algorithm for A takes exponential time, there is no polynomial time
algorithm for B.
(c) If we have a polynomial time algorithm for A, we must also have a polynomial
time algorithm for B.
(d) If we don’t know whether there is a polynomial time algorithm for B, there cannot
be a polynomial time algorithm for A.

Part B
1. Let Σ = {a, b, c}. Let Leven be the set of all even length strings in Σ∗ .

(a) Construct a deterministic finite state automaton for Leven .

3
(b) We consider an operation Eraseab that takes as input a string w ∈ Σ∗ and erases
all occurrences of the pattern ab from w. Formally, it can be defined as follows:

(
w if w does not contain the pattern ab
Eraseab (w) :=
Eraseab (w1 ) Eraseab (w2 ) if w = w1 ab w2 for some w1 , w2 ∈ Σ∗

For instance, Eraseab (cacb) = cacb, Eraseab (cabcbab) = ccb and Eraseab (ab) = .
For a language L, we define Eraseab (L) to be the set of strings obtained by applying
the Eraseab operation to each string in L:

Eraseab (L) := {Eraseab (w) | w ∈ L}

Show that Eraseab (Leven ) is a regular language.

2. There are a number of tourist spots in a city and a company GoMad runs shuttle
services between them. Each shuttle plies between a designated origin and destination,
and has a name. Due to lack of coordination, the same name may be allotted to
multiple routes.
To make matters worse, another company GoCrazy introduces its shuttle services
using the same set of shuttle names. A GoMad shuttle and a GoCrazy shuttle with
the same name may start at different origins and/or end at different destinations.
A pass from a company allows unlimited travel in all the company’s shuttles. For each
company, we have a list that specifies all routes allotted to each shuttle name.
Design an algorithm to find out if there is a source s, a target t, and a sequence of
shuttle names σ such that, irrespective of whether you are carrying a GoMad pass or
a GoCrazy pass, you can start at s and arrive at t using the sequence σ.

3. Let Σ = {a, b}. Given words u, v ∈ Σ∗ , we say that v extends u if v is of the form xuy
for some x, y ∈ Σ∗ . Given a fixed word u, we are interested in identifying whether a
finite state automaton accepts some word that extends u.
Describe an algorithm that takes as input a finite state automaton (DFA or NFA) A
over Σ = {a, b} and a word u ∈ Σ∗ and reports “Yes” if some word in the language of
A extends u and “No” if no word in the language of A extends u.

4. In a party there are 2n participants, where n is a positive integer. Some participants


shake hands with other participants. It is known that there are no three participants
who have shaken hands with each other. Prove that the total number of handshakes
is not more than n2 .

5. An undirected graph is connected if, for any two vertices {u, v} of the graph, there is
a path in the graph starting at u and ending at v. A tree is a connected, undirected
graph that contains no cycle.

(a) A leaf in a tree is a vertex that has degree 1. Prove that if G is a tree with at
least two vertices then G contains at least two leaves.

4
(b) A bipartite graph is one in which the vertex set V can be partitioned into two
disjoint sets V1 and V2 so that for every edge {u, v}, u and v lie in different
partitions—that is, u ∈ V1 and v ∈ V2 or vice versa. Prove that if G is a tree
with at least two vertices, then G is bipartite.

6. We are given a sequence of pairs of integers (a1 , b1 ), (a2 , b2 ), . . . (an , bn ). We would like
to compute the largest k such that there is a sequence of numbers ci1 ≤ ci2 ≤ . . . ≤ cik
with 1 ≤ i1 < i2 < ... < ik ≤ n and for each j ≤ k, cij = aij or cij = bij . Describe an
algorithm to solve this problem and explain its complexity.

7. Consider the following function that takes as input a sequence A of integers with
n elements, A[1], A[2], . . . , A[n] and an integer k and returns an integer value. The
function length(S) returns the length of sequence S. Comments start with //.

function mystery(A, k){


n = length(A);
if (k > n) return A[n];

v = A[1];
AL = [ A[j] : 1 <= j <= n, A[j] < v ]; // AL has elements < v in A
Av = [ A[j] : 1 <= j <= n, A[j] == v ]; // Av has elements = v in A
AR = [ A[j] : 1 <= j <= n, A[j] > v ]; // AR has elements > v in A

if (length(AL) >= k) return mystery(AL,k);


if (length(AL) + length(Av) >= k) return v;
return mystery(AR, k - (length(AL) + length(Av)));
}

(a) Explain what the function computes.


(b) What is the worst-case complexity of this algorithm in terms of the length of the
input sequence A?
(c) Give an example of a worst-case input for this algorithm.

You might also like