GATE Computer Science & IT 2017 — GATE 2017 · CS · Set 1

CS Set 1 · 65 of 65 questions publicly available

Sections: General Aptitude, Computer Science & IT

Subject marks
Subject1 mark questions2 mark questionsTotal marks
General Aptitude5515
Computer Science253085

Question 1 · 1 mark Q3050

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

I.    p⇒qp \Rightarrow q

II.    q⇒pq \Rightarrow p

III.    (¬q)∨p\left ( ¬q \right ) \vee p

IV. (¬p)∨q\left ( ¬p \right ) \vee q

  1. A.

    I only

  2. B.

    I and IV only

  3. C.

    II only

  4. D.

    II and III only

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

Solutions and video are in the course

Question 2 · 1 mark Q3051

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))¬\exists x(\forall y¬R(x,y))

  1. A.

    IV only

  2. B.

    I and IV only

  3. C.

    II only

  4. D.

    II and III only

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 3 · 1 mark Q3052

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=\left [ a_{1}.....a_{n} \right ] and b=∑i=1naib=\sum_{i=1}^{n}a_{i}. The set of equations has

  1. A.

    a unique solution at x=Jnx=J_{n} where JnJ_{n} denotes a nn-dimensional vector of all 1.

  2. B.

    no solution

  3. C.

    infinitely many solutions

  4. D.

    finitely many solutions

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

Solutions and video are in the course

Question 4 · 1 mark Q3053

Consider the following functions from positive integers to real numbers:

10,n, n, log2 n,100n10, \sqrt n, \ n ,\ log_2 \ n, \frac {100} {n}

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

  1. A.

    log2 n,100n,10,n,nlog_2 \ n ,\frac {100} n, 10 ,\sqrt n, n

  2. B.

    100n,10,log2 n,n,n\frac {100} n ,10, log_2 \ n, \sqrt n, n

  3. C.

    10,100n,n,log2 n,n10, \frac {100} n ,\sqrt n, log_2 \ n , n

  4. D.

    ​​100n,log2 n,10,n,n​​\frac {100} n, log_2 \ n, 10 , \sqrt n , n

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 5 · 1 mark Q3054

Consider the following table:

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.

  1. A.

    (P)↔(ii),(Q)↔(iii),(R)↔(i)(P) \leftrightarrow (ii), (Q) \leftrightarrow (iii), (R) \leftrightarrow (i)

  2. B.

    (P)↔(iii),(Q)↔(i),(R)↔(ii)(P) \leftrightarrow (iii), (Q) \leftrightarrow (i), (R) \leftrightarrow (ii)

  3. C.

    (P)↔(ii),(Q)↔(i),(R)↔(iii)(P) \leftrightarrow (ii), (Q) \leftrightarrow (i), (R) \leftrightarrow (iii)

  4. D.

    (P)↔(i),(Q)↔(ii),(R)↔(iii)(P) \leftrightarrow (i), (Q) \leftrightarrow (ii), (R) \leftrightarrow (iii)

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

Solutions and video are in the course

Question 6 · 2 marks Q3055

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

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

  1. A.

    4 and 15 respectively.

  2. B.

    3 and 14 respectively.

  3. C.

    4 and 14 respectively.

  4. D.

    3 and 15 respectively.

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 7 · 2 marks Q3056

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

  1. A.

    2−fto 2i2^{-f} to \ 2^i

  2. B.

    2−fto (2i−2−f)2^{-f} to \ \left ( 2^{i} - 2^{-f} \right )

  3. C.

    0 to 2i2^i

  4. D.

    0 to (2i−2−f)0 \ to \ \left ( 2^{i} - 2^{-f} \right )

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

Solutions and video are in the course

