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

CS Set 2 · 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 Q3115

The representation of the value of a 16-bit unsigned integer XX in hexadecimal number system is BCA9. The representation of the value of XX in octal number system is

  1. A.

    571244

  2. B.

    736251

  3. C.

    571247

  4. D.

    136251

Official answer key

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

Solutions and video are in the course

Question 2 · 1 mark Q3116

Match the following:

P.static char var ;i.Sequence of memory locations to store addressesQ.m = malloc(10); m =NULL ;ii.A variable located in data section of memoryR.char *ptr[10] ;iii.Request to allocate a CPU register to store dataS. register int varl;iv.A lost memory which cannot be freed\begin{array}{|ll|ll|}\hline P. & \text{static char var ;} & \text{i.} & \text{Sequence of memory locations to store addresses} \\\hline Q. & \text{m = malloc(10); m =NULL ;} & \text{ii.} & \text{A variable located in data section of memory} \\\hline R. & \text{char *ptr[10] ;} & \text{iii.} & \text{Request to allocate a CPU register to store data} \\\hline S. & \text{ register int varl;} & \text{iv.} & \text{A lost memory which cannot be freed} \\\hline\end{array}

  1. A.

    P-ii; Q-iv; R-i; S-iii

  2. B.

    P-ii; Q-i; R-iv; S-iii

  3. C.

    P-ii; Q-iv; R-iii; S-i

  4. D.

    P-iii; Q-iv; R-i; S-ii

Official answer key

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

Solutions and video are in the course

Question 3 · 1 mark Q3117

Match the algorithms with their time complexities:

g2017_3

  1. A.

    P→(iii)Q→(iv)r→(i)S→(ii)P\rightarrow (iii) \quad Q \rightarrow(iv) \quad r \rightarrow(i) \quad S \rightarrow(ii)

  2. B.

    P→(iv)Q→(iii)r→(i)S→(ii)P\rightarrow (iv) \quad Q \rightarrow(iii) \quad r \rightarrow(i) \quad S\rightarrow(ii)

  3. C.

    P→(iii)Q→(iv)r→(ii)S→(i)P\rightarrow (iii) \quad Q \rightarrow(iv) \quad r \rightarrow(ii) \quad S\rightarrow(i)

  4. D.

    P→(iv)Q→(iii)r→(ii)S→(i)P\rightarrow (iv) \quad Q \rightarrow(iii)\quad r \rightarrow(ii) \quad S\rightarrow(i)

Official answer key

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

Solutions and video are in the course

Question 4 · 1 mark Q3118

Let L1L_1, L2L_2 be any two context-free languages and RR be any regular language. Then which of the following is/are CORRECT?

I.    L1∪L2L_1 \cup L_2 is context-free

II.    L1‾\overline{L_1} is context-free

III.    L1−RL_1 - R is context-free

IV.    L1∩L2L_1 \cap L_2 is context-free

  1. A.

    I, II and IV only

  2. B.

    I and III only

  3. C.

    II and IV only

  4. D.

    I only

Official answer key

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

Solutions and video are in the course

Question 5 · 1 mark Q3119

Match the following according to input (from the left column) to the compiler phase (in the right column) that processes it:

P. Syntax treei. Code generatorQ. Character streamii. Syntax analyserR. Intermediate representationiii. Semantic analyserS. Token streamiv. Lexical analyser\begin{array}{|l|l|}\hline \text{P. Syntax tree} & \text{i. Code generator} \\\hline \text{Q. Character stream} & \text{ii. Syntax analyser} \\\hline \text{R. Intermediate representation} & \text{iii. Semantic analyser} \\\hline \text{S. Token stream} & \text{iv. Lexical analyser} \\\hline \end{array}

  1. A.

    P-ii; Q-iii; R-iv; S-i\text{P-ii; Q-iii; R-iv; S-i}

  2. B.

    P-ii; Q-i; R-iii; S-iv\text{P-ii; Q-i; R-iii; S-iv}

  3. C.

    P-iii; Q-iv; R-i; S-ii\text{P-iii; Q-iv; R-i; S-ii}

  4. D.

    P-i; Q-iv; R-ii; S-iii\text{P-i; Q-iv; R-ii; S-iii}

Official answer key

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

Solutions and video are in the course

Question 6 · 2 marks Q3120

Which of the following statements about parsers is/are CORRECT?

I. Canonical LR (CLR) is more powerful than SLR.

II. SLR is more powerful than LALR.

