GATE 2017 CS (Set 1)

All 65 questions of GATE 2017 CS (Set 1)

Question text and figures as in the official paper, with the answer from the official key. Worked solutions for every question are in your report after you take the paper as a 3-hour test.

Q1 · General Aptitude · MCQ · 1 mark

Research in the workplace reveals that people work for many reasons ________.

  • (A)
    money beside
  • (B)
    beside money
  • (C)
    money besides
  • (D)
    besides money

Answer (official key): D

Worked solution: in your report after you take this paper.

Q2 · General Aptitude · MCQ · 1 mark

Find the smallest number yy such that y×162y \times 162 is a perfect cube.

  • (A)
    24
  • (B)
    27
  • (C)
    32
  • (D)
    36

Answer (official key): D

Worked solution: in your report after you take this paper.

Q3 · General Aptitude · MCQ · 1 mark

Rahul, Murali, Srinivas and Arul are seated around a square table. Rahul is sitting to the left of Murali. Srinivas is sitting to the right of Arul. Which of the following pairs are seated opposite each other?

  • (A)
    Rahul and Murali
  • (B)
    Srinivas and Arul
  • (C)
    Srinivas and Murali
  • (D)
    Srinivas and Rahul

Answer (official key): C

Worked solution: in your report after you take this paper.

Q4 · General Aptitude · MCQ · 1 mark

After Rajendra Chola returned from his voyage to Indonesia, he ________ to visit the temple in Thanjavur.

  • (A)
    was wishing
  • (B)
    is wishing
  • (C)
    wished
  • (D)
    had wished

Answer (official key): C

Worked solution: in your report after you take this paper.

Q5 · General Aptitude · MCQ · 1 mark

The probability that a 6-digit number does NOT contain the digits 0, 5, or 9 is:

  • (A)
    0.360.3^6
  • (B)
    0.660.6^6
  • (C)
    0.760.7^6
  • (D)
    0.960.9^6

Answer (official key): C

Worked solution: in your report after you take this paper.

Q6 · General Aptitude · MCQ · 2 marks

The expression

x+y−∣x−y∣2\frac{x+y-|x-y|}{2}

is equal to:

  • (A)
    the maximum of xx and yy
  • (B)
    the minimum of xx and yy
  • (C)
    1
  • (D)
    none of the above

Answer (official key): B

Read the worked solution

Q7 · General Aptitude · MCQ · 2 marks

Six people are seated around a circular table. There are at least two men and two women. There are at least three right-handed persons. Every woman has a left-handed person to her immediate right. None of the women are right-handed. The number of women at the table is:

  • (A)
    2
  • (B)
    3
  • (C)
    4
  • (D)
    Cannot be determined

Answer (official key): A

Read the worked solution

Q8 · General Aptitude · MCQ · 2 marks

“The hold of the nationalist imagination on our colonial past is such that anything inadequately or improperly nationalist is just not history.”

Which of the following statements best reflects the author's opinion?

  • (A)
    Nationalists are highly imaginative.
  • (B)
    History is viewed through the filter of nationalism.
  • (C)
    Our colonial past never happened.
  • (D)
    Nationalism has to be both adequately and properly imagined.

Answer (official key): B

Worked solution: in your report after you take this paper.

Q9 · General Aptitude · MCQ · 2 marks

Arun, Gulab, Neel and Shweta must choose one shirt each from a pile of four shirts coloured red, pink, blue and violet respectively. Arun dislikes the colour red and Shweta dislikes the colour violet. Gulab and Neel like all the colours. In how many different ways can they choose the shirts so that no one has a shirt with a colour he or she dislikes?

  • (A)
    21
  • (B)
    18
  • (C)
    16
  • (D)
    14

Answer (official key): D

Worked solution: in your report after you take this paper.

Q10 · General Aptitude · MCQ · 2 marks

A contour line joins locations having the same height above the mean sea level. The following is a contour plot of a geographical region. Contour lines are shown at 25 m intervals in this plot.

If in a flood, the water level rises to 525 m, which of the villages P, Q, R, S, T get submerged?

Contour plot for Q65

  • (A)
    P, Q
  • (B)
    P, Q, T
  • (C)
    R, S, T
  • (D)
    Q, R, S

Answer (official key): C

Worked solution: in your report after you take this paper.

Q11 · Databases · MCQ · 1 mark

The following functional dependencies hold true for the relational schema R(V,W,X,Y,Z)R(V,W,X,Y,Z):

V→WV\to W VW→XVW\to X Y→VXY\to VX Y→ZY\to Z

Which of the following is irreducibly equivalent for this set of functional dependencies?

  • (A)
    V→W,V→X,Y→V,Y→ZV\to W,\quad V\to X,\quad Y\to V,\quad Y\to Z
  • (B)
    V→W,W→X,Y→V,Y→ZV\to W,\quad W\to X,\quad Y\to V,\quad Y\to Z
  • (C)
    V→W,V→X,Y→V,Y→X,Y→ZV\to W,\quad V\to X,\quad Y\to V,\quad Y\to X,\quad Y\to Z
  • (D)
    V→W,W→X,Y→V,Y→X,Y→ZV\to W,\quad W\to X,\quad Y\to V,\quad Y\to X,\quad Y\to Z