Question 8 · 2 marks Q3057

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 m and n point to valid NULL-terminated linked lists, invocation of join will

  1. A.

    append list m to the end of list n for all inputs.

  2. B.

    either cause a null pointer dereference or append list m to the end of list n.

  3. C.

    cause a null pointer dereference for all inputs.

  4. D.

    append list n to the end of list m for all inputs.

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 9 · 2 marks Q3058

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

  1. A.

    the carry bit C7C_{7} is 1

  2. B.

    all the carry bits (C7,⋯ ,C0)\left ( C_{7},\cdots ,C_{0} \right ) are 1

  3. C.

    (A7⋅B7⋅S7‾+A7‾⋅B7‾⋅S7)\left ( A_{7} \cdot B_{7} \cdot \overline{S_{7}}+\overline{A_{7}} \cdot \overline{B_{7}} \cdot S_{7} \right ) is 1 

  4. D.

    (A0⋅B0⋅S0‾+A0‾⋅B0‾⋅S0)\left ( A_{0} \cdot B_{0} \cdot \overline{S_{0}}+\overline{A_{0}} \cdot \overline{B_{0}} \cdot S_{0} \right ) is 1 

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

Solutions and video are in the course

Question 10 · 2 marks Q3059

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 \rightarrow abScT \mid abcT

T→bT∣bT \rightarrow bT \mid b

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

  1. A.

    {(ab)n(cb)n∣n≥1}\{\left ( ab \right )^{n}\left ( cb \right )^{n} \mid n \geq 1 \}

  2. B.

    {(ab)ncbm1cbm2...cbmn∣n,m1,m2,...,mn≥1}\{\left ( ab \right )^{n}cb^{m_{1}}cb^{m_{2}}...cb^{m_{n}} \mid n, m_{1}, m_{2}, ..., m_{n} \geq 1 \}

  3. C.

    {(ab)n(cbm)n∣m,n≥1}\{\left ( ab \right )^{n}\left ( cb^{m} \right )^{n} \mid m,n \geq 1 \}

  4. D.

    {(ab)n(cbn)m∣m,n≥1}\{\left ( ab \right )^{n}\left ( cb^{n} \right )^{m} \mid m,n \geq 1 \}

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 11 · 1 mark Q3060

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:

  1. A.

    Post-increment addressing mode, (R1)+

  2. B.

    Pre-decrement addressing mode, -(R1)

  3. C.

    Register direct addressing mode, R1

  4. D.
    1. Index addressing mode, X(R1), where X is an offset represented in 2′s complement 16-bit representation

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

Solutions and video are in the course

Question 12 · 1 mark Q3061

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?

  1. A.

    p1 = a - b

    q1 = p1 * c

    p1 = u * v

    q1 = p1 + q1

  2. B.

    p3 = a - b
    q4 = p3 * c
    p4 = u * v
    q5 = p4 + q4

  3. C.

    p1 = a - b
    q1 = p2 * c
    p3 = u * v
    q2 = p4 + q3

  4. D.

    p1 = a - b
    q1 = p * c
    p2 = u * v
    q2 = p + q

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 13 · 1 mark Q3062

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:

  1. A.

    compiler error as the return of malloc is not typecast appropriately.

  2. B.

    compiler error because the comparison should be made as x == NULL and not as shown.

  3. C.

    compiles successfully but execution may result in dangling pointer.

  4. D.

    compiles successfully but execution may result in memory leak.

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

Solutions and video are in the course

Question 14 · 1 mark Q3063

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 (RFC 793), in which state does the client-side TCP connection wait for the FIN from the server-side TCP?

  1. A.

    LAST-ACK

  2. B.

    TIME-WAIT

  3. C.

    FIN-WAIT-1

  4. D.

    FIN-WAIT-2

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

Solutions and video are in the course

Question 15 · 1 mark Q3064

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) AA third party attacker can launch a 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?

  1. A.

    I and II only

  2. B.

    I only

  3. C.

    II only

  4. D.

    II and III only

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 16 · 1 mark Q2044

The following functional dependencies hold true for the relational schema {V, W, X, Y, Z}:
V → W
VW → X
Y → VX
Y → Z
Which of the following is irreducible equivalent for this set of functional dependencies?

  1. A. image.png

  2. B. image.png

  3. C. image.png

  4. D. image.png

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): A

Solutions and video are in the course

Question 17 · 1 mark Q3066

Consider the following grammar:

p → xQRS

Q → yz | z

R → w | ε

S → y

What is FOLLOW(QQ)?

  1. A.

    {R}\left \{ R \right \}

  2. B.

    {w}\left \{ w \right \}

  3. C.

    {w,y}\left \{ w,y \right \}

  4. D.

    {w,$}

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

Solutions and video are in the course

Question 18 · 1 mark Q1835