III. SLR is more powerful than Canonical LR (CLR).

  1. A.

    I only

  2. B.

    II only

  3. C.

    III only

  4. D.

    II and III only

Official answer key

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

Solutions and video are in the course

Question 7 · 2 marks Q3121

Which of the following is/are shared by all the threads in a process?

I.    Program counter

II.    Stack

III.    Address space

IV.    Registers

  1. A.

    (I) and (II) only

  2. B.

    (III) only

  3. C.

    (IV) only

  4. D.

    (III) and (IV) only

Official answer key

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

Solutions and video are in the course

Question 8 · 2 marks Q1861

In a file allocation system, which of the following allocation scheme(s) can be used if no external fragmentation is allowed?
I. Contiguous II. Linked III. Indexed

  1. A.

    I and III only

  2. B.

    II only

  3. C.

    III only

  4. D.

    II and III only

Official answer key

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

Solutions and video are in the course

Question 9 · 2 marks Q3123

Consider the following statements about the routing protocols. Routing Information Protocol (RIP) and Open Shortest Path First (OSPF) in an IPv4 network.

I.    RIP uses distance vector routing

II.   RIP packets are sent using UDP

III.  OSPF packets are sent using TCP

IV.  OSPF operation is based on link-state routing

Which of the above statements are CORRECT?

  1. A.

    I and IV only

  2. B.

    I, II and III only

  3. C.

    I, II and IV only

  4. D.

    II, III and IV only

Official answer key

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

Solutions and video are in the course

Question 10 · 2 marks Q3124

If f(x)=R sin⁡(πx2)+S,f’(12)=2f(x) = R \: \sin ( \frac{\pi x}{2}) + S, f’\left(\frac{1}{2}\right) = \sqrt{2} and ∫01f(x)dx=2Rπ\int_0^1 f(x) dx = \frac{2R}{\pi}, then the constants RR and SS are

  1. A.

    2π\frac {2} {\pi} and 16π\frac {16} {\pi}

  2. B.

    2π\frac {2} {\pi} and 00

  3. C.

    4π\frac {4} {\pi} and 00

  4. D.

    4π\frac {4} {\pi} and 16π\frac {16} {\pi}

Official answer key

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

Solutions and video are in the course

Question 11 · 1 mark Q3125

Let p,q,rp, q, r denote the statements ”It is raining”, “It is cold”, and “It is pleasant”, respectively. Then the statement “It is not raining and it is pleasant, and it is not pleasant only if it is raining and it is cold” is represented by

  1. A.

    (¬p∧r)∧(¬r→(p∧q))(\neg p \wedge r) \wedge (\neg r \rightarrow (p \wedge q))

  2. B.

    (¬p∧r)∧((p∧q)→¬r)(\neg p \wedge r) \wedge ((p \wedge q) \rightarrow \neg r)

  3. C.

    (¬p∧r)∨((p∧q)→¬r)(\neg p \wedge r) \vee ((p \wedge q) \rightarrow \neg r)

  4. D.

    (¬p∧r)∨(r→(p∧q))(\neg p \wedge r) \vee (r \rightarrow (p \wedge q))

Official answer key

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

Solutions and video are in the course

Question 12 · 1 mark Q3126

Given the following binary number in 32-bit (single precision) IEEE-754 format :


 00111110011011010000000000000000


The decimal value closest to this floating-point number is :

  1. A.

    1.45 X 101

  2. B.

    1.45 X 10-1

  3. C.

    2.27 X 10-1

  4. D.

    2.27 X 101

Official answer key

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

Solutions and video are in the course

Question 13 · 1 mark Q3127

A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue, respectively. Which of the following statements is/are CORRECT for such a circular queue, so that insertion and deletion operations can be performed in O(1)O(1) time?

I.    Next pointer of front node points to the rear node.

II.   Next pointer of rear node points to the front node.

  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 2): B

Solutions and video are in the course

Question 14 · 1 mark Q3128

Consider the following function implemented in C:

void printxy(int x, int y) { int *ptr; x=0; ptr=&x; y=*ptr; *ptr=1; printf(“%d, %d”, x, y); }

The output of invoking  printxy(1,1) is:

  1. A.

    0,0

  2. B.

    0,1

  3. C.

    1,0

  4. D.

    1,1

Official answer key

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

Solutions and video are in the course

Question 15 · 1 mark Q3129