Answer (official key): A

Worked solution: in your report after you take this paper.

Q12 · Theory of Computation · MCQ · 1 mark

Consider the following context-free grammar over the alphabet Σ={a,b,c}\Sigma=\{a,b,c\} with SS as the start symbol:

S→abScT∣abcTS \to abScT \mid abcT T→bT∣bT \to bT \mid b

Which one of the following represents the language generated by the above grammar?

  • (A)
    {(ab)n(cb)n∣n≥1}\{(ab)^n(cb)^n\mid n\ge1\}
  • (B)
    {(ab)mcbn1cbn2⋯cbnm∣m,n1,n2,…,nm≥1}\{(ab)^mcb^{n_1}cb^{n_2}\cdots cb^{n_m}\mid m,n_1,n_2,\ldots,n_m\ge1\}
  • (C)
    {(ab)m(cbn)m∣m,n≥1}\{(ab)^m(cb^n)^m\mid m,n\ge1\}
  • (D)
    {(ab)n(cbm)m∣m,n≥1}\{(ab)^n(cb^m)^m\mid m,n\ge1\}

Answer (official key): B

Worked solution: in your report after you take this paper.

Q13 · Computer Organization and Architecture · MCQ · 1 mark

Consider the C struct defined below:

struct data {
    int marks[100];
    char grade;
    int cnumber;
};

struct data student;

The base address of student is available in register R1. The field student.grade can be accessed efficiently using:

  • (A)
    Post-increment addressing mode, (R1)+
  • (B)
    Pre-decrement addressing mode, -(R1)
  • (C)
    Register direct addressing mode, R1
  • (D)
    Index addressing mode, X(R1), where X is an offset represented in 2's complement 16-bit representation

Answer (official key): D

Worked solution: in your report after you take this paper.

Q14 · Algorithms · MCQ · 1 mark

Consider the following functions from positive integers to real numbers:

10, n, n, log⁡2n, 100n.10,\ \sqrt{n},\ n,\ \log_2 n,\ \frac{100}{n}.

The correct arrangement of the above functions in increasing order of asymptotic complexity is:

  • (A)
    log⁡2n, 100n, 10, n, n\log_2 n,\ \frac{100}{n},\ 10,\ \sqrt{n},\ n
  • (B)
    100n, 10, log⁡2n, n, n\frac{100}{n},\ 10,\ \log_2 n,\ \sqrt{n},\ n
  • (C)
    10, 100n, n, log⁡2n, n10,\ \frac{100}{n},\ \sqrt{n},\ \log_2 n,\ n
  • (D)
    100n, log⁡2n, 10, n, n\frac{100}{n},\ \log_2 n,\ 10,\ \sqrt{n},\ n

Answer (official key): B

Worked solution: in your report after you take this paper.

Q15 · Algorithms · MCQ · 1 mark

Consider the following table:

AlgorithmsDesign Paradigms
(P) Kruskal(i) Divide and Conquer
(Q) Quicksort(ii) Greedy
(R) Floyd-Warshall(iii) Dynamic Programming

Match the algorithms to the design paradigms they are based on.

  • (A)
    (P)↔(ii), (Q)↔(iii), (R)↔(i)(P)\leftrightarrow(ii),\ (Q)\leftrightarrow(iii),\ (R)\leftrightarrow(i)
  • (B)
    (P)↔(iii), (Q)↔(i), (R)↔(ii)(P)\leftrightarrow(iii),\ (Q)\leftrightarrow(i),\ (R)\leftrightarrow(ii)
  • (C)
    (P)↔(ii), (Q)↔(i), (R)↔(iii)(P)\leftrightarrow(ii),\ (Q)\leftrightarrow(i),\ (R)\leftrightarrow(iii)
  • (D)
    (P)↔(i), (Q)↔(ii), (R)↔(iii)(P)\leftrightarrow(i),\ (Q)\leftrightarrow(ii),\ (R)\leftrightarrow(iii)

Answer (official key): C

Worked solution: in your report after you take this paper.

Q16 · Probability and Statistics · Numerical · 1 mark

Let XX be a Gaussian random variable with mean 0 and variance σ2\sigma^2. Let

Y=max⁡(X,0)Y=\max(X,0)

where max⁡(a,b)\max(a,b) is the maximum of aa and bb.

The median of YY is __________.

Answer (official key): 0

Worked solution: in your report after you take this paper.

Q17 · Compiler Design · MCQ · 1 mark

Consider the following intermediate program in three address code:

p = a - b
q = p * c
p = u * v
q = p + q

