The GATE Grind

GATE 2017 CS (CS2) – Previous Year Questions with Solutions

All 65 questions of GATE 2017 CS (CS2) with answers and explanations. Read each question, then practise it by topic or as a full paper.

Practise this paper in The GATE Grind →

  1. Question 1 (1 mark, Multiple choice) – Choose the pair of words that are NOT synonyms.
  2. Question 2 (1 mark, Multiple choice) – Saturn is to be seen on a clear night with the naked eye.
  3. Question 3 (1 mark, Multiple choice) – Five buildings V,W,X,Y,Z stand in a row. V is west of W. Z is east of X and west of V. W is west of Y. Which building is in the middle?
  4. Question 4 (1 mark, Multiple choice) – A test has twenty questions worth 100 marks in total. Multiple-choice questions carry 3 marks each and essay questions 11 marks each. How many…
  5. Question 5 (1 mark, Multiple choice) – There are 3 red socks, 4 green socks and 3 blue socks. Choose two socks uniformly without replacement. What is the probability they have the same…
  6. Question 6 (2 marks, Multiple choice) – “We lived in a culture that denied any merit to literary works, considering them important only when they were handmaidens to something seemingly more…
  7. Question 7 (2 marks, Multiple choice) – Three boxes contain apples only, oranges only, and both apples and oranges. All three labels are incorrect. You may open just one box and inspect one…
  8. Question 8 (2 marks, Multiple choice) – X is a 30-digit positive integer starting with digits 4 then 7. How many digits does X³ have?
  9. Question 9 (2 marks, Multiple choice) – How many roots does ex+0.5x2-2=0 have in [−5,5]?
  10. Question 10 (2 marks, Multiple choice) – An air-pressure contour joins locations of equal atmospheric pressure. The shown contours occur at 0.05 bar intervals. Thunderstorm possibility…
  11. Question 11 (1 mark, Multiple choice) – The hexadecimal representation of a 16-bit unsigned integer X is BCA9. Find its octal representation.
  12. Question 12 (1 mark, Multiple choice) – Match (P) static char var; (Q) m = malloc(10); m = NULL; (R) char *ptr[10]; (S) register int var1; with (i) sequence of memory locations storing…
  13. Question 13 (1 mark, Multiple choice) – Match (P) Towers of Hanoi with n disks, (Q) binary search on n sorted numbers, (R) worst-case heap sort on n numbers, (S) addition of two n×n…
  14. Question 14 (1 mark, Multiple choice) – L₁,L₂ are context-free and R is regular. Which are correct? I: L₁∪L₂ is context-free. II: L 1 is context-free. III: L₁−R is context-free. IV: L₁∩L₂ is…
  15. Question 15 (1 mark, Multiple choice) – Match compiler inputs P: syntax tree, Q: character stream, R: intermediate representation, S: token stream, to phases (i) code generator, (ii) syntax…
  16. Question 16 (1 mark, Multiple choice) – Which parser statements are correct? I: Canonical LR is more powerful than SLR. II: SLR is more powerful than LALR. III: SLR is more powerful than…
  17. Question 17 (1 mark, Multiple choice) – Which are shared by all threads of one process? I: Program counter. II: Stack. III: Address space. IV: Registers.
  18. Question 18 (1 mark, Multiple choice) – Which file-allocation schemes can be used when external fragmentation is not allowed? I: Contiguous. II: Linked. III: Indexed.
  19. Question 19 (1 mark, Multiple choice) – For RIP and OSPF in IPv4: I: RIP uses distance-vector routing. II: RIP packets use UDP. III: OSPF packets use TCP. IV: OSPF uses link-state routing.…
  20. Question 20 (1 mark, Multiple choice) – f(x)=R( x/2)+S, f(1/2)=2 and 01 f(x)dx=2R/. Find R,S respectively.
  21. Question 21 (1 mark, Multiple choice) – Let p,q,r mean “It is raining”, “It is cold”, “It is pleasant”. Represent: “It is not raining and it is pleasant, and it is not pleasant only if it is…
  22. Question 22 (1 mark, Multiple choice) – A 32-bit IEEE-754 single-precision bit pattern is 00111110011011010000000000000000. Which decimal value is closest?
  23. Question 23 (1 mark, Multiple choice) – A circular queue uses a singly linked list, with value and next-pointer per node and exactly two external pointers FRONT and REAR. For O(1) insertion…
  24. Question 24 (1 mark, Multiple choice) – What is printed by printxy(1,1)?
  25. Question 25 (1 mark, Multiple choice) – BFS is implemented using a queue. Which is a possible vertex-visiting order for the shown graph?
  26. Question 26 (1 mark, Multiple choice) – With start S and rules S→XY, X→aX a, Y→aYb ε, identify the language.
  27. Question 27 (1 mark, Multiple choice) – Entity types A and B are connected by relationship R with no attributes. When can the relation table for R be merged with A’s table?
  28. Question 28 (1 mark, Multiple choice) – Linux supports connected UDP sockets, on which connect has already been called. Which hold? I: One connected UDP socket communicates with multiple…
  29. Question 29 (1 mark, Numerical answer) – Tables T₁(P,Q) = (2,2),(3,8),(7,3),(5,8),(6,9),(8,5),(9,8) and T₂(R,S) = (2,2),(8,3),(3,2),(9,7),(5,7),(7,2). P and R are primary keys. T₁.Q…
  30. Question 30 (1 mark, Numerical answer) – What is the largest number of IPv4 router addresses that fit in the record-route option of an IPv4 header?
  31. Question 31 (1 mark, Numerical answer) – X=a,b,c,d,e has partial order 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), with Hasse diagram shown. How many…
  32. Question 32 (1 mark, Numerical answer) – Let P=pmatrix1&1&-1\\2&-3&4\\3&-2&3pmatrix, Q=pmatrix-1&-2&-1\\6&12&6\\5&10&5pmatrix. Find rank(P+Q).
  33. Question 33 (1 mark, Numerical answer) – An undirected graph has n vertices, 25 edges and every vertex has degree at least three. Find the greatest possible n.
  34. Question 34 (1 mark, Numerical answer) – The equation x²−13x+36=0 has coefficients written in base b, and its roots in the same base are x=5 and x=6. Find b.
  35. Question 35 (1 mark, Numerical answer) – Find the minimum number of DFA states for L=\w 1aw 2:w 1,w 2\a,b\*,\ w 1 =2,\ w 2 3\.
  36. Question 36 (2 marks, Multiple choice) – P applies for a job with probability 1/4. P(P applies Q applies)=1/2 and P(Q applies P applies)=1/3. Find P(P does not apply Q does not apply).
  37. Question 37 (2 marks, Multiple choice) – For Boolean variables w,x,y,z, which identity is INCORRECT?
  38. Question 38 (2 marks, Multiple choice) – f(w,x,y,z)= m(0,1,2,3,7,8,10)+ d(5,6,11,15), with d denoting Karnaugh-map don’t-cares. Find a minimum product of sums.
  39. Question 39 (2 marks, Multiple choice) – L₁ and L₂ cache access times are 1 and 8 cycles. L₂-to-main-memory miss penalty is 18 cycles. L₁ miss rate is twice L₂ miss rate. AMAT is 2 cycles.…
  40. Question 40 (2 marks, Multiple choice) – T(n)=2T( n)+1 for n>2, and T(n)=2 for 0<n≤2. Find its asymptotic order.
  41. Question 41 (2 marks, Multiple choice) – For a discrete X with P(X=j)=pⱼ, pⱼ≥0, j=0,…,N and Σpⱼ=1, define g X(z)= j=0Np jzj. A variable Y has g Y(z)=(1-+ z)N, 0≤β≤1. Find E[Y].
  42. Question 42 (2 marks, Multiple choice) – G has E→E−T T, T→T+F F, F→(E) id. Which equivalent grammar has no left recursion?
  43. Question 43 (2 marks, Multiple choice) – Nine tape drives are shared. For P₁,P₂,P₃, current allocations are 3,1,3 and maximum requirements are 7,6,5. Describe the system state.
  44. Question 44 (2 marks, Multiple choice) – A binary code has exactly four valid words: 00000,01011,10101,11110. Let p be minimum Hamming distance and q maximum correctable bit errors. Find p,q.
  45. Question 45 (2 marks, Multiple choice) – Hosts X,Y have a direct 10⁶ bit/s link, distance 10000 km, propagation speed 2×10⁸ m/s. X sends a 50000-byte file as one continuous message. Find…
  46. Question 46 (2 marks, Multiple choice) – BST preorder is 12,8,6,2,7,9,10,16,15,19,17,20. Find its postorder.
  47. Question 47 (2 marks, Multiple choice) – The following fragment divides x by y using repeated subtraction. All variables x,y,q,r are unsigned int. Which precondition ensures termination with…
  48. Question 48 (2 marks, Multiple choice) – Find the time complexity.
  49. Question 49 (2 marks, Multiple choice) – An ε-NFA has start q₀. Transition triples (ε,a,b) are q₀:(q₂,q₁,q₀); q₁:(q₂,q₂,q₃); q₂:(q₀,∅,∅); q₃:(∅,∅,q₂). Find the extended transition δ̂(q₂,aba).
  50. Question 50 (2 marks, Multiple choice) – L₁=aᵖ:p prime, L 2=\anbmc2m:n,m0\, L 3=\anbnc2n:n0\, L₄=aⁿbⁿ:n≥1. Which hold? I: L₁ context-free but not regular. II: L₂ not context-free. III: L₃ not…
  51. Question 51 (2 marks, Multiple choice) – L(R) is a regular-expression language, L(G) a context-free grammar language, L(M) a Turing-machine language. Which are undecidable? I: Given R,w, is…
  52. Question 52 (2 marks, Multiple choice) – A synchronous two-bit saturating up-counter has transitions 00→01,01→10,10→11,11→11. With T flip-flops, find T₁,T₀.
  53. Question 53 (2 marks, Numerical answer) – swap exchanges its two arguments. Find the output.
  54. Question 54 (2 marks, Numerical answer) – Transactions are T₁:r₁(X)w₁(X)r₁(Y)w₁(Y) and T₂:r₂(Y)w₂(Y)r₂(Z)w₂(Z). How many interleavings preserve each transaction’s order and are…
  55. Question 55 (2 marks, Numerical answer) – I-cache has (read time 2 ns, hit ratio 0.8), D-cache (2 ns,0.9), L₂-cache (8 ns,0.9). Main-memory read is 90 ns. Caches are direct-mapped,…
  56. Question 56 (2 marks, Numerical answer) – top scorer(player,country,goals) contains Klose/Germany/16, Ronaldo/Brazil/15, G Müller/Germany/14, Fontaine/France/13, Pelé/Brazil/12,…
  57. Question 57 (2 marks, Numerical answer) – The ordinary generating function of aₙ is (1+z)/(1-z)3. Find a₃−a₀.
  58. Question 58 (2 marks, Numerical answer) – X is Poisson with mean 5. Find E[(X+2)²].
  59. Question 59 (2 marks, Numerical answer) – A B+ tree has eight-byte search keys, 512-byte blocks and two-byte block pointers. Find its maximum order.
  60. Question 60 (2 marks, Numerical answer) – Characters P,Q,R,S,T have probabilities 0.22,0.34,0.17,0.19,0.08. A 100-character message is Huffman encoded. Find its expected encoded length in…
  61. Question 61 (2 marks, Numerical answer) – Processes P₁,…,P₅ have (arrival ms, CPU burst ms, priority): (0,11,2),(5,28,0),(12,2,3),(2,10,1),(9,16,4). Priority 0 is highest; none has I/O. Find…
  62. Question 62 (2 marks, Numerical answer) – A real 3×3 matrix has characteristic polynomial 3-42+a+30 and one eigenvalue 2. Find the largest absolute eigenvalue.
  63. Question 63 (2 marks, Numerical answer) – A byte-addressable main memory has 2³² bytes, divided into 32-byte blocks. A direct-mapped cache has 512 lines. Find tag-field size in bits.
  64. Question 64 (2 marks, Numerical answer) – Find the C program output.
  65. Question 65 (2 marks, Numerical answer) – Find the C program output.