The Breadth First Search (BFS) algorithm has been implemented using the queue data structure. Which one of the following is a possible order of visiting the nodes in the graph below?

  1. A.

    MNOPQR\text{MNOPQR}

  2. B.

    NQMPOR\text{NQMPOR}

  3. C.

    QMNROP\text{QMNROP}

  4. D.

    POQNMR\text{POQNMR}

Official answer key

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

Solutions and video are in the course

Question 16 · 1 mark Q3130

Identify the language generated by the following grammar, where SS is the start variable.

S→XYS \rightarrow XY

X→aX∣aX \rightarrow aX \mid a

Y→aYb∣ϵY \rightarrow aYb \mid \epsilon

  1. A.

    {ambn∣m≥n,n>0}\{a^mb^n \mid m \geq n, n > 0 \}

  2. B.

    {ambn∣m≥n,n≥0}\{ a^mb^n \mid m \geq n, n \geq 0 \}

  3. C.

    {ambn∣m>n,n≥0}\{a^mb^n \mid m > n, n \geq 0 \}

  4. D.

    {ambn∣m>n,n>0}\{a^mb^n \mid m > n, n > 0 \}

Official answer key

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

Solutions and video are in the course

Question 17 · 1 mark Q2031

An ER model of a database consists of entity types A and B. These are connected by a relationship R which does not have its own attribute. Under which one of the following conditions, can the relational table for R be merged with that of A?

  1. A.

    Relationship R is one-to-many and the participation of A in R is total

  2. B.

    Relationship R is one-to-many and the participation of A in R is partial

  3. C.

    Relationship R is many-to-one and the participation of A in R is total

  4. D.

    Relationship R is many-to-one and the participation of A in R is partial

Official answer key

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

Solutions and video are in the course

Question 18 · 1 mark Q3132

Consider socket API on a Linux machine that supports connected UDP sockets. A connected UDP socket is a UDP socket on which connect function has already been called. Which of the following statements is/are CORRECT?

I.    A connected UDP socket can be used to communicate with multiple peers simultaneously.

II.   A process can successfully call connect function again for an already connected UDP socket.

  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 2): B

Solutions and video are in the course

Question 19 · 1 mark Q3133

Consider the following tables T1 and T2

In table T1, P is the primary key and Q is the foreign key referencing R in table T2 with on-delete cascade and on-update cascade. In table T2, R is the primary key and S is the foreign key referencing P  in table T1 with on-delete set NULL and on-update cascade. In order to delete record ⟨3,8⟩ from the table T1, the number of additional records that need to be deleted from table T1 is _______

Official answer key

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

Solutions and video are in the course

Question 20 · 1 mark Q3134

The maximum number of IPv4 router addresses that can be listed in the record route (RR) option field of an IPv4 header is______.

Official answer key

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

Solutions and video are in the course

Question 21 · 1 mark Q3135

Consider the set  X={a,b,c,d,e}X=\{a, b, c, d, e\} under partial ordering  

R={(a,a),(a,b),(a,c),(a,d),(a,e),(b,b),(b,c),(b,e),(c,c),(c,e),(d,d),(d,e),(e,e)}R=\{(a,a), (a, b), (a, c), (a, d), (a, e), (b, b), (b, c), (b, e), (c, c), (c, e), (d, d), (d, e), (e, e) \}

The Hasse diagram of the partial order (X,R)(X, R) is shown below.

The minimum number of ordered pairs that need to be added to RR to make (X,R)(X, R) a lattice is ______

Official answer key

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

Solutions and video are in the course

Question 22 · 1 mark Q3136

Let 

image.png

Then the rank of (P+Q) is ___________ .

Official answer key

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

Solutions and video are in the course

Question 23 · 1 mark Q3137

GG  is an undirected graph with nn vertices and 25 edges such that each vertex of GG has degree at least 3. Then the maximum possible value of nn is _________ .

Official answer key

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

Solutions and video are in the course

Question 24 · 1 mark Q3138

Consider the quadratic equation x2−13x+36=0x^2-13x+36=0 with coefficients in a base bb. The solutions of this equation in the same base bb are xx = 5 and xx = 6. Then bb = _____

Official answer key

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

Solutions and video are in the course

Question 25 · 1 mark Q3139

The minimum possible number of states of a deterministic finite automaton that accepts the regular language L=w1aw2∣w1,w2∈{a,b}∗∣w1∣=2,∣w2∣≥3L = w_{1}aw_{2} | w_{1},w_{2} \in \left \{ a,b \right \}^{*} \left | w_{1} \right | = 2, \left | w_{2} \right |\geq 3 is ______________ .