Which one of the following corresponds to a static single assignment form of the above code?

  • (A)
    p1 = a - b
    q1 = p1 * c
    p1 = u * v
    q1 = p1 + q1
    
  • (B)
    p3 = a - b
    q4 = p3 * c
    p4 = u * v
    q5 = p4 + q4
    
  • (C)
    p1 = a - b
    q1 = p2 * c
    p3 = u * v
    q2 = p4 + q3
    
  • (D)
    p1 = a - b
    q1 = p * c
    p2 = u * v
    q2 = p + q
    

Answer (official key): B

Worked solution: in your report after you take this paper.

Q18 · Digital Logic · Numerical · 1 mark

Consider the Karnaugh map given below, where x represents “don't care” and blank represents 0.

Karnaugh map for Q21

Assume for all inputs (a,b,c,d)(a,b,c,d), the respective complements (a‾,b‾,c‾,d‾)(\overline{a},\overline{b},\overline{c},\overline{d}) are also available. The above logic is implemented using 2-input NOR gates only.

The minimum number of gates required is __________.

Answer (official key): 1

Read the worked solution

Q19 · Databases · Numerical · 1 mark

Consider a database that has the relation schema EMP(EmpId, EmpName, DeptName). An instance of the schema EMP and a SQL query on it are given below.

EmpIdEmpNameDeptName
1XYAAA
2XYBAA
3XYCAA
4XYDAA
5XYEAB
6XYFAB
7XYGAB
8XYHAC
9XYIAC
10XYJAC
11XYKAD
12XYLAD
13XYMAE
SELECT AVG(EC.Num)
FROM EC
WHERE (DeptName, Num) IN
      (SELECT DeptName, COUNT(EmpId) AS EC(DeptName, Num)
       FROM EMP
       GROUP BY DeptName);

The output of executing the SQL query is __________.

Answer (official key): 2.6

Worked solution: in your report after you take this paper.

Q20 · Discrete Mathematics · Numerical · 1 mark

Let TT be a tree with 10 vertices. The sum of the degrees of all the vertices in TT is __________.

Answer (official key): 18

Worked solution: in your report after you take this paper.

Q21 · Discrete Mathematics · MCQ · 1 mark

The statement (¬p)⇒(¬q)(\neg p) \Rightarrow (\neg q) is logically equivalent to which of the statements below?

I. p⇒qp \Rightarrow q

II. q⇒pq \Rightarrow p

III. (¬q)∨p(\neg q) \vee p

IV. (¬p)∨q(\neg p) \vee q

  • (A)
    I only
  • (B)
    I and IV only
  • (C)
    II only
  • (D)
    II and III only

Answer (official key): D

Worked solution: in your report after you take this paper.

Q22 · Computer Networks · MCQ · 1 mark

A sender SS sends a message mm to receiver RR, which is digitally signed by SS with its private key.

In this scenario, one or more of the following security violations can take place.

(I) SS can launch a birthday attack to replace mm with a fraudulent message.

(II) A third-party attacker can launch birthday attack to replace mm with a fraudulent message.

(III) RR can launch a birthday attack to replace mm with a fraudulent message.

Which of the following are possible security violations?

  • (A)
    (I) and (II) only
  • (B)
    (I) only
  • (C)
    (II) only
  • (D)
    (II) and (III) only

Answer (official key): B

Worked solution: in your report after you take this paper.

Q23 · Operating System · MCQ · 1 mark

Threads of a process share:

  • (A)
    global variables but not heap.
  • (B)
    heap but not global variables.
  • (C)
    neither global variables nor heap.
  • (D)
    both heap and global variables.

Answer (official key): D

Worked solution: in your report after you take this paper.

Q24 · Theory of Computation · Numerical · 1 mark

Consider the language LL given by the regular expression

(a+b)∗b(a+b)(a+b)^*b(a+b)

over the alphabet {a,b}\{a,b\}.

The smallest number of states needed in a deterministic finite-state automaton (DFA) accepting LL is __________.

Answer (official key): 4

Worked solution: in your report after you take this paper.

Q25 · Computer Organization and Architecture · MCQ · 1 mark

The nn-bit fixed-point representation of an unsigned real number XX uses ff bits for the fraction part. Let i=n−fi=n-f. The range of decimal values for XX in this representation is:

  • (A)
    2−f2^{-f} to 2i2^i
  • (B)
    2−f2^{-f} to (2i−2−f)(2^i-2^{-f})
  • (C)
    00 to 2i2^i
  • (D)
    00 to (2i−2−f)(2^i-2^{-f})

Answer (official key): D

Worked solution: in your report after you take this paper.

Q26 · Computer Organization and Architecture · MCQ · 1 mark

When two 8-bit numbers A7⋯A0A_7\cdots A_0 and B7⋯B0B_7\cdots B_0 in 2's complement representation, with A0A_0 and B0B_0 as the least significant bits, are added using a ripple-carry adder, the sum bits obtained are S7⋯S0S_7\cdots S_0 and the carry bits are C7⋯C0C_7\cdots C_0.