Threads of a process share

  1. A.

    global variables but not heap

  2. B.

    heap but not global variables

  3. C.

    neither global variables nor heap

  4. D.

    both heap and global variables

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

Solutions and video are in the course

Question 19 · 1 mark Q3068

Let XX be a Gaussian random variable with mean 0 and variance σ2\sigma ^{2}. Let YY = max(XX,0) where max(a,ba,b) is the maximum of aa and bb. The median of YY is ______________ .

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 0

Solutions and video are in the course

Question 20 · 1 mark Q3069

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

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 18

Solutions and video are in the course

Question 21 · 1 mark Q3070

Consider the Karnaugh map given below, where XX represents "don't care" and blank represents 0.

Assume for all inputs (a,b,c,d)\left ( a,b,c,d \right ), the respective complements (aˉ,bˉ,cˉ,dˉ)\left ( \bar{a}, \bar{b}, \bar{c}, \bar{d} \right ) are also available. The above logic is implemented using 2-input NOR gates only. The minimum number of gates required is ____________ .

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 1 gates

Solutions and video are in the course

Question 22 · 1 mark Q3071

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

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 4

Solutions and video are in the course

Question 23 · 1 mark Q3072

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

image.png

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

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 2.6

Solutions and video are in the course

Question 24 · 1 mark Q1876

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

Process

Arrival Time

Burst Time

P1

0

7

P2

3

3

P3

5

5

P4

6

2


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.

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 3 milliseconds

Solutions and video are in the course

Question 25 · 1 mark Q3074

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

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 0.05 fraction

Solutions and video are in the course

Question 26 · 1 mark Q3075

Let G=(V,E)G=\left ( V,E \right ) be anyany 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?

  1. A.

    I only

  2. B.

    II only

  3. C.

    both I and II

  4. D.

    neither I nor II

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): A

Solutions and video are in the course

Question 27 · 1 mark Q3076

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:

  1. A.

    x=1,y=2x = 1, y = 2

  2. B.

    x=2,y=1x = 2, y = 1

  3. C.

    x=2,y=2x = 2, y = 2

  4. D.

    x=1,y=1x = 1, y = 1

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

Solutions and video are in the course

Question 28 · 1 mark Q3077

The value of lim⁡x→1x7−2x5+1x3−3x2+2\displaystyle \lim_{x\rightarrow 1} \frac{x^{7}-2x^{5}+1}{x^{3}-3x^{2}+2}

  1. A.

    is 0

  2. B.

    is -1

  3. C.

    is 1

  4. D.

    does not exist

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

Solutions and video are in the course

Question 29 · 1 mark Q3078

Let p,qp, q and rr be propositions and the expression (p→q)→r\left ( p\rightarrow q \right )\rightarrow r be a contradiction. Then, the expression (r→p)→q\left ( r\rightarrow p \right )\rightarrow q is

  1. A.

    a tautology

  2. B.

    a contradiction

  3. C.

    always TRUE when pp is FALSE

  4. D.

    always TRUE when qq is TRUE

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

Solutions and video are in the course

Question 30 · 1 mark Q3079

Let uu and vv be two vectors in R2\mathbf{R}^{2} whose Euclidean norms satisfy ‖uu‖=2‖vv‖. What is the value of α\alpha such that w=u+αvw = u + \alpha v bisects the angle between uu and vv?

  1. A.

    2

  2. B.

    1/2

  3. C.

    1

  4. D.

    -1/2

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): A

Solutions and video are in the course

Question 31 · 1 mark Q3080

Let AA be 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^{2}_{ij} = 50.. Consider the following statements.