Official answer key

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

Solutions and video are in the course

Question 26 · 1 mark Q3140

P and Q are considering to apply for a job. The probability that P applies for the job is 14\frac {1} {4}, the probability that P applies for the job given that Q applies for the job is 12\frac {1} {2}, and the probability that Q applies for the job given that P applies for the job is 13\frac {1} {3}. Then the probability that P does not apply for the job given that Q does not apply for this job is

  1. A.

    45\frac {4} {5}

  2. B.

    56\frac {5} {6}

  3. C.

    78\frac {7} {8}

  4. D.

    1112\frac {11} {12}

Official answer key

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

Solutions and video are in the course

Question 27 · 1 mark Q3141

If w,x,y,zw, x, y, z are Boolean variables, then which one of the following is INCORRECT?

  1. A.

    wx+w(x+y)+x(x+y)=x+wywx+w(x+y)+x(x +y) = x+wy

  2. B.

    wxˉ(y+zˉ)‾+wˉx=wˉ+x+yˉz\overline{w \bar{x}(y+\bar{z})} + \bar{w}x = \bar{w} + x + \bar{y}z

  3. C.

    (wxˉ(y+xzˉ)+wˉxˉ)y=xyˉ(w \bar{x}(y+x\bar{z}) + \bar{w} \bar{x}) y = x \bar{y}

  4. D.

    (w+y)(wxy+wyz)=wxy+wyz(w+y)(wxy+wyz) = wxy+wyz

Official answer key

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

Solutions and video are in the course

Question 28 · 1 mark Q3142

Given f(w,x,y,z)=Σm(0,1,2,3,7,8,10)+Σd(5,6,11,15)f(w, x, y, z) = \Sigma_m(0,1, 2, 3, 7, 8, 10) + \Sigma_d(5, 6, 11, 15); where dd represents the 'don't-care' condition in Karnaugh maps. Which of the following is a minimum product-of-sums (POS) form of f(w,x,y,z)f(w, x, y, z)?

  1. A.

    f=(wˉ+zˉ)(xˉ+z)f=(\bar{w}+\bar{z}) (\bar{x}+z)

  2. B.

    f=(wˉ+z)(x+z)f=(\bar{w}+z) (x+z)

  3. C.

    f=(w+z)(xˉ+z)f=(w+z) (\bar{x}+z)

  4. D.

    f=(w+zˉ)(xˉ+z)f=(w+\bar{z}) (\bar{x}+z)

Official answer key

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

Solutions and video are in the course

Question 29 · 1 mark Q3143

In a two-level cache system, the access times of  L1L_1 and L2L_2 caches are 1 and 8 clock cycles, respectively. The miss penalty from the L2L_2 cache to main memory is 18 clock cycles. The miss rate of L1L_1 cache is twice that of​​L2​​L_2. The average memory access time (AMAT) of this cache system is 2 cycles. The miss rates of L1L_1 and ​​L2​​L_2 respectively are

  1. A.

    0.111 and 0.056

  2. B.

    0.056 and 0.111

  3. C.

    0.0892 and 0.1784

  4. D.

    0.1784 and 0.0892

Official answer key

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

Solutions and video are in the course

Question 30 · 1 mark Q3144

Consider the recurrence function