An overflow is said to have occurred if:

  • (A)
    the carry bit C7C_7 is 1
  • (B)
    all the carry bits (C7,⋯ ,C0)(C_7,\cdots,C_0) are 1
  • (C)
    (A7B7S7‾+A7‾B7‾S7)(A_7B_7\overline{S_7}+\overline{A_7}\overline{B_7}S_7) is 1
  • (D)
    (A0B0S0‾+A0‾B0‾S0)(A_0B_0\overline{S_0}+\overline{A_0}\overline{B_0}S_0) is 1

Answer (official key): C

Worked solution: in your report after you take this paper.

Q27 · Linear Algebra · MCQ · 1 mark

Let c1,…,cnc_1,\ldots,c_n be scalars, not all zero, such that

∑i=1nciai=0\sum_{i=1}^{n}c_i a_i = 0

where aia_i are column vectors in Rn\mathbb{R}^n.

Consider the set of linear equations

Ax=bAx=b

where

A=[a1,…,an]A=[a_1,\ldots,a_n]

and

b=∑i=1nai.b=\sum_{i=1}^{n}a_i.

The set of equations has:

  • (A)
    a unique solution at x=Jnx=J_n, where JnJ_n denotes an nn-dimensional vector of all 1
  • (B)
    no solution
  • (C)
    infinitely many solutions
  • (D)
    finitely many solutions

Answer (official key): C

Worked solution: in your report after you take this paper.

Q28 · Programming and Data Structures · MCQ · 1 mark

Consider the C code fragment given below.

typedef struct node {
    int data;
    node* next;
} node;

void join(node* m, node* n) {
    node* p = n;
    while (p->next != NULL) {
        p = p->next;
    }
    p->next = m;
}

Assuming that mm and nn point to valid NULL-terminated linked lists, invocation of join will:

  • (A)
    append list mm to the end of list nn for all inputs.
  • (B)
    either cause a null pointer dereference or append list mm to the end of list nn.
  • (C)
    cause a null pointer dereference for all inputs.
  • (D)
    append list nn to the end of list mm for all inputs.

Answer (official key): B

Worked solution: in your report after you take this paper.

Q29 · Programming and Data Structures · MCQ · 1 mark

Consider the following C code:

#include <stdio.h>

int *assignval(int *x, int val) {
    *x = val;
    return x;
}

void main() {
    int *x = malloc(sizeof(int));
    if (NULL == x) return;
    x = assignval(x, 0);
    if (x) {
        x = (int *) malloc(sizeof(int));
        if (NULL == x) return;
        x = assignval(x, 10);
    }
    printf("%d\n", *x);
    free(x);
}

The code suffers from which one of the following problems?

  • (A)
    compiler error as the return of malloc is not typecast appropriately
  • (B)
    compiler error because the comparison should be made as x == NULL and not as shown
  • (C)
    compiles successfully but execution may result in dangling pointer
  • (D)
    compiles successfully but execution may result in memory leak

Answer (official key): D

Worked solution: in your report after you take this paper.

Q30 · Discrete Mathematics · MCQ · 1 mark

Consider the first-order logic sentence

F:∀x(∃yR(x,y)).F:\forall x(\exists yR(x,y)).

Assuming non-empty logical domains, which of the sentences below are implied by FF?

I. ∃y(∃xR(x,y))\exists y(\exists xR(x,y))

II. ∃y(∀xR(x,y))\exists y(\forall xR(x,y))

III. ∀y(∃xR(x,y))\forall y(\exists xR(x,y))

IV. ¬∃x(∀y¬R(x,y))\neg\exists x(\forall y\neg R(x,y))

  • (A)
    IV only
  • (B)
    I and IV only
  • (C)
    II only
  • (D)
    II and III only

Answer (official key): B

Worked solution: in your report after you take this paper.

Q31 · Operating System · Numerical · 1 mark

Consider the following CPU processes with arrival times and length of CPU bursts as given below:

ProcessArrival timeBurst
P107
P233
P355
P462

If the pre-emptive shortest remaining time first scheduling algorithm is used to schedule the processes, then the average waiting time across all processes is __________ milliseconds.

Answer (official key): 3

Worked solution: in your report after you take this paper.

Q32 · Compiler Design · MCQ · 1 mark

Consider the following grammar:

P→xQRSP \to xQRS Q→yz∣ϵQ \to yz \mid \epsilon R→w∣ϵR \to w \mid \epsilon S→vS \to v

What is FOLLOW(Q)(Q)?

  • (A)
    {R}\{R\}
  • (B)
    {w}\{w\}
  • (C)
    {w,v}\{w,v\}
  • (D)
    \{w,\}$

Answer (official key): C

Worked solution: in your report after you take this paper.

Q33 · Programming and Data Structures · MCQ · 1 mark

Let TT be a binary search tree with 15 nodes. The minimum and maximum possible heights of TT are:

Note: The height of a tree with a single node is 0.

  • (A)
    4 and 15 respectively
  • (B)
    3 and 14 respectively
  • (C)
    4 and 14 respectively
  • (D)
    3 and 15 respectively

Answer (official key): B