I.    One eigenvalue must be in [−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?

  1. A.

    Both I and II

  2. B.

    I only

  3. C.

    II only

  4. D.

    Neither I nor II

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 32 · 1 mark Q3081

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:

  1. A. 01011011010
  2. B. 01011011011
  3. C. 01011011101
  4. D. 01011011100
Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

Solutions and video are in the course

Question 33 · 1 mark Q3082

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.

Initially, both Q0 and Q1 are set to 1 (before the 1st clock cycle). The outputs

  1. A.

    Q1Q0 after the 3rd cycle are 11 and after the 4th cycle are 00 respectively.

  2. B.

    Q1Q0 after the 3rd cycle are 11 and after the 4th cycle are 01 respectively.

  3. C.

    Q1Q0 after the 3rd cycle are 00 and after the 4th cycle are 11 respectively.

  4. D.

    Q1Q0 after the 3rd cycle are 01 and after the 4th cycle are 01 respectively.

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 34 · 1 mark Q3083

If GG is a grammar with productions

S→SaS∣aSb∣bSa∣SS∣ϵS\rightarrow 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 ?

  1. A.

    abababab

  2. B.

    aaabaaab

  3. C.

    abbaaabbaa

  4. D.

    babbababba

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

Solutions and video are in the course

Question 35 · 1 mark Q3084

Consider the following two functions.    

The output printed when fun1(5) is called is

  1. A.

    53423122233445

  2. B.

    53423120112233

  3. C.

    53423122132435

  4. D.

    53423120213243

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): A

Solutions and video are in the course

Question 36 · 2 marks Q3085

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:

  1. A.

    Return of 6 and 6 respectively.

  2. B.

    Infinite loop and abnormal termination respectively.

  3. C.

    Abnormal termination and infinite loop respectively.

  4. D.

    Both terminating abnormally.

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

Solutions and video are in the course

Question 37 · 2 marks Q3086

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

G1:S→aSb∣T,T→cT∣ϵG_{1}:S\rightarrow aSb \mid T, T \rightarrow cT \mid \epsilon

G2:S→bSa∣T,T→cT∣ϵG_{2}:S\rightarrow bSa \mid T, T \rightarrow cT \mid \epsilon

The language L(G1)∩L(G2)L\left ( G_{1} \right )\cap L(G_{2}) is

  1. A.

    Finite

  2. B.

    Not finite but regular

  3. C.

    Context-Free but not regular

  4. D.

    Recursive but not context-free

Official answer key

Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

Solutions and video are in the course

Question 38 · 2 marks Q3087

Consider the following languages over the alphabet Σ={a,b,c}\Sigma = \left \{ a, b, c \right \}. Let L1={anbncm∣m,n≥0}L_{1} = \left \{ a^{n}b^{n}c^{m}\mid m,n \geq 0 \right \} and L2={ambncn∣m,n≥0}L_{2} = \left \{ a^{m}b^{n}c^{n}\mid m,n \geq 0 \right \}.

Which of the following are context-free languages?

I.    L1∪L2L_{1} \cup L_{2}