T(n)={2T(n)+1,n>22,0<n≤2T(n) = \begin{cases} 2T(\sqrt{n})+1, & n>2 \\ 2, & 0 < n \leq 2 \end{cases}

Then T(n)T(n) in terms of Θ\Theta notation is

  1. A.

    Θ(log⁡log⁡n)\Theta(\log \log n)

  2. B.

    Θ(log⁡n)\Theta( \log n)

  3. C.

    Θ(n)\Theta (\sqrt{n})

  4. D.

    Θ(n)\Theta(n)

Official answer key

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

Solutions and video are in the course

Question 31 · 1 mark Q3145

For any discrete random variable XX, with probability mass function

P(X=j)=pj,pj≥0,j∈{0,…,N}P(X=j)=p_j, p_j \geq 0, j \in \{0, \dots , N \}, and Σj=0N pj=1\Sigma_{j=0}^N \: p_j =1, define the polynomial function gx(z)=Σj=0N pj zjg_x(z) = \Sigma_{j=0}^N \: p_j \: z^j. For a certain discrete random variable YY, there exists a scalar β∈[0,1]\beta \in [0,1] such that gy(z)=(1−β+βz)Ng_y(z) =(1- \beta+\beta z)^N. The expectation of YY is

  1. A.

    Nβ(1−β)N \beta(1-\beta)

  2. B.

    NβN \beta

  3. C.

    N(1−β)N (1-\beta)

  4. D.

    Not expressible in terms of NN and β\beta alone

Official answer key

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

Solutions and video are in the course

Question 32 · 1 mark Q3146

Consider the following expression grammar G:

E -> E - T | T T -> T + F | F F -> (E) | id

Which of the following grammars are not left recursive, but equivalent to G ?

  1. A.

    E -> E - T | T

    T -> T + F | F

    F -> (E) | id

  2. B.

    E -> TE'

    E' -> -TE' | ε

    T -> T + F | F

    F -> (E) | id

  3. C.

    E -> TX

    X -> -TX | ε

    T -> FY

    Y -> +FY | ε

    F -> (E) | id

  4. D.

    E -> TX | (TX)

    X -> -TX | +TX | ε

    T -> id

Official answer key

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

Solutions and video are in the course

Question 33 · 1 mark Q3147

A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for that processes are shown below:

g2017_8

Which of the following best describes the current state of the system?

  1. A.

    Safe, Deadlocked

  2. B.

    Safe, Not Deadlocked

  3. C.

    Not Safe, Deadlocked

  4. D.

    Not Safe, Not Deadlocked

Official answer key

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

Solutions and video are in the course

Question 34 · 1 mark Q3148

Consider the binary code that consists of only four valid codewords as given below:

00000,01011,10101,11110

Let the minimum Hamming distance of the code pp and the maximum number of erroneous bits that can be corrected by the code be qq. Then the values of pp and qq are

  1. A.

    p=3p=3  and q=1q=1

  2. B.

    p=3p=3  and q=2q=2

  3. C.

    p=4p=4 and q=1q=1

  4. D.

    p=4p=4 and q=2q=2

Official answer key

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

Solutions and video are in the course

Question 35 · 1 mark Q3149

Consider two hosts XX and YY, connected by a single direct link of rate 106bits/sec. The distance between the two hosts is 10,000km and the propagation speed along the link is 2×108m/sec. Host XX sends a file of 50,000 bytes as one large message to host YY continuously. Let the transmission and propagation delays be pp milliseconds and qq milliseconds respectively. Then the value of pp and qq are

  1. A.

    p=50p=50 and q=100q=100

  2. B.

    p=100p=100 and q=50q=50

  3. C.

    p=400p=400 and q=50q=50

  4. D.

    p=50p=50 and q=400q=400

Official answer key

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

Solutions and video are in the course

Question 36 · 2 marks Q3150

The pre-order traversal of a binary search tree is given by 12,8,6,2,7,9,10,16,15,19,17,20.

Then the post-order traversal of this tree is

  1. A.

    2, 6, 7, 8, 9, 10, 12, 15, 16, 17, 19, 20

  2. B.

    2, 7, 6, 10, 9, 8, 15, 17, 20, 19, 16, 12

  3. C.

    7, 2, 6, 8, 9, 10, 20, 17, 19, 15, 16, 12

  4. D.

    7, 6, 2, 10, 9, 8, 15, 16, 17, 20, 19, 12

Official answer key

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

Solutions and video are in the course

Question 37 · 2 marks Q3151

Consider the C program fragment below which is meant to divide xx by yy using repeated subtractions. The variables x,y,qx,y,q and rr are all unsigned int.

while (r >= y) { r=r-y; q=q+1; }

Which of the following conditions on the variables   x,y,qx,y,q and rr before the execution of the fragment will ensure that the loop terminated in a state satisfying the condition x==(y∗q+r)x==(y*q + r) ?

  1. A.

    (q==r) && (r==0)(q==r) \ \&\& \ (r==0)

  2. B.

    (x>0) && (r==x) && (y>0)(x>0) \ \&\& \ (r==x) \ \&\& \ (y>0)

  3. C.

    (q==0) && (r==x) && (y>0)(q==0) \ \&\& \ (r==x) \ \&\& \ (y >0)

  4. D.

    (q==0) && (y>0)(q==0) \ \&\& \ (y>0)

Official answer key

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

Solutions and video are in the course

Question 38 · 2 marks Q3152

Consider the following C function

int fun(int n) { int i, j; for(i=1; i<=n; i++) { for (j=1; j<n; j+=i) { printf("%d %d", i, j); } } }

Time complexity of funfun in terms of Θ\Theta notation is

  1. A.

    Θ(nn)\Theta(n \sqrt{n})

  2. B.

    Θ(n2)\Theta(n^2)

  3. C.

    Θ(n log⁡n)\Theta(n \: \log n)

  4. D.

    Θ(n2log⁡n)\Theta(n^2 \log n)

Official answer key

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

Solutions and video are in the course

Question 39 · 2 marks Q3153

Let δ\delta denote the transition function and δ^\widehat{\delta} denote the extended transition function of the ϵ\epsilon-NFA whose transition table is given below:

image.png

Then δ^(q2,aba)\widehat{\delta}(q_2, aba) is

  1. A.

    ∅\emptyset

  2. B.

    {q0,q1,q3}\{q_0, q_1, q_3\}

  3. C.

    {q0,q1,q2}\{q_0, q_1, q_2\}

  4. D.

    {q0,q2,q3}\{q_0, q_2, q_3 \}

Official answer key

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

Solutions and video are in the course

Question 40 · 2 marks Q3154

Consider the following languages.

L1={ap∣p is a prime number}L_1 = \{a^p \mid p \text{ is a prime number} \}

L2={anbmc2m∣n≥0,m≥0}L_2 = \{ a^nb^mc^{2m} \mid n \geq 0, m \geq 0 \}

L3={anbnc2n∣n≥0}L_3 = \{a^n b^n c^{2n} \mid n \geq 0 \}

L4={anbn∣n≥1}L_4 = \{ a^n b^n \mid n \geq 1\}

Which of the following are CORRECT?

I.    L1L_1 is context free but not regular

II.   L2L_2 is not context free

III.   L3L_3 is not context free but recursive

IV.   L4L_4 is deterministic context free

  1. A.

    I, II and IV only

  2. B.

    II and III only

  3. C.

    I and IV only

  4. D.

    III and IV only

Official answer key

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

Solutions and video are in the course

Question 41 · 2 marks Q3155

Let L(R)L(R) be the language represented by regular expression RR. Let L(G)L(G) be the language generated by a context free grammar GG. Let L(M)L(M) be the language accepted by a Turing machine MM. Which of the following decision problems are undecidable?

I.    Given a regular expression RR and a string ww, is w∈L(R)w \in L(R)?

II.   Given a context-free grammar GG, is L(G)=∅L(G) = \emptyset

III.  Given a context-free grammar GG, is L(G)=Σ∗L(G) = \Sigma^* for some alphabet ΣΣ ?

IV.  Given a Turing machine MM and a string ww, is w∈L(M)w \in L(M)?

  1. A.

    I and IV only

  2. B.

    II and III only

  3. C.

    II, III and IV only

  4. D.

    III and IV only

Official answer key

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

Solutions and video are in the course

Question 42 · 2 marks Q3156

The next state table of a 2−bit saturating up-counter is given below.

Q1Q0Q1+Q0+0001011010111111\begin{array}{cc|cc} Q_1 & Q_0 & Q_1^+ & Q_0^+ \\ \hline 0 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0 \\ 1 & 0 & 1 & 1 \\ 1 & 1 & 1 & 1 \end{array}

The counter is built as a synchronous sequential circuit using TT flip-flops. The expressions for T1T_1 and T0T_0 are

  1. A.

    T1=Q1Q0,T0=Q1ˉQ0ˉT_1 = Q_1Q_0, \quad T_0= \bar{Q_1} \bar{Q_0}

  2. B.

    T1=Q1ˉQ0,T0=Q1ˉ+Q0ˉT_1 = \bar{Q_1}Q_0, \quad T_0= \bar{Q_1} + \bar{Q_0}

  3. C.

    T1=Q1+Q0,T0=Q1ˉ+Q0ˉT_1 = Q_1+Q_0, \quad T_0= \bar{Q_1} + \bar{Q_0}

  4. D.

    T1=Q1ˉQ0,T0=Q1+Q0T_1 = \bar{Q_1}Q_0, \quad T_0= Q_1 + Q_0

Official answer key

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

Solutions and video are in the course

Question 43 · 2 marks Q3157

Consider the following snippet of a C program. Assume that swap (&x,&y)(\&x, \&y) exchanges the content of xx and yy:


int main () {

int array[] = {3, 5, 1, 4, 6, 2};

int done =0;

int i;

while (done==0) {

done =1;

for (i=0; i<=4; i++) {

if (array[i] < array[i+1]) {

swap(&array[i], &array[i+1]);

done=0;

}

}

for (i=5; i>=1; i--) {

if (array[i] > array[i-1]) {

swap(&array[i], &array[i-1]);

done =0;

}

}

}

printf(“%d”, array[3]);

}

The output of the program is _______

Official answer key

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

Solutions and video are in the course

Question 44 · 2 marks Q3158

Two transactions T1T_1 and T2T_2 are given as

T1:r1(X)w1(X)r1(Y)w1(Y)T_1:r_1(X)w_1(X)r_1(Y)w_1(Y)

T2:r2(Y)w2(Y)r2(Z)w2(Z)T_2:r_2(Y)w_2(Y)r_2(Z)w_2(Z)

where ri(V)r_i(V) denotes a read operation by transaction TiT_i on a variable VV and wi(V)w_i(V) denotes a write operation by transaction TiT_i on a variable VV. The total number of conflict serializable schedules that can be formed by T1T_1 and T2T_2 is ______

Official answer key

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

Solutions and video are in the course

Question 45 · 2 marks Q3159

The read access times and the hit ratios for different caches in a memory hierarchy are as given below:

g2017_9

The read access time of main memory in 90nanoseconds. Assume that the caches use the referred-word-first read policy and the write-back policy. Assume that all the caches are direct mapped caches. Assume that the dirty bit is always 0 for all the blocks in the caches. In execution of a program, 60% of memory reads are for instruction fetch and 40% are for memory operand fetch. The average read access time in nanoseconds (up to 2 decimal places) is _________

Official answer key

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

Solutions and video are in the course

Question 46 · 2 marks Q3160

Consider the following database table named 

image.png

Consider the following SQL query:

SELECT ta.player FROM top_scorer AS ta

WHERE ta.goals >ALL (SELECT tb.goals

FROM top_scorer AS tb

WHERE tb.country = 'Spain')

AND ta.goals > ANY (SELECT tc.goals

FROM top_scorer AS tc

WHERE tc.country='Germany')

The number of tuples returned by the above SQL query is ______

Official answer key

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

Solutions and video are in the course

Question 47 · 2 marks Q3161

If the ordinary generating function of a sequence {an}n=0∞\left \{a_n\right \}_{n=0}^\infty  is 1+z(1−z)3\large \frac{1+z}{(1-z)^3}, then a3−a0a_3-a_0 is equal to ___________ .

Official answer key

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

Solutions and video are in the course

Question 48 · 2 marks Q3162

If a random variable XX has a Poisson distribution with mean 5, then the expectation E[(X+2)2]E\left [ \left ( X+2 \right )^{2} \right ] equals ___.

Official answer key

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

Solutions and video are in the course

Question 49 · 2 marks Q3163

In a B+ Tree , if the search-key value is 8 bytes long , the block size is 512 bytes and the pointer size is 2B , then the maximum order of the B+ Tree is ____

Official answer key

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

Solutions and video are in the course

Question 50 · 2 marks Q3164

A message is made up entirely of characters from the set X={P,Q,R,S,T}X=\{P, Q, R, S, T\}. The table of probabilities for each of the characters is shown below:

\(\begin{array}{|c|c|}\hline \textbf{Character} & \textbf{Probability } \\\hline \text{\(P\)} & \text{0.220.22} \\ \text{QQ} & \text{0.340.34} \\ \text{RR} & \text{0.170.17} \\ \text{SS} & \text{0.190.19} \\ \text{TT} & \text{0.080.08} \\ \hline\text{Total} & \text{1.001.00} \\\hline \end{array}\)

If a message of 100 characters over XX is encoded using Huffman coding, then the expected length of the encoded message in bits is ______.

Official answer key

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

Solutions and video are in the course

Question 51 · 2 marks Q3165

Consider the set of process with arrival time (in milliseonds), CPU burst time (in millisecods) and priority (0 is the highest priority)  shown below. None of the process have I/O burst time

g2017_12

The average waiting time (in milli seconds) of all the process using premtive priority scheduling algorithm is ______

Official answer key

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

Solutions and video are in the course

Question 52 · 2 marks Q3166

If the characteristic polynomial of a  3×3  matrix MM over R\mathbb{R} (the set of real numbers) is λ3–4λ2+aλ+30,a∈R\lambda^3 – 4 \lambda^2 + a \lambda +30, \quad a \in \mathbb{R}, and one eigenvalue of MM is 2, then the largest among the absolute values of the eigenvalues of MM is _______

Official answer key

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

Solutions and video are in the course

Question 53 · 2 marks Q3167

Consider a machine with a byte addressable main memory of 2^32 bytes divided into blocks of size 32 bytes. Assume that a direct mapped cache having 512 cache lines is used with this machine. The size of the tag field in bits is _______

Official answer key

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

Solutions and video are in the course

Question 54 · 2 marks Q3168

Consider the following C program.

#include<stdio.h> int main () { int m=10; int n, n1; n=++m; n1=m++; n--; --n1; n-=n1; printf(“%d”, n); return 0; }

The output of the program is ______

Official answer key

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

Solutions and video are in the course

Question 55 · 2 marks Q3169

Consider the following C program.

#include<stdio.h> #include<string.h> int main() { char* c="GATECSIT2017"; char* p=c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; }

The output of the program is _______

Official answer key

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

Solutions and video are in the course

Question 56 · 2 marks Q3105

Choose the option with words that are not synonyms.

  1. A.

    aversion, dislike

  2. B.

    luminous, radiant

  3. C.

    plunder, loot

  4. D.

    yielding, resistant

Official answer key

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

Solutions and video are in the course

Question 57 · 2 marks Q3106

Saturn is ___________ to be seen on a clear night with the naked eye.

  1. A.

    enough bright

  2. B.

    bright enough

  3. C.

    as enough bright

  4. D.

    bright as enough

Official answer key

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

Solutions and video are in the course

Question 58 · 2 marks Q3107

There are five buildings called V, W, X, Y and Z in a row (not necessarily in that order). V is to the West of W. Z is to the East of X and the West of V. W is to the West of Y. Which is the building in the middle?

  1. A.

    V

  2. B.

    W

  3. C.

    X

  4. D.

    Y

Official answer key

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

Solutions and video are in the course

Question 59 · 2 marks Q3108

A test has twenty questions worth 100 marks in total. There are two types of questions. Multiple choice questions are worth 3 marks each and essay questions are worth 11 marks each. How many multiple choice questions does the exam have?

  1. A.

    12

  2. B.

    15

  3. C.

    18

  4. D.

    19

Official answer key

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

Solutions and video are in the course

Question 60 · 2 marks Q3109

There are 3 red socks, 4 green socks and 3 blue socks.You choose 2 socks. The probability that they are of the same colour is

  1. A.

    1/5

  2. B.

    7/30

  3. C.

    1/4

  4. D.

    4/15

Official answer key

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

Solutions and video are in the course

Question 61 · 2 marks Q3110

“We lived in a culture that denied any merit to literary works, considering them important only when they were handmaidens to something seemingly more urgent – namely ideology. This was a country where all gestures, even the most private, were interpreted in political terms.”

The author’s belief that ideology is not as important as literature is revealed by the word:

  1. A.

    ‘culture’

  2. B.

    ‘seemingly’

  3. C.

    ‘urgent’

  4. D.

    ‘political’

Official answer key

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

Solutions and video are in the course

Question 62 · 2 marks Q3111

There are three boxes. One contains apples, another contains oranges and the last one contains both apples and oranges. All three are known to be incorrectly labeled. If you are permitted to open just one box and then pull out and inspect only one fruit, which box would you open to determine the contents of all three boxes?

  1. A.

    The box labeled ‘Apples’

  2. B.

    The box labeled ‘Apples and Oranges’

  3. C.

    The box labeled ‘Oranges’

  4. D.

    Cannot be determined

Official answer key

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

Solutions and video are in the course

Question 63 · 2 marks Q3112

X is a 30 digit number starting with the digit 4 followed by the digit 7. Then the number X3 will have

  1. A.

    90 digits

  2. B.

    91 digits

  3. C.

    92 digits

  4. D.

    93 digits

Official answer key

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

Solutions and video are in the course

Question 64 · 2 marks Q3113

The number of roots of ex+0.5x2−2=0e^{x}+0.5x^{2}-2=0 in the range [−5,5][-5,5] is

  1. A.

    0

  2. B.

    1

  3. C.

    2

  4. D.

    3

Official answer key

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

Solutions and video are in the course

Question 65 · 2 marks Q3114

An air pressure contour line joins locations in a region having the same atmospheric pressure. The following is an air pressure contour plot of a geographical region. Contour lines are shown at 0.05 bar intervals in this plot.

If the possibility of a thunderstorm is given by how fast air pressure rises or drops over a region, which of the following regions is most likely to have a thunderstorm?

  1. A.

    P

  2. B.

    Q

  3. C.

    R

  4. D.

    S

Official answer key

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

Solutions and video are in the course