Worked solution: in your report after you take this paper.

Q34 · Computer Organization and Architecture · Numerical · 1 mark

Consider a two-level cache hierarchy with L1 and L2 caches. An application incurs 1.4 memory accesses per instruction on average.

For this application, the miss rate of L1 cache is 0.1. The L2 cache experiences, on average, 7 misses per 1000 instructions.

The miss rate of L2 expressed correct to two decimal places is __________.

Answer (official key): 0.05

Worked solution: in your report after you take this paper.

Q35 · Computer Networks · MCQ · 1 mark

Consider a TCP client and a TCP server running on two different machines. After completing data transfer, the TCP client calls close to terminate the connection and a FIN segment is sent to the TCP server. Server-side TCP responds by sending an ACK, which is received by the client-side TCP.

As per the TCP connection state diagram, in which state does the client-side TCP connection wait for the FIN from the server-side TCP?

  • (A)
    LAST-ACK
  • (B)
    TIME-WAIT
  • (C)
    FIN-WAIT-1
  • (D)
    FIN-WAIT-2

Answer (official key): D

Worked solution: in your report after you take this paper.

Q36 · Theory of Computation · MCQ · 2 marks

Consider the context-free grammars over the alphabet {a,b,c}\{a,b,c\} given below. SS and TT are non-terminals.

G1: S→aSb∣T,T→cT∣ϵG_1:\ S\to aSb \mid T,\quad T\to cT \mid \epsilon G2: S→bSa∣T,T→cT∣ϵG_2:\ S\to bSa \mid T,\quad T\to cT \mid \epsilon

The language L(G1)∩L(G2)L(G_1)\cap L(G_2) is:

  • (A)
    Finite.
  • (B)
    Not finite but regular.
  • (C)
    Context-Free but not regular.
  • (D)
    Recursive but not context-free.

Answer (official key): B

Worked solution: in your report after you take this paper.

Q37 · Calculus · MCQ · 2 marks

The value of

lim⁡x→1x7−2x5+1x3−3x2+2\lim_{x\to 1}\frac{x^7-2x^5+1}{x^3-3x^2+2}
  • (A)
    is 0
  • (B)
    is -1
  • (C)
    is 1
  • (D)
    does not exist

Answer (official key): C

Worked solution: in your report after you take this paper.

Q38 · Computer Networks · MCQ · 2 marks

A computer network uses polynomials over GF(2)GF(2) for error checking with 8 bits as information bits and uses

x3+x+1x^3+x+1

as the generator polynomial to generate the check bits.

In this network, the message 01011011 is transmitted as:

  • (A)
    01011011010
  • (B)
    01011011011
  • (C)
    01011011101
  • (D)
    01011011100

Answer (official key): C

Worked solution: in your report after you take this paper.

Q39 · Linear Algebra · MCQ · 2 marks

Let uu and vv be two vectors in R2\mathbb{R}^2 whose Euclidean norms satisfy

∥u∥=2∥v∥.\lVert u\rVert = 2\lVert v\rVert.

What is the value of α\alpha such that

w=u+αvw = u + \alpha v

bisects the angle between uu and vv?

  • (A)
    2
  • (B)
    1/21/2
  • (C)
    1
  • (D)
    −1/2-1/2

Answer (official key): A

Worked solution: in your report after you take this paper.

Q40 · Programming and Data Structures · MCQ · 2 marks

Consider the C functions foo and bar given below:

int foo(int val) {
    int x = 0;
    while (val > 0) {
        x = x + foo(val--);
    }
    return val;
}

int bar(int val) {
    int x = 0;
    while (val > 0) {
        x = x + bar(val - 1);
    }
    return val;
}

Invocations of foo(3) and bar(3) will result in:

  • (A)
    Return of 6 and 6 respectively.
  • (B)
    Infinite loop and abnormal termination respectively.
  • (C)
    Abnormal termination and infinite loop respectively.
  • (D)
    Both terminating abnormally.

Answer (official key): C

Worked solution: in your report after you take this paper.

Q41 · Databases · MCQ · 2 marks

Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that DeptId can be permitted to be NULL in the relation EMP.

Consider the following queries on the database expressed in tuple relational calculus.

I. {t∣∃u∈EMP(t[EmpName]=u[EmpName]∧∀v∈DEPT(t[DeptId]≠v[DeptId]))}\{t\mid \exists u\in EMP(t[EmpName]=u[EmpName]\wedge \forall v\in DEPT(t[DeptId]\ne v[DeptId]))\}

II. {t∣∃u∈EMP(t[EmpName]=u[EmpName])∧∃v∈DEPT(t[DeptId]=v[DeptId])}\{t\mid \exists u\in EMP(t[EmpName]=u[EmpName])\wedge \exists v\in DEPT(t[DeptId]=v[DeptId])\}

III. {t∣∃u∈EMP(t[EmpName]=u[EmpName])∧∃v∈DEPT(t[DeptId]≠v[DeptId])}\{t\mid \exists u\in EMP(t[EmpName]=u[EmpName])\wedge \exists v\in DEPT(t[DeptId]\ne v[DeptId])\}