II.    L1∩L2L_{1} \cap L_{2}

    1. A.

      I only

    2. B.

      II only

    3. C.

      I and II

    4. D.

      Neither I nor II

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): A

    Solutions and video are in the course

    Question 39 · 2 marks Q3088

    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∈A∗A^*, always halts with f(x)f(x) on its tape. Let LfL_f denote the language {x#f(x)∣x∈A∗}\Bigl \{x\# f(x) \mid x\in A^{*} \Bigr \}. Which of the following statements is true:

    1. A.

      ff is computable if and only if LfL_f is recursive.

    2. B.

      ff is computable if and only if LfL_f is recursively enumerable.

    3. C.

      If ff is computable then LfL_f is recursive, but not conversely.

    4. D.

      If ff is computable then LfL_f is recursively enumerable, but not conversely.

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): A

    Solutions and video are in the course

    Question 40 · 2 marks Q1899

    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?

    1. A.

      S1 is true, S2 is true

    2. B.

      S1 is true, S2 is false

    3. C.

      S1 is false, S2 is true

    4. D.

      S1 is false, S2 is false

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

    Solutions and video are in the course

    Question 41 · 2 marks Q3090

    Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus.

    I.    {tt | ∃u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∀v ∈ DEPT(t[DeptId] ≠ v[DeptId]))}

    II.    {tt | ∃u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∃v ∈ DEPT(t[DeptId] ≠ v[DeptId]))}

    III.    {tt | ∃u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∃v ∈ DEPT(t[DeptId] = v[DeptId]))}

    Which of the above queries are safe?

    1. A.

      I and II only

    2. B.

      I and III only

    3. C.

      II and III only

    4. D.

      I, II and III

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

    Solutions and video are in the course

    Question 42 · 2 marks Q3091

    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. Besides, 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(T_2) < TS(T1)TS(T_1) then

    ​​T1​​T_1 is killed

                                          else ​​T2​​T_2 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?

    1. A.

      The database system is both deadlock-free and starvation-free.

    2. B.

      The database system is deadlock-free, but not starvation-free.

    3. C.

      The database system is starvation-free, but not deadlock-free.

    4. D.

      The database system is neither deadlock-free nor starvation-free.

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): A

    Solutions and video are in the course

    Question 43 · 2 marks Q3092

    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 (e.g., <,>,…), Ò 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 e1then e2else e3

    has 2 control flow paths. e1→e2 and e1→e3. 

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 1024

    Solutions and video are in the course

    Question 44 · 2 marks Q3093

    In a RSA cryptosystem, a participant A uses two prime numbers p = 13 and q = 17 to generate her public and private keys. If the public key of A is 35, then the private key of A is __________ .

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 11

    Solutions and video are in the course

    Question 45 · 2 marks Q3094

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

    • Bit rate of the transmission channel =1 Mbps.

    • Propagation delay from sender to receiver =0.75 ms.

    • Time to process a frame =0.25 ms.

    • Number of bytes in the information frame =1980.

    • Number of bytes in the acknowledge frame =20.

    • Number of overhead bytes in the information frame =20.


    Assume there are no transmission errors. Then, the transmission efficiency (expressed in percentage) of the Stop-and-Wait ARQ protocol for the above parameters is _____________ (correct to 2 decimal places).

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 86.5 to 89.5

    Solutions and video are in the course

    Question 46 · 2 marks Q3095

    Consider a database that has the relation schema CR(StudentName, CourseName). An instance of the schema CR is as given below.

    StudentNameCourseNameSACASACBSACCSBCBSBCCSCCASCCBSCCCSDCASDCBSDCCSDCDSECDSECASECBSFCASFCB SFCC\begin{array}{|c|c|} \hline \textbf{StudentName} & \textbf {CourseName} \\\hline \text {SA} & \text{CA} \\\hline \text{SA} & \text{CB}\\\hline \text{SA} & \text{CC} \\\hline \text{SB} & \text{CB} \\\hline \text{SB}& \text{CC} \\\hline \text{SC} & \text{CA}\\\hline \text{SC}&\text{CB} \\\hline \text{SC} & \text{CC} \\\hline \text {SD} & \text{CA} \\\hline \text{SD} & \text{CB}\\\hline \text{SD} & \text{CC} \\\hline \text{SD} & \text{CD} \\\hline \text{SE}& \text{CD} \\\hline \text{SE} & \text{CA}\\\hline \text{SE}&\text{CB} \\\hline \text{SF}& \text{CA} \\\hline \text{SF} & \text{CB }\\\hline\text{SF} & \text{CC} \\\hline \end{array}

    The following query is made on the database.

    T1←πCourseName(σStudentName=SA(CR))T1 \leftarrow \pi _{CourseName}\left ( \sigma _{StudentName=SA}\left ( CR \right ) \right )

    T2←CR÷T1T2 \leftarrow CR\div T1

    The number of rows in T2T2 is ______________ .

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 4

    Solutions and video are in the course

    Question 47 · 2 marks Q3096

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

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 271

    Solutions and video are in the course

    Question 48 · 2 marks Q3097

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

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 5 probes

    Solutions and video are in the course

    Question 49 · 2 marks Q3098

    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

    Instr. No.Instructioni:add R2, R3, R4i+1:sub R5, R6, R7i+2:cmp R1, R9, R10i+3:beq R1, Offset\begin{array}{ll} \text{Instr. No.} & \text{Instruction} \\\hline \text{i:} & \text{add R2, R3, R4} \\ \text{i+1:} & \text{sub R5, R6, R7} \\ \text{i+2:} & \text{cmp R1, R9, R10} \\ \text{i+3:} & \text{beq R1, Offset} \\ \end{array}

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

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): -16 bytes

    Solutions and video are in the course

    Question 50 · 2 marks Q3099

    Instruction execution in a processor is divided into 5 stages, Instruction Fetch (IF), Instruction Decode (ID), Operand fetch (OF), Execute (EX), and Write Back (WB). These stages take 5, 4, 20, 10 and 3 nanoseconds (ns) respectively. A pipelined implementation of the processor requires buffering between each pair of consecutive stages with a delay of 2 ns. Two pipelined implementation of the processor are contemplated:

    I.  a naive pipeline implementation (NP) with 5 stages and

    II. an efficient pipeline (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 _________ .

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 1.5 to 1.51

    Solutions and video are in the course

    Question 51 · 2 marks Q3100

    Consider a 2-way set associative cache with 256 blocks and uses LRU replacement. Initially the cache is empty. Conflict misses are those misses which occur due to the contention of multiple blocks for the same cache set. Compulsory misses occur due to first time access to the block. The following sequence of access 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 _________ .

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 76 misses

    Solutions and video are in the course

    Question 52 · 2 marks Q3101

    Consider the expression (a−1)∗(((b+c)/3)+d)(a-1) * (((b+c)/3)+d). Let XX be the minimum number of registers required by an optimal code generation (without any register spill) algorithm 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 _____________ .

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 2

    Solutions and video are in the course

    Question 53 · 2 marks Q3102

    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.ℎ as returning a value of type size_t, which is an unsigned int. The output of the program is __________ .

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 3

    Solutions and video are in the course

    Question 54 · 2 marks Q3103

    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.

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 14 bits

    Solutions and video are in the course

    Question 55 · 2 marks Q3104

    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);
    }

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): 23

    Solutions and video are in the course

    Question 56 · 2 marks Q3040

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

    1. A.

      was wishing

    2. B.

      is wishing

    3. C.

      wished

    4. D.

      had wished

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

    Solutions and video are in the course

    Question 57 · 2 marks Q3041

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

    1. A.

      money beside

    2. B.

      beside money

    3. C.

      money besides

    4. D.

      besides money

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

    Solutions and video are in the course

    Question 58 · 2 marks Q3042

    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?

    1. A.

      Rahul and Murali

    2. B.

      Srinivas and Arul

    3. C.

      Srinvas and Murali

    4. D.

      Srinivas and Rahul

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

    Solutions and video are in the course

    Question 59 · 2 marks Q3043

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

    1. A.

      24

    2. B.

      27

    3. C.

      32

    4. D.

      36

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

    Solutions and video are in the course

    Question 60 · 2 marks Q3044

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

    1. A.

      0.3k0.3^k

    2. B.

      0.6k0.6^k

    3. C.

      0.7k0.7^k

    4. D.

      0.9k0.9^k

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

    Solutions and video are in the course

    Question 61 · 2 marks Q3045

    "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?

    1. A.

      Nationalists are highly imaginative.

    2. B.

      History is viewed through the filter of nationalism.

    3. C.

      Our colonial past never happened.

    4. D.

      Nationalism has to be both adequately and properly imagined.

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

    Solutions and video are in the course

    Question 62 · 2 marks Q3046

    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

    1. A.

      2

    2. B.

      3

    3. C.

      4

    4. D.

      Cannot be determined

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): A

    Solutions and video are in the course

    Question 63 · 2 marks Q3047

    The expression (x+y)−∣x−y∣2\large \frac{(x+y) - |x-y|}{2} is equal to :

    1. A.

      The maximum of xx and yy

    2. B.

      The minimum of xx and yy

    3. C.

      1

    4. D.

      None of the above

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): B

    Solutions and video are in the course

    Question 64 · 2 marks Q3048

    Arun, Gulab, Neel and Shweta must choose one shirt each from a pile of four shirts coloured red, pink, blue and white respectively. Arun dislikes the colour red and Shweta dislikes the colour white. 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?

    1. A.

      21

    2. B.

      18

    3. C.

      16

    4. D.

      14

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): D

    Solutions and video are in the course

    Question 65 · 2 marks Q3049

    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 mm intervals in this plot. If in a flood, the water level rises to 525 mm, which of the villages P,Q,R,S,TP, Q, R, S, T get submerged?

    1. A.

      P,QP, Q

    2. B.

      P,Q,TP, Q, T

    3. C.

      R,S,TR, S, T

    4. D.

      Q,R,SQ, R, S

    Official answer key

    Official answer key (GATE Computer Science & IT 2017 GATE 2017 · CS · Set 1): C

    Solutions and video are in the course