Which of the above queries are safe?

  • (A)
    I and II only
  • (B)
    I and III only
  • (C)
    II and III only
  • (D)
    I, II and III

Answer (official key): D

Worked solution: in your report after you take this paper.

Q42 · Operating System · MCQ · 2 marks

A multithreaded program PP executes with xx number of threads and uses yy number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-reentrant, i.e., if a thread holds a lock ll, then it cannot re-acquire lock ll without releasing it. If a thread is unable to acquire a lock, it blocks until the lock becomes available.

The minimum value of xx and the minimum value of yy together for which execution of PP can result in a deadlock are:

  • (A)
    x=1, y=2x=1,\ y=2
  • (B)
    x=2, y=1x=2,\ y=1
  • (C)
    x=2, y=2x=2,\ y=2
  • (D)
    x=1, y=1x=1,\ y=1

Answer (official key): D

Worked solution: in your report after you take this paper.

Q43 · Discrete Mathematics · MCQ · 2 marks

Let pp, qq, and rr be propositions and the expression (p→q)→r(p\to q)\to r be a contradiction. Then, the expression (r→p)→q(r\to p)\to q is:

  • (A)
    a tautology.
  • (B)
    a contradiction.
  • (C)
    always TRUE when pp is FALSE.
  • (D)
    always TRUE when qq is TRUE.

Answer (official key): D

Worked solution: in your report after you take this paper.

Q44 · Theory of Computation · MCQ · 2 marks

If GG is a grammar with productions

S→SaS∣aSb∣bSa∣SS∣ϵS\to SaS \mid aSb \mid bSa \mid SS \mid \epsilon

where SS is the start variable, then which one of the following strings is not generated by GG?

  • (A)
    abab
  • (B)
    aaab
  • (C)
    abbaa
  • (D)
    babba

Answer (official key): D

Worked solution: in your report after you take this paper.

Q45 · Databases · MCQ · 2 marks

In a database system, unique timestamps are assigned to each transaction using Lamport's logical clock. Let TS(T1)TS(T_1) and TS(T2)TS(T_2) be the timestamps of transactions T1T_1 and T2T_2 respectively.

T1T_1 holds a lock on the resource RR, and T2T_2 has requested a conflicting lock on the same resource RR.

The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.

if TS(T2) < TS(T1) then
    T1 is killed
else
    T2 waits

Assume any transaction that is not killed terminates eventually.

Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?

  • (A)
    The database system is both deadlock-free and starvation-free.
  • (B)
    The database system is deadlock-free, but not starvation-free.
  • (C)
    The database system is starvation-free, but not deadlock-free.
  • (D)
    The database system is neither deadlock-free nor starvation-free.

Answer (official key): A

Worked solution: in your report after you take this paper.

Q46 · Programming and Data Structures · MCQ · 2 marks

Consider the following two functions.

void fun1(int n) {
    if (n == 0) return;
    printf("%d", n);
    fun2(n - 2);
    printf("%d", n);
}

void fun2(int n) {
    if (n == 0) return;
    printf("%d", n);
    fun1(++n);
    printf("%d", n);
}

The output printed when fun1(5) is called is:

  • (A)
    53423122233445
  • (B)
    53423120112233
  • (C)
    53423122132435
  • (D)
    53423120213243

Answer (official key): A

Worked solution: in your report after you take this paper.

Q47 · Digital Logic · MCQ · 2 marks

Consider a combination of T and D flip-flops connected as shown below. The output of the D flip-flop is connected to the input of the T flip-flop and the output of the T flip-flop is connected to the input of the D flip-flop.

T and D flip-flop circuit for Q33

Initially, both Q0Q_0 and Q1Q_1 are set to 1 before the 1st clock cycle. The outputs are:

  • (A)
    Q1Q0Q_1Q_0 after the 3rd cycle are 11 and after the 4th cycle are 00 respectively
  • (B)
    Q1Q0Q_1Q_0 after the 3rd cycle are 11 and after the 4th cycle are 01 respectively
  • (C)
    Q1Q0Q_1Q_0 after the 3rd cycle are 00 and after the 4th cycle are 11 respectively
  • (D)
    Q1Q0Q_1Q_0 after the 3rd cycle are 01 and after the 4th cycle are 01 respectively

Answer (official key): B

Worked solution: in your report after you take this paper.

Q48 · Operating System · MCQ · 2 marks

Recall that Belady's anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements:

S1: Random page replacement algorithm, where a page chosen at random is replaced, suffers from Belady's anomaly.

S2: LRU page replacement algorithm suffers from Belady's anomaly.

Which of the following is CORRECT?

  • (A)
    S1 is true, S2 is true
  • (B)
    S1 is true, S2 is false
  • (C)
    S1 is false, S2 is true
  • (D)
    S1 is false, S2 is false

Answer (official key): B

Worked solution: in your report after you take this paper.

Q49 · Theory of Computation · MCQ · 2 marks

Let AA and BB be finite alphabets and let # be a symbol outside both AA and BB. Let ff be a total function from A∗A^* to B∗B^*. We say ff is computable if there exists a Turing machine MM which, given an input xx in A∗A^*, always halts with f(x)f(x) on its tape.

Let LfL_f denote the language

{x#f(x)∣x∈A∗}.\{x\#f(x)\mid x\in A^*\}.

Which of the following statements is true?

  • (A)
    ff is computable if and only if LfL_f is recursive.
  • (B)
    ff is computable if and only if LfL_f is recursively enumerable.
  • (C)
    If ff is computable then LfL_f is recursive, but not conversely.
  • (D)
    If ff is computable then LfL_f is recursively enumerable, but not conversely.

Answer (official key): A

Worked solution: in your report after you take this paper.

Q50 · Linear Algebra · MCQ · 2 marks

Let AA be an n×nn\times n real-valued square symmetric matrix of rank 2 with

∑i=1n∑j=1nAij2=50.\sum_{i=1}^{n}\sum_{j=1}^{n}A_{ij}^{2}=50.

Consider the following statements.

I. One eigenvalue must be in [−5,5][-5,5]

II. The eigenvalue with the largest magnitude must be strictly greater than 5

Which of the above statements about eigenvalues of AA is/are necessarily CORRECT?

  • (A)
    Both I and II
  • (B)
    I only
  • (C)
    II only
  • (D)
    Neither I nor II

Answer (official key): B

Worked solution: in your report after you take this paper.

Q51 · Theory of Computation · MCQ · 2 marks

Consider the following languages over the alphabet Σ={a,b,c}\Sigma=\{a,b,c\}.

L1={anbncm∣m,n≥0}L_1=\{a^n b^n c^m\mid m,n\ge0\}

and

L2={ambncn∣m,n≥0}.L_2=\{a^m b^n c^n\mid m,n\ge0\}.

Which of the following are context-free languages?

I. L1∪L2L_1\cup L_2

II. L1∩L2L_1\cap L_2

  • (A)
    I only
  • (B)
    II only
  • (C)
    I and II
  • (D)
    Neither I nor II

Answer (official key): A

Worked solution: in your report after you take this paper.

Q52 · Algorithms · MCQ · 2 marks

Let G=(V,E)G=(V,E) be any connected undirected edge-weighted graph. The weights of the edges in EE are positive and distinct. Consider the following statements:

I. Minimum Spanning Tree of GG is always unique.

II. Shortest path between any two vertices of GG is always unique.

Which of the above statements is/are necessarily true?

  • (A)
    I only
  • (B)
    II only
  • (C)
    both I and II
  • (D)
    neither I nor II

Answer (official key): A

Worked solution: in your report after you take this paper.

Q53 · Databases · Numerical · 2 marks

Consider a database table COURSES_REGISTERED with schema:

CR(StudentName, CourseName)

The instance of CR is given below:

StudentNameCourseName
SACA
SACB
SACC
SBCB
SBCC
SCCA
SCCB
SCCC
SDCA
SDCB
SDCC
SDCD
SECD
SECA
SECB
SFCA
SFCB
SFCC

Consider the following relational algebra query:

T1←ΠCourseName(σStudentName=′SA′(CR))T1 \leftarrow \Pi_{CourseName}(\sigma_{StudentName='SA'}(CR)) T2←CR÷T1T2 \leftarrow CR \div T1

The number of rows in T2T2 is __________.

Answer (official key): 4

Worked solution: in your report after you take this paper.

Q54 · Compiler Design · Numerical · 2 marks

Consider the following grammar:

stmt   -> if expr then expr else expr; stmt | ε
expr   -> term relop term | term
term   -> id | number
id     -> a | b | c
number -> [0-9]

where relop is a relational operator, for example <, >, and so on, ε refers to the empty statement, and if, then, else are terminals.

Consider a program PP following the above grammar containing ten if terminals. The number of control flow paths in PP is __________.

For example, the program

if e1 then e2 else e3

has 2 control flow paths:

e1 -> e2
e1 -> e3

Answer (official key): 1024

Worked solution: in your report after you take this paper.

Q55 · Computer Networks · Numerical · 2 marks

In an RSA cryptosystem, a participant AA uses two prime numbers

p=13p=13

and

q=17q=17

to generate her public and private keys. If the public key of AA is 35, then the private key of AA is __________.

Answer (official key): 11

Worked solution: in your report after you take this paper.

Q56 · Programming and Data Structures · Numerical · 2 marks

Consider the following C program:

#include <stdio.h>
#include <string.h>

void printlength(char *s, char *t) {
    unsigned int c = 0;
    int len = ((strlen(s) - strlen(t)) > c) ? strlen(s) : strlen(t);
    printf("%d\n", len);
}

void main() {
    char *x = "abc";
    char *y = "defgh";
    printlength(x, y);
}

Recall that strlen is defined in string.h as returning a value of type size_t, which is an unsigned integer type.

The output of the program is __________.

Answer (official key): 3

Worked solution: in your report after you take this paper.

Q57 · Computer Organization and Architecture · Numerical · 2 marks

Instruction execution in a processor is divided into 5 stages:

  1. Instruction Fetch (IF)
  2. Instruction Decode (ID)
  3. Operand Fetch (OF)
  4. Execute (EX)
  5. Write Back (WB)

These stages take 5 ns, 4 ns, 20 ns, 10 ns, and 3 ns respectively.

A pipelined implementation of the processor requires buffering between each pair of consecutive stages with a delay of 2 ns.

Two pipelined implementations of the processor are contemplated:

  1. A naive pipeline implementation (NP) with 5 stages.
  2. An efficient pipeline implementation (EP), where the OF stage is divided into stages OF1 and OF2 with execution times of 12 ns and 8 ns respectively.

The speedup, correct to two decimal places, achieved by EP over NP in executing 20 independent instructions with no hazards is __________.

Answer (official key): 1.49 to 1.52

Worked solution: in your report after you take this paper.

Q58 · Computer Organization and Architecture · Numerical · 2 marks

Consider a RISC machine where each instruction is exactly 4 bytes long. Conditional and unconditional branch instructions use PC-relative addressing mode with Offset specified in bytes to the target location of the branch instruction.

Further, the Offset is always with respect to the address of the next instruction in the program sequence.

Consider the following instruction sequence:

i:     add R2, R3, R4
i+1:   sub R5, R6, R7
i+2:   cmp R1, R9, R10
i+3:   beq R1, Offset

If the target of the branch instruction is instruction ii, then the decimal value of Offset is __________.

Answer (official key): -16

Worked solution: in your report after you take this paper.

Q59 · Computer Networks · Numerical · 2 marks

The values of parameters for the Stop-and-Wait ARQ protocol are as given below:

ParameterValue
Bit rate of the transmission channel1 Mbps
Propagation delay from sender to receiver0.75 ms
Time to process a frame0.25 ms
Number of bytes in the information frame1980
Number of bytes in the acknowledgement frame20
Number of overhead bytes in the information frame20

Assume that there are no transmission errors.

The transmission efficiency, expressed in percentage and correct to 2 decimal places, of the Stop-and-Wait ARQ protocol for the above parameters is __________.

Answer (official key): 86.5 to 89.5

Worked solution: in your report after you take this paper.

Q60 · Discrete Mathematics · Numerical · 2 marks

The number of integers between 1 and 500, both inclusive, that are divisible by 3 or 5 or 7 is __________.

Answer (official key): 271

Worked solution: in your report after you take this paper.

Q61 · Programming and Data Structures · Numerical · 2 marks

The output of executing the following C program is __________.

#include <stdio.h>

int total(int v) {
    static int count = 0;
    while (v) {
        count += v & 1;
        v >>= 1;
    }
    return count;
}

void main() {
    static int x = 0;
    int i = 5;
    for (; i > 0; i--) {
        x = x + total(i);
    }
    printf("%d\n", x);
}

Answer (official key): 23

Read the worked solution

Q62 · Computer Organization and Architecture · Numerical · 2 marks

A cache memory unit with capacity of NN words and block size of BB words is to be designed.

If it is designed as a direct-mapped cache, the length of the TAG field is 10 bits.

If the cache unit is now designed as a 16-way set-associative cache, the length of the TAG field is __________ bits.

Answer (official key): 14

Read the worked solution

Q63 · Algorithms · Numerical · 2 marks

Let AA be an array of 31 numbers consisting of a sequence of 0's followed by a sequence of 1's.

The problem is to find the smallest index ii such that A[i]A[i] is 1 by probing the minimum number of locations in AA.

The worst-case number of probes performed by an optimal algorithm is __________.

Answer (official key): 5

Worked solution: in your report after you take this paper.

Q64 · Compiler Design · Numerical · 2 marks

Consider the expression:

(a−1)×((b+c3)+d)(a-1) \times \left(\left(\frac{b+c}{3}\right)+d\right)

Let XX be the minimum number of registers required by an optimal code generation algorithm, without any register spill, for a load/store architecture in which:

  1. only load and store instructions can have memory operands, and
  2. arithmetic instructions can have only register or immediate operands.

The value of XX is __________.

Answer (official key): 2

Worked solution: in your report after you take this paper.

Q65 · Computer Organization and Architecture · Numerical · 2 marks

Consider a 2-way set associative cache with 256 blocks and LRU replacement. Initially the cache is empty.

Conflict misses are those misses which occur due to contention of multiple blocks for the same cache set. Compulsory misses occur due to first-time access to the block.

The following sequence of accesses to memory blocks:

(0, 128, 256, 128, 0, 128, 256, 128, 1, 129, 257, 129, 1, 129, 257, 129)

is repeated 10 times.

The number of conflict misses experienced by the cache is __________.

Answer (official key): 76

Worked solution: in your report after you take this paper.