GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 2017 · Set 2

65 questions

Paper analysis: marks by subject, top topics and repeated questions →

03:00:00
1 mark · MCQ
Report issue

Vocabulary & Verbal Analogies

Question 56, GATE 2017: Choose the pair that does NOT consist of synonyms. A: aversion, dislike. B: luminous, radiant. C: plunder, loot. D: yielding, resistant.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. Compare the meanings within each pair, rather than looking for a word that differs from the other six. Aversion and dislike both express an unfavorable feeling toward something.

2. Luminous and radiant both describe giving off light; plunder and loot both refer to goods taken by force or the act of taking them. These three pairs have matching senses.

3. Yielding means giving way or being compliant. Resistant means opposing pressure or refusing to give way. These meanings contrast, so the required non-synonymous pair is D.

Original paper, page 23 · Answer key

1 mark · MCQ
Report issue

English Grammar & Usage

Question 57, GATE 2017: Complete the sentence: Saturn is ____ to be seen on a clear night with the naked eye. A: enough bright. B: bright enough. C: as enough bright. D: bright as enough.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. Here bright is an adjective describing Saturn, and enough modifies the degree of that adjective. The standard construction is adjective + enough + to-infinitive.

2. Substitution gives: Saturn is bright enough to be seen on a clear night with the naked eye. It means that its brightness is sufficient for visibility.

3. Enough can precede a noun, as in enough light, but follows the adjective here. Neither extra as construction is grammatical in this sentence. Choose B.

Original paper, page 23 · Answer key

1 mark · MCQ
Report issue

Data Interpretation & Logical Reasoning

Question 58, GATE 2017: 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? A: V. B: W. C: X. D: Y.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. Represent west-to-east order by <. The first condition says V<W. The second says X<Z<V.

2. Combining these chains gives X<Z<V<W. Adding W<Y fixes the complete order as X,Z,V,W,Y.

3. The middle of five positions is the third, occupied by V. Thus A. No assumption about equal spacing or immediate adjacency is needed; the stated relative orders already determine every position.

Original paper, page 23 · Answer key

1 mark · MCQ
Report issue

Algebra, Equations & Number Patterns

Question 59, GATE 2017: A test contains 20 questions totaling 100 marks. Each multiple-choice question is worth 3 marks and each essay question 11 marks. How many multiple-choice questions are there? A:12. B:15. C:18. D:19.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. Let m be the multiple-choice count. Since there are 20 questions altogether, there are 20-m essays.

2. Total marks give 3m+11(20-m)=100. Expanding and collecting terms yields 3m+220-11m=100, so 8m=120 and m=15.

3. Check the result: 15 multiple-choice questions contribute 45 marks, and 5 essays contribute 55, totaling 100. Choose B. Using 100/20 alone gives only the average marks per question, not either question count.

Original paper, page 23 · Answer key

1 mark · MCQ
Report issue

Counting, Probability & Sets

Question 60, GATE 2017: There are 3 red, 4 green and 3 blue socks. Choose 2 socks uniformly without replacement. What is the probability that their colors match? A:1/5. B:7/30. C:1/4. D:4/15.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. There are 10 socks and C(10,2)=45 equally likely unordered pairs. Treat socks of the same color as distinct physical objects when counting outcomes.

2. Matching red pairs number C(3,2)=3; green pairs number C(4,2)=6; blue pairs number C(3,2)=3. These cases are disjoint, giving 12 favorable pairs.

3. The probability is 12/45=4/15, option D. Equivalently, ordered drawing gives (3/10)(2/9)+(4/10)(3/9)+(3/10)(2/9), with the second denominator 9 because the first sock is not replaced.

Original paper, page 24 · Answer key

2 marks · MCQ
Report issue

Reading Comprehension & Verbal Reasoning

Question 61, GATE 2017: A passage says that the culture denied merit to literary works except as handmaidens to something "seemingly more urgent", namely ideology; even private gestures were interpreted politically. Which word reveals the author's distance from the claimed importance of ideology over literature? A:culture. B:seemingly. C:urgent. D:political.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. Distinguish the culture's stated attitude from the author's endorsement of that attitude. The passage reports that ideology was treated as more urgent than literature.

2. Seemingly means apparently or on the surface. In seemingly more urgent, it qualifies the claim and suggests that the apparent superiority need not be real.

3. Culture and political identify the setting, while urgent by itself would affirm importance rather than question it. Therefore B is the intended rhetorical clue. This is an inference about tone, not a deductive proof of a complete ranking of literature and ideology.

Original paper, page 24 · Answer key

2 marks · MCQ
Report issue

Data Interpretation & Logical Reasoning

Question 62, GATE 2017: Three boxes contain only apples, only oranges, and a mixture of apples and oranges, one content type per box. Their labels Apples, Oranges, and Apples and Oranges are all wrong. You may open one box and inspect one fruit. Which label should you choose to determine all contents? A:Apples. B:Apples and Oranges. C:Oranges. D:Cannot be determined.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. Choose the box labeled Apples and Oranges. Since every label is wrong, this box is not mixed: it contains only one fruit type. Therefore the single observed fruit identifies all its contents.

2. If the sampled fruit is an apple, the mixed-labeled box contains only apples. The Oranges-labeled box cannot contain oranges and cannot be the already identified apple-only box, so it is mixed. The Apples-labeled box then contains oranges.

3. If the sample is an orange, reverse apples and oranges in the argument: the Apples-labeled box is mixed and the Oranges-labeled box contains apples. Both outcomes determine all boxes, so B. Sampling a single-fruit-labeled box cannot initially distinguish a mixed box from the other pure type.

Original paper, page 24 · Answer key

2 marks · MCQ
Report issue

Algebra, Equations & Number Patterns

Question 63, GATE 2017: X is a 30-digit positive integer whose first two digits are 47. How many decimal digits does X³ have? A:90. B:91. C:92. D:93.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. The leading digits constrain X to 47×1028 ≤ X < 48×1028, or 4.7×1029 ≤ X < 4.8×1029. We do not need the remaining 28 digits.

2. Cubing the positive bounds gives 1.03823×1089 ≤ X³ < 1.10592×1089. Both bounds lie within the interval [1089,1090).

3. A positive integer has d decimal digits exactly when it lies in [10d-1,10d). Thus X³ has 90 digits, A. Simply multiplying 30 by 3 without checking the leading coefficient would not justify the result for every 30-digit number.

Original paper, page 24 · Answer key

2 marks · MCQ
Report issue

Algebra, Equations & Number Patterns

Question 64, GATE 2017: How many roots of e^x+0.5x²-2=0 lie in [-5,5]? A:0. B:1. C:2. D:3.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Set f(x)=ex+x²/2-2. It is continuous, with f(-5)=e-5+10.5>0, f(0)=-1, and f(5)=e5+10.5>0. The intermediate value theorem therefore gives at least one root in (-5,0) and one in (0,5).

2. To rule out more roots, differentiate twice: f′(x)=ex+x and f″(x)=ex+1>0 everywhere. Hence f′ is strictly increasing and f is strictly convex.

3. Three distinct roots would, by Rolle's theorem on consecutive root intervals, force f′ to vanish twice, contradicting its strict increase. There are exactly two roots in the requested range, C.

Original paper, page 24 · Answer key

2 marks · MCQ
Report issue

Data Interpretation & Logical Reasoning

Question 65, GATE 2017: An air-pressure contour plot has contour intervals of 0.05 bar and four marked regions P,Q,R,S. P and S surround high-pressure closed contours near 0.9–0.95 bar; Q is by broadly spaced 0.75–0.8 contours; R is at the upper-left where successive contours are most tightly packed. Under the stated criterion that thunderstorm likelihood increases with the rate of pressure change over distance, choose the likeliest region. A:P. B:Q. C:R. D:S.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. A contour joins equal-pressure locations. Crossing successive contours changes pressure by the same 0.05 bar everywhere, so the relevant comparison is their spatial separation, not the absolute pressure label.

2. The magnitude of the local pressure gradient is approximately Δpressure/Δdistance. With a fixed numerator, the shortest contour spacing produces the largest gradient.

3. Therefore the question's stipulated criterion selects R, option C. The higher absolute pressures near P and S do not by themselves imply a faster spatial change; actual storm forecasting would use more than this simplified criterion.

Original paper, page 25 · Answer key

1 mark · MCQ
Report issue

Number Systems & Computer Arithmetic

Question 1, GATE 2017: A 16-bit unsigned integer is BCA9 in hexadecimal. Give its octal representation. A:571244. B:736251. C:571247. D:136251.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Step through it (13 steps)

1. Convert each hexadecimal digit into four binary bits: B=1011, C=1100, A=1010, 9=1001. The number is therefore 1011110010101001₂.

2. Octal groups binary bits in threes, starting at the least-significant end. Add two leading zeros only for grouping: 001 011 110 010 101 001.

3. These groups are 1,3,6,2,5,1, yielding 136251₈, option D. A decimal check is BCA9₁₆=48297, and 1·8⁵+3·8⁴+6·8³+2·8²+5·8+1=48297. Leading padding does not change the value.

Original paper, page 2 · Answer key

1 mark · MCQ
Report issue

Other / Mixed Topics

Question 2, GATE 2017: Match C constructs P: static char var; Q: m=malloc(10); m=NULL; R: char *ptr[10]; S: register int var1; with i: sequence of locations storing addresses; ii: variable in data section; iii: request for CPU-register storage; iv: lost allocated memory that cannot be freed through the overwritten pointer. Options give (P,Q,R,S): A:(ii,iv,i,iii), B:(ii,i,iv,iii), C:(ii,iv,iii,i), D:(iii,iv,i,ii).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. P has static storage duration, conventionally placed in the static data/BSS region rather than a function-call stack, so P→ii. This is the exam's memory-layout description; the C language itself does not mandate a particular section name.

2. Q obtains a heap allocation and then overwrites its address with NULL. Assuming allocation succeeds and no other pointer retains the address, the allocation becomes unreachable and cannot be passed to free: Q→iv. Assigning NULL does not free it.

3. R declares an array of ten pointers to char, so its elements hold addresses: R→i. S uses register as a request/hint for register allocation, not a guarantee: S→iii. The complete mapping is A.

Original paper, page 2 · Answer key

1 mark · MCQ
Report issue

Asymptotic Analysis & Recurrences

Question 3, GATE 2017: Match P:Towers of Hanoi with n disks; Q:binary search of n sorted numbers; R:worst-case heapsort of n numbers; S:addition of two n×n matrices. Complexities i:Θ(n²), ii:Θ(n log n), iii:Θ(2^n), iv:Θ(log n). Options (P,Q,R,S): A:(iii,iv,i,ii), B:(iv,iii,i,ii), C:(iii,iv,ii,i), D:(iv,iii,ii,i).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Hanoi moves n-1 disks away, moves the largest disk once, then moves n-1 disks back: T(n)=2T(n-1)+1=2n-1, so P→iii.

2. Binary search halves the candidate interval each time; after k comparisons about n/2k candidates remain. Reaching one requires Θ(log n) comparisons, so Q→iv.

3. Heapsort builds a heap in O(n) and performs n extractions costing O(log n) each in the worst case, giving Θ(n log n): R→ii. Matrix addition performs one addition at each of n² positions, giving S→i. Select C.

Original paper, page 2 · Answer key

1 mark · MCQ
Report issue

Closure Properties & Language Hierarchy

Question 4, GATE 2017: Let L1,L2 be arbitrary context-free languages and R an arbitrary regular language. Which claims always hold? I:L1∪L2 is context-free. II:complement(L1) is context-free. III:L1−R is context-free. IV:L1∩L2 is context-free. A:I,II,IV. B:I,III. C:II,IV. D:I only.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. I holds: take disjoint copies of the two grammars and add a new start production S→S1|S2. The resulting CFG generates their union.

2. III also holds because L1−R=L1∩complement(R). Regular languages are closed under complement, and a PDA for L1 can be combined with a finite automaton for complement(R). Thus the intersection remains context-free.

3. IV fails in general: {an bn cm} and {am bn cn} are CFLs, but their intersection {an bn cn} is not. II cannot hold for all CFLs either, since closure under both complement and union would imply intersection closure by De Morgan's law. Only I and III are guaranteed, B.

Original paper, page 3 · Answer key

1 mark · MCQ
Report issue

Compiler Phases, Linking & Loading

Question 5, GATE 2017: Match compiler inputs P:syntax tree, Q:character stream, R:intermediate representation, S:token stream with phases i:code generator, ii:syntax analyzer, iii:semantic analyzer, iv:lexical analyzer. Options (P,Q,R,S): A:(ii,iii,iv,i), B:(ii,i,iii,iv), C:(iii,iv,i,ii), D:(i,iv,ii,iii).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Follow the compiler pipeline from source text. The lexical analyzer reads characters and groups them into tokens, so Q→iv. The syntax analyzer reads those tokens and recognizes grammatical structure, so S→ii.

2. Semantic analysis then uses the syntax tree to check matters such as declarations, types, and compatible operations; hence P→iii.

3. After front-end processing and intermediate-code construction, the code generator translates the intermediate representation into target code, giving R→i. In the requested P,Q,R,S order the mapping is (iii,iv,i,ii), option C. Do not confuse a phase's output with its input.

Original paper, page 3 · Answer key

1 mark · MCQ
Report issue

Parsing & Syntax Analysis

Question 6, GATE 2017: Which parser-power statements are correct? I:Canonical LR is more powerful than SLR. II:SLR is more powerful than LALR. III:SLR is more powerful than canonical LR. A:I only. B:II only. C:III only. D:II and III.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. Power here refers to the class of grammars handled without parsing conflicts, with the usual one-symbol lookahead versions. The inclusion chain is SLR(1) ⊂ LALR(1) ⊂ canonical LR(1).

2. SLR uses coarse FOLLOW sets for reductions. Canonical LR uses item-specific lookahead information; LALR merges compatible LR state cores and retains more discrimination than SLR but can lose some canonical LR power.

3. Thus canonical LR can handle every SLR grammar and some additional grammars, making I true. II and III reverse the inclusion direction and are false. Choose A. This comparison is about grammar recognition capability, not parser speed or table size.

Original paper, page 3 · Answer key

1 mark · MCQ
Report issue

Processes, Threads & System Calls

Question 7, GATE 2017: Which are shared by all threads of one process? I:program counter. II:stack. III:address space. IV:registers. A:I and II. B:III only. C:IV only. D:III and IV.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. Threads belong to one process and operate in its common virtual address space, including code, global data and heap. Thus III is shared.

2. Each thread may be executing a different instruction, so it needs its own program counter and saved register values. Sharing one program counter or register context would prevent independent execution.

3. Each thread also needs its own call stack for local variables, return addresses and nested calls. Although another thread may access that stack through an address in the shared memory, the execution stack is still distinct. Hence only III is correct, B.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

File Systems

Question 8, GATE 2017: Which file-allocation schemes avoid external fragmentation? I:contiguous. II:linked. III:indexed. A:I and III. B:II only. C:III only. D:II and III.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. External fragmentation means sufficient total free space may exist but be split into separate regions, so a request needing one contiguous run cannot fit. Contiguous file allocation has this problem.

2. Linked allocation connects a file's blocks by pointers, so successive blocks can occupy arbitrary free block positions. Indexed allocation instead keeps their addresses in an index structure and likewise allows scattered blocks.

3. Both II and III avoid requiring one contiguous extent, giving D. This does not assert that every allocated block is completely used: an incompletely filled last block can still cause internal fragmentation, which is a different phenomenon.

Original paper, page 4 · Answer key

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Routing Algorithms

Question 9, GATE 2017: For IPv4 routing, assess I:RIP uses distance-vector routing; II:RIP packets use UDP; III:OSPF packets use TCP; IV:OSPF uses link-state routing. A:I,IV. B:I,II,III. C:I,II,IV. D:II,III,IV.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. RIP exchanges distance estimates with neighbors and uses a distance-vector approach, so I is true. Its routing messages are carried in UDP datagrams, making II true.

2. OSPF distributes link-state information and computes shortest paths from its link-state database, so IV is true. Its packets run directly over IP using protocol number 89, not through TCP, so III is false.

3. The true set is I,II,IV, option C. Routing algorithm type and transport encapsulation are separate properties; identifying OSPF as link-state does not imply that it uses TCP.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Calculus

Question 10, GATE 2017: Let f(x)=R sin(πx/2)+S, with f′(1/2)=√2 and ∫₀¹ f(x)dx=2R/π. Find (R,S). A:(2/π,16/π). B:(2/π,0). C:(4/π,0). D:(4/π,16/π).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Differentiate with respect to x, treating R and S as constants: f′(x)=R(π/2)cos(πx/2). At x=1/2, cos(π/4)=√2/2, so Rπ√2/4=√2. Cancel √2 to obtain R=4/π.

2. Integrate the original function: ∫₀¹ R sin(πx/2)dx=R[-(2/π)cos(πx/2)]₀¹=2R/π. The constant term contributes S.

3. The given integral equality therefore becomes 2R/π+S=2R/π, forcing S=0. The pair is (4/π,0), option C. The derivative condition alone cannot determine S.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Propositional & Predicate Logic

Question 11, GATE 2017: Let p="It is raining", q="It is cold", r="It is pleasant". Translate "It is not raining and it is pleasant, and it is not pleasant only if it is raining and it is cold." A:(¬p∧r)∧(¬r→(p∧q)). B:(¬p∧r)∧((p∧q)→¬r). C:(¬p∧r)∨((p∧q)→¬r). D:(¬p∧r)∨(r→(p∧q)).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: A structurally; B logically equivalent

1. The first clause is ¬p∧r. The phrase A only if B translates as A→B, since B is a necessary condition for A. Thus the second clause is ¬r→(p∧q). Joining clauses with and gives option A directly.

2. There is a semantic nonuniqueness in the printed alternatives. In either A or B, a true first conjunct forces p=false and r=true. Then A's implication has false antecedent ¬r, while B's implication has false antecedent p∧q. Both are true regardless of q.

3. If the first conjunct is false, both full conjunctions are false. Consequently both A and B are logically equivalent to ¬p∧r for every valuation. Preserve official answer A as the direct structural translation, but do not claim that B has a different truth table. C and D incorrectly use a disjunction between the clauses.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Data Representation & Arithmetic

Question 12, GATE 2017: A 32-bit IEEE-754 single-precision number has bits 00111110011011010000000000000000 (sign/exponent/fraction: 0 | 01111100 | 11011010000000000000000). Which listed decimal value is closest? A:1.45×10¹. B:1.45×10^-1. C:2.27×10^-1. D:2.27×10¹.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (6 steps)

1. For a normal single-precision number, value=(-1)^sign × (1.fraction)₂ × 2stored exponent-127. Here sign=0, exponent 01111100₂=124, and the exponent is therefore -3.

2. The significand is 1+2-1+2-2+2-4+2-5+2-7=1.8515625. Multiplication by 2-3 gives 0.2314453125.

3. Compare the offered approximations rather than requiring an exact match. Its distance from 0.227 is 0.0044453125, much less than its distance from 0.145; 14.5 and 22.7 are far away. Hence C. The hidden leading 1 and exponent bias are both essential.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Stacks & Queues

Question 13, GATE 2017: A circular queue uses singly linked nodes, each with one next pointer, and exactly two external pointers FRONT and REAR. For O(1) insertion and deletion, which general structural conditions hold? I:front.next points to rear. II:rear.next points to front. A:I only. B:II only. C:both. D:neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. For queue order to follow next links, the circular chain must run FRONT → second → ... → REAR → FRONT. Its closing link is therefore REAR.next=FRONT, statement II.

2. To enqueue node u, set u.next=FRONT, REAR.next=u and REAR=u. To dequeue, save the old front, advance FRONT=FRONT.next and set REAR.next=FRONT. Both require only a fixed number of pointer changes, with empty and singleton cases handled separately.

3. If links instead run backward through queue order, removing the front would require finding its predecessor by traversal. Statement I is not the general rule, even though both statements happen to hold in a two-node circle. Choose B.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Pointers & Memory

Question 14, GATE 2017: Consider C code: void printxy(int x,int y){ int *ptr; x=0; ptr=&x; y=*ptr; *ptr=1; printf("%d,%d",x,y); }. What does printxy(1,1) print? A:0,0. B:0,1. C:1,0. D:1,1.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (10 steps)

1. At function entry the local parameter values are x=1,y=1. The assignment x=0 changes x, and ptr=&x makes ptr point to the storage occupied by x.

2. The expression *ptr reads that storage, currently 0, so y=*ptr copies 0 into y. This is a value copy, not a lasting connection between y and x.

3. The next statement *ptr=1 writes into x through the pointer. Now x=1 while y remains 0. The output is 1,0, option C. C function arguments are passed by value; the original call literals do not constrain these local assignments.

Original paper, page 6 · Answer key

1 mark · MCQ
Report issue

Graph Algorithms

Question 15, GATE 2017: An undirected graph has vertices M,N,O,P,Q,R and edges MN,NO,MR,MQ,NQ,OQ,OP,PQ. Which is a possible BFS visiting order, with the first vertex as the start? A:MNOPQR. B:NQMPOR. C:QMNROP. D:POQNMR.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Step through it (4 options)

1. BFS removes vertices from a FIFO queue and discovers all vertices at a smaller distance before any at a larger distance. For D, start at P and enqueue its neighbors O then Q. The visited prefix is P,O,Q.

2. Processing O discovers N; its other neighbors P and Q are already discovered. Processing Q then discovers M, with N already queued. Processing N adds nothing, and processing M finally discovers R. The resulting order is P,O,Q,N,M,R.

3. A fails from M because O at distance 2 precedes its distance-1 neighbors Q and R. B fails from N because P at distance 2 precedes O at distance 1. C fails from Q because R at distance 2 precedes O and P at distance 1. Thus D is possible; BFS neighbor ordering need not be alphabetical.

Original paper, page 6 · Answer key

1 mark · MCQ
Report issue

Context-Free Grammars & Languages

Question 16, GATE 2017: Start variable S has grammar S→XY, X→aX|a, Y→aYb|ε. Which language is generated? A:{a^m b^n | m≥n,n>0}. B:{a^m b^n | m≥n,n≥0}. C:{a^m b^n | m>n,n≥0}. D:{a^m b^n | m>n,n>0}.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. X contributes at least one a: using aX k-1 times and then a gives ak for every k≥1. It cannot derive ε.

2. Y contributes matched numbers of a and b. Applying aYb n times and then ε gives an bn for every n≥0. Therefore XY yields ak+nbn, so m=k+n>n and n may be zero.

3. Conversely, if m>n≥0, choose k=m-n≥1 in X and n matching pairs in Y to derive the desired string. The characterization is exact, C. For example a is generated, ruling out options requiring n>0; equal counts are impossible because X supplies extra a symbols.

Original paper, page 7 · Answer key

1 mark · MCQ
Report issue

Database Models, Architecture & ER Diagrams

Question 17, GATE 2017: In an ER model, entity types A and B are related by R, which has no attributes of its own. When can the relational table for R be merged into A? A:R is one-to-many and A participates totally. B:one-to-many and A participates partially. C:many-to-one and A participates totally. D:many-to-one and A participates partially. Cardinalities are read from A to B.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Our answer: C under nonnullable merge convention

1. Merging R into A means representing an A entity's partner by storing a B key in its row, instead of using a separate relationship row. A single such field can represent at most one B partner for each A. Thus the appropriate direction is many A entities to one B entity, not one A to many B entities.

2. Under the conventional null-free merge rule, every A must have a partner so that each A row has a valid B key. Total participation provides this guarantee. These two conditions yield the intended option C.

3. The wording leaves a modeling caveat: with nullable foreign keys, an A that does not participate can use NULL, so many-to-one with partial participation, D, can also be represented in A. Official C is retained under the nonnullable conventional criterion rather than treating D as impossible in SQL generally.

Original paper, page 7 · Answer key

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Transport, Congestion Control & Traffic Shaping

Question 18, GATE 2017: On Linux, a connected UDP socket is one on which connect has been called. Assess I:A connected UDP socket can communicate with multiple peers simultaneously. II:A process can successfully call connect again on an already connected UDP socket. A:I only. B:II only. C:both. D:neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Our answer: B under single bidirectional peer interpretation

1. UDP connect does not establish a TCP-like reliable connection. It associates a default destination with the socket and ordinarily restricts incoming datagrams to that peer, allowing send/write calls without specifying an address.

2. Another connect call can change the peer association, so II is true. Under the exam's interpretation of communicate as simultaneous default, bidirectional peer associations, I is false and the intended answer is B.

3. Preserve the Linux API caveat: a connected UDP socket may still send a datagram to another destination explicitly supplied to sendto/sendmsg. Thus it is inaccurate to say that a connected UDP socket can never send to multiple peers. The unique B answer relies on the bidirectional/default-peer interpretation.

Original paper, page 7 · Answer key

1 mark · NAT
Report issue

Database Models, Architecture & ER Diagrams

Question 19, GATE 2017: T1(P,Q) contains (2,2),(3,8),(7,3),(5,8),(6,9),(8,5),(9,8). T2(R,S) contains (2,2),(8,3),(3,2),(9,7),(5,7),(7,2). P and R are their primary keys. T1.Q references T2.R with ON DELETE CASCADE and ON UPDATE CASCADE. T2.S references T1.P with ON DELETE SET NULL and ON UPDATE CASCADE. Delete (3,8) from T1. How many additional T1 records must be deleted?
Tap to enlarge
Answer & solution

Official answer: 0.0

Our answer: 0

1. Follow the incoming foreign-key references to the deleted key P=3. In T2, only row (R=8,S=3) references this value through S. Its specified action is ON DELETE SET NULL, so it becomes (8,NULL).

2. Crucially, this action neither deletes the T2 row nor changes its primary key R=8. The references from T1.Q to T2.R remain valid, including Q=8 values in other T1 rows.

3. T1's ON DELETE CASCADE would apply if a referenced T2 row were deleted; that has not happened. Nor has a referenced primary key been updated. Thus no cascade returns to T1 and the number of additional deletions is 0. A change to a foreign-key field is not automatically a change to the key referenced by the opposite table.

Original paper, page 8 · Answer key

1 mark · NAT
Report issue

IP Addressing, Fragmentation & Address Resolution

Question 20, GATE 2017: What is the maximum number of IPv4 router addresses that can be listed in the Record Route (RR) option field of one IPv4 header?
Tap to enlarge
Answer & solution

Official answer: 9.0

Our answer: 9

1. The IPv4 IHL field can specify at most 15 words of 4 bytes, giving a 60-byte maximum header. The fixed header takes 20 bytes, leaving at most 40 for options and padding.

2. The Record Route option uses three control bytes: type, length and pointer. Therefore at most 40-3=37 bytes remain for recorded addresses. Each IPv4 address needs 4 bytes.

3. The maximum integer count is floor(37/4)=9. Nine addresses occupy 36 bytes plus 3 control bytes, and one padding byte brings the header options area to 40. Ten addresses would need 43 option bytes and cannot fit.

Original paper, page 8 · Answer key

1 mark · NAT
Report issue

Partial Orders & Lattices

Question 21, GATE 2017: Let X={a,b,c,d,e}. The partial order includes reflexive pairs and (a,b),(a,c),(a,d),(a,e),(b,c),(b,e),(c,e),(d,e). Its Hasse diagram has two upward chains a<b<c<e and a<d<e. What minimum number of ordered pairs must be added to make it a lattice?
Tap to enlarge
Answer & solution

Official answer: -0.01

Our answer: 0

1. A lattice requires a unique greatest lower bound (meet) and least upper bound (join) for every pair of elements. A pair of comparable elements already has these: the smaller is their meet and the larger their join.

2. In this diagram the only incomparable unordered pairs are {b,d} and {c,d}. For either pair, the only common lower bound is a and the only common upper bound is e. Hence their meet is a and their join is e.

3. All pairs therefore already have the required bounds, so no ordered pair needs adding: answer 0. This is the pentagon lattice, which need not be distributive; being nondistributive does not prevent it from being a lattice.

Original paper, page 9 · Answer key

1 mark · NAT
Report issue

Linear Algebra

Question 22, GATE 2017: P=[[1,1,-1],[2,-3,4],[3,-2,3]] and Q=[[-1,-2,-1],[6,12,6],[5,10,5]]. Find rank(P+Q).
Tap to enlarge
Answer & solution

Official answer: 2.0

Our answer: 2

1. Add corresponding entries to obtain A=P+Q=[[0,-1,-2],[8,9,10],[8,8,8]]. Rank concerns the number of independent rows or columns of this sum, not the sum of the separate ranks.

2. Row 3 equals row 1 plus row 2: (0,-1,-2)+(8,9,10)=(8,8,8). Therefore the three rows are dependent and rank(A)≤2.

3. Rows 1 and 2 are independent since the first coordinate of row 1 is zero while that of row 2 is 8, and row 1 is nonzero. Equivalently, the upper-left 2×2 minor has determinant 0·9-(-1)·8=8≠0. Thus rank(A)=2.

Original paper, page 9 · Answer key

1 mark · NAT
Report issue

Graph Theory

Question 23, GATE 2017: An undirected graph G has n vertices and 25 edges, and every vertex has degree at least 3. What is the maximum possible n?
Tap to enlarge
Answer & solution

Official answer: 16.0

Our answer: 16

1. By the handshaking lemma, the sum of all vertex degrees is twice the edge count, 50. Since each of n vertices contributes at least 3, we have 3n≤50. Therefore n≤floor(50/3)=16.

2. A numerical upper bound is not enough; show that 16 is attainable. Start with a cycle on 16 vertices, providing 16 edges and degree 2 at each vertex. Add the 8 edges joining opposite vertices around the cycle. This gives a simple 3-regular graph with 24 edges.

3. Add any further edge not already present. It raises two degrees to 4 and leaves all others at 3, with exactly 25 edges and 16 vertices. Thus the maximum is indeed 16.

Original paper, page 9 · Answer key

1 mark · NAT
Report issue

Number Systems & Computer Arithmetic

Question 24, GATE 2017: The quadratic x²−13x+36=0 has its coefficients written in base b. Its roots in that same base are the single digits 5 and 6. Find b.
Tap to enlarge
Answer & solution

Official answer: 8.0

Our answer: 8

Step through it (5 steps)

1. Because 5 and 6 are single digits, their numerical values are 5 and 6, while the coefficient 13_b means b+3 and 36_b means 3b+6. The base must exceed 6 to admit all displayed digits.

2. For a monic quadratic, the sum of the roots equals the coefficient subtracted from x. Thus 5+6=b+3, which gives b=8.

3. Check the product condition as well: 5·6=30, and 36_8=3·8+6=30. Both coefficient relations agree, and digits 0 through 6 are legal in base 8. Hence the answer is 8, not a decimal interpretation of 13 and 36.

Original paper, page 10 · Answer key

1 mark · NAT
Report issue

Finite Automata

Question 25, GATE 2017: Find the minimum number of states of a complete DFA accepting L={w1 a w2 | w1,w2∈{a,b}*, |w1|=2, |w2|≥3}.
Tap to enlarge
Answer & solution

Official answer: 8.0

Our answer: 8

Step through it (2 parts)

1. The first two symbols may be arbitrary, the third must be a, and at least three further symbols must follow. Thus accepted strings have length at least 6 and third symbol a.

2. Construct three states for having read 0,1,2 prefix symbols. From the third of these, a enters a suffix-count state and b enters a rejecting dead state. Use four suffix states for 0,1,2,at least 3 symbols after the required a. The last is accepting and loops on both symbols; the dead state also loops on both. Total: 3+4+1=8 states.

3. To prove minimality, the seven nondead states have distinct shortest accepting continuation lengths 6,5,4,3,2,1,0. For two states, a shortest accepting suffix from the one with smaller required length is too short from the other, distinguishing them. The dead state has no accepting continuation at all. All eight are necessary.

Original paper, page 10 · Answer key

2 marks · MCQ
Report issue

Probability & Statistics

Question 26, GATE 2017: P and Q may apply for a job. Given Pr(P)=1/4, Pr(P|Q)=1/2 and Pr(Q|P)=1/3, find Pr(not P | not Q). A:4/5. B:5/6. C:7/8. D:11/12.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. Conditional probability gives Pr(P∩Q)=Pr(Q|P)Pr(P)=(1/3)(1/4)=1/12. Use the other conditional to find Pr(Q): (1/12)/Pr(Q)=1/2, so Pr(Q)=1/6.

2. Inclusion-exclusion gives Pr(P∪Q)=1/4+1/6-1/12=1/3. Therefore the probability of neither event is Pr(not P∩not Q)=2/3.

3. Conditioning on not Q restricts the denominator to Pr(not Q)=5/6. Hence the requested probability is (2/3)/(5/6)=4/5, A. Independence was not given and must not be assumed; in fact the supplied conditional probabilities do not equal the unconditional ones.

Original paper, page 10 · Answer key

2 marks · MCQ
Report issue

Boolean Algebra & Logic Gates

Question 27, GATE 2017: For Boolean variables w,x,y,z (juxtaposition=AND, +=OR, ¬=NOT), which equality is incorrect? A:wx+w(x+y)+x(x+y)=x+wy. B:¬[w¬x(y+¬z)]+¬w x=¬w+x+¬y z. C:[w¬x(y+x¬z)+¬w¬x]y=x¬y. D:(w+y)(wxy+wyz)=wxy+wyz.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Check C by expanding its left side: w¬xyy+w¬xx¬zy+¬w¬xy. Since yy=y and ¬xx=0, this reduces to w¬xy+¬w¬xy=¬xy(w+¬w)=¬xy. The stated right side is x¬y, a different function.

2. A concrete counterexample is x=0,y=1, with any w,z. C then equates 1 with 0, so it is incorrect.

3. Verify the alternatives: A expands to wx+wx+wy+x+xy=x+wy by absorption. In B, De Morgan gives ¬w+x+¬y z for the complemented product; the extra ¬w x is absorbed. In D, every product inside the second factor already implies w+y, so multiplying by w+y changes nothing. C is uniquely false.

Original paper, page 10 · Answer key

2 marks · MCQ
Report issue

Logic Minimization & Karnaugh Maps

Question 28, GATE 2017: Given f(w,x,y,z)=Σm(0,1,2,3,7,8,10)+Σd(5,6,11,15), where d marks don't-cares, choose a minimum product-of-sums expression. A:(¬w+¬z)(¬x+z). B:(¬w+z)(x+z). C:(w+z)(¬x+z). D:(w+¬z)(¬x+z).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (12 steps)

1. For a POS minimization, group zeros rather than ones. Of the sixteen minterms, the required zeros are 4,9,12,13,14; entries 5,6,11,15 may be assigned as convenient.

2. The group {9,11,13,15} has w=1,z=1 throughout, so it contributes wz to the complement f′. The group {4,6,12,14} has x=1,z=0, contributing x¬z. Together these cover every required zero without covering any required one.

3. Thus f′=wz+x¬z. Complementing by De Morgan yields f=(¬w+¬z)(¬x+z), A. Both groups are needed: zero 9 is not covered by x¬z and zero 4 is not covered by wz. No single-literal zero group avoids all required ones, so the two two-literal clauses form a minimum POS.

Original paper, page 11 · Answer key

2 marks · MCQ
Report issue

Cache Memory

Question 29, GATE 2017: L1 and L2 cache access times are 1 and 8 cycles. The additional L2-to-memory miss penalty is 18 cycles. The L1 miss rate is twice the L2 miss rate. Given AMAT=2 cycles, find the rates (L1,L2). A:(0.111,0.056). B:(0.056,0.111). C:(0.0892,0.1784). D:(0.1784,0.0892).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. Let m be the local L2 miss rate, conditional on reaching L2. The L1 miss rate is 2m. Every access pays 1 cycle, an L1 miss adds 8, and an L2 miss on that path adds 18.

2. Therefore 2=1+2m(8+18m). Expanding gives 36m²+16m-1=0. The quadratic formula gives m=(-16±√400)/72, so its nonnegative root is 4/72=1/18; the other root is invalid as a probability.

3. Thus L2 misses about 0.05556 and L1 misses 1/9≈0.11111. In the requested L1,L2 order, the rounded pair is A. Treating the L2 rate as a global rate, or charging lower-level time on every hit, would give a different model.

Original paper, page 11 · Answer key

2 marks · MCQ
Report issue

Asymptotic Analysis & Recurrences

Question 30, GATE 2017: T(n)=2T(√n)+1 for n>2, and T(n)=2 for 0<n≤2. What is its asymptotic order? A:Θ(log log n). B:Θ(log n). C:Θ(√n). D:Θ(n).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. The argument shrinks by square root, so transform to its logarithm. Put m=log₂n and S(m)=T(2m). Since √(2m)=2m/2, the recurrence becomes S(m)=2S(m/2)+1 with a constant base for m≤1.

2. This is a binary recursion tree with Θ(m) leaves and Θ(m) total nodes. Equivalently, the Master theorem has a=2,b=2 and f(m)=1, giving S(m)=Θ(m).

3. Substituting back gives T(n)=Θ(log n), option B. The recursion depth is only Θ(log log n), but each level branches into twice as many subproblems. Counting depth alone misses the total work.

Original paper, page 11 · Answer key

2 marks · MCQ
Report issue

Probability & Statistics

Question 31, GATE 2017: For a discrete random variable X with probabilities p_j on j=0,…,N, define g_X(z)=Σ(j=0 to N)p_j z^j. Suppose g_Y(z)=(1−β+βz)^N with β∈[0,1]. Find E[Y]. A:Nβ(1−β). B:Nβ. C:N(1−β). D:not expressible from N and β alone.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. Differentiate the definition of the probability generating function: g′_Y(z)=Σ(j=1 to N)j pj zj-1. Evaluating at z=1 leaves Σj pj, exactly E[Y].

2. By the chain rule, differentiating the supplied polynomial gives g′_Y(z)=Nβ(1−β+βz)N-1. At z=1 the parenthesized expression is 1, so g′_Y(1)=Nβ.

3. Therefore B is correct. The generating function also identifies a binomial distribution, whose variance is Nβ(1−β), the distractor A. The mean formula remains valid for β=0 or 1 and for the degenerate N=0 case.

Original paper, page 12 · Answer key

2 marks · MCQ
Report issue

Parsing & Syntax Analysis

Question 32, GATE 2017: Grammar G is E→E−T|T, T→T+F|F, F→(E)|id. Choose an equivalent grammar without left recursion. A:the same grammar. B:E→TE′, E′→−TE′|ε, T→T+F|F, F→(E)|id. C:E→TX, X→−TX|ε, T→FY, Y→+FY|ε, F→(E)|id. D:E→TX|(TX), X→−TX|+TX|ε, T→id.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Apply the standard direct-left-recursion transformation A→Aα|β becomes A→βA′, A′→αA′|ε. For E, α is −T and β is T, giving E→TX and X→−TX|ε.

2. Apply it separately to T: α is +F and β is F, giving T→FY and Y→+FY|ε. Keep F→(E)|id so arbitrarily nested factors remain possible. These are exactly option C.

3. A leaves both original recursions intact. B fixes E but leaves T→T+F directly left-recursive. D restricts T to id and cannot generate nested expressions such as ((id)) or parentheses as arbitrary factors. The transformation preserves the generated strings, although semantic associativity must be handled when constructing evaluation actions.

Original paper, page 12 · Answer key

2 marks · MCQ
Report issue

Deadlocks

Question 33, GATE 2017: A system has 9 tape drives. Processes (current allocation,maximum requirement) are P1:(3,7), P2:(1,6), P3:(3,5). Classify the state. A:safe,deadlocked. B:safe,not deadlocked. C:not safe,deadlocked. D:not safe,not deadlocked.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (5 steps)

1. Current allocations total 3+1+3=7, leaving 9-7=2 drives available. Remaining maximum needs are P1:7-3=4, P2:6-1=5, P3:5-3=2.

2. P3 can receive its remaining two drives and finish. It then returns all five drives, leaving five available to the other processes. Equivalently, in the safety simulation add its existing allocation 3 to the current available count 2.

3. Now P1 can finish and release its three previously allocated drives, raising available to 8; P2 can then finish. Thus P3,P1,P2 is a safe sequence (P3,P2,P1 also works). Existence of a safe sequence establishes safe and not deadlocked, B.

Original paper, page 13 · Answer key

2 marks · MCQ
Report issue

Data Link, Framing, Error Control & ARQ

Question 34, GATE 2017: A binary code has valid words 00000,01011,10101,11110. Let p be its minimum Hamming distance and q the maximum guaranteed correctable number of bit errors. A:p=3,q=1. B:p=3,q=2. C:p=4,q=1. D:p=4,q=2.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (8 steps)

1. Hamming distance counts differing positions, obtainable by counting ones in the XOR. Against 00000 the other three words have weights 3,3,4, giving the first three distances.

2. The remaining pairs have distances d(01011,10101)=4, d(01011,11110)=3 and d(10101,11110)=3. Hence the minimum over all six pairs is p=3.

3. To correct every pattern of q errors, radius-q neighborhoods of distinct codewords must not overlap, requiring 2q<p. Thus q=floor((p-1)/2)=1. Select A. A distance-3 code can detect two errors, but guaranteed correction of two errors would require minimum distance at least 5.

Original paper, page 13 · Answer key

2 marks · MCQ
Report issue

Physical Layer & Transmission

Question 35, GATE 2017: Hosts X and Y have a direct link of rate 10^6 bits/s, length 10,000 km, and propagation speed 2×10^8 m/s. X continuously sends 50,000 bytes as one large message. Find transmission p and propagation q delays in ms. A:(50,100). B:(50,400). C:(100,50). D:(400,50).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. Transmission delay is the time to put all message bits onto the link. Convert bytes to bits: 50,000×8=400,000 bits. Divide by 106 bits/s to get 0.4 seconds, or p=400 ms.

2. Propagation delay is the travel time of a bit from one end to the other. Convert the distance: 10,000 km=107 m. Divide by 2×108 m/s to get 0.05 seconds, or q=50 ms.

3. Thus D gives the requested ordered pair. These are different delays: message size affects transmission, while distance affects propagation. Under the ideal assumptions the last bit arrives after their sum, 450 ms, but the question asks for the two components separately.

Original paper, page 13 · Answer key

2 marks · MCQ
Report issue

Binary Search & Balanced Trees

Question 36, GATE 2017: A binary search tree has preorder 12,8,6,2,7,9,10,16,15,19,17,20. Which is its postorder? A:2,6,7,8,9,10,12,15,16,17,19,20. B:2,7,6,10,9,8,15,17,20,19,16,12. C:7,2,6,8,9,10,20,17,19,15,16,12. D:7,6,2,10,9,8,15,16,17,20,19,12.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (27 steps)

1. Preorder visits root,left,right, so the first value 12 is the root. The contiguous values below 12 form its left preorder 8,6,2,7,9,10; the remaining values form right preorder 16,15,19,17,20.

2. Reconstruct the left side: root 8 has left root 6 with children 2 and 7, and right root 9 with right child 10. Its left-right-root postorder is 2,7,6,10,9,8.

3. On the right, root 16 has left child 15 and right root 19 with children 17 and 20. Its postorder is 15,17,20,19,16. Concatenate left postorder, right postorder and final root 12, obtaining B. Sorting the values would instead produce inorder, not postorder.

Original paper, page 14 · Answer key

2 marks · MCQ
Report issue

Control Flow & Loop Tracing

Question 37, GATE 2017: Unsigned integers x,y,q,r are used for division by repeated subtraction: while(r>=y){r=r-y; q=q+1;}. Which initial condition guarantees termination and final x==y*q+r? A:(q==r)&&(r==0). B:(x>0)&&(r==x)&&(y>0). C:(q==0)&&(r==x)&&(y>0). D:(q==0)&&(y>0).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. To preserve the intended division relation, use the invariant x=yq+r. Option C initializes q=0 and r=x, so the invariant holds before the loop. It also ensures y>0.

2. One iteration replaces r by r-y and q by q+1. Therefore y(q+1)+(r-y)=yq+r=x: the invariant is preserved. The guard r≥y prevents unsigned subtraction underflow.

3. Since y is positive, r decreases on every iteration and cannot decrease forever. At exit 0≤r<y, so q and r are the quotient and remainder. B leaves q unconstrained, D leaves r unconstrained, and A neither establishes the invariant for arbitrary x nor excludes y=0. C is the sufficient condition.

Original paper, page 14 · Answer key

2 marks · MCQ
Report issue

Asymptotic Analysis & Recurrences

Question 38, GATE 2017: For positive n, C code executes: for(i=1;i<=n;i++){ for(j=1;j<n;j+=i){ printf(" %d %d",i,j); } }. Find its Θ time complexity, treating each iteration/output as unit cost. A:Θ(n√n). B:Θ(n²). C:Θ(n log n). D:Θ(n² log n).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Fix i. The inner-loop j values are 1,1+i,1+2i,… below n, so there are ceil((n-1)/i) iterations. The step size is i, not 1; different outer-loop iterations therefore have different costs.

2. Sum over i=1,…,n. Ignoring rounding gives (n-1)Σ1/i=(n-1)Hn. Rounding adds at most n operations, and Hn=Θ(log n), so the total is Θ(n log n).

3. The outer-loop overhead is only Θ(n) and does not change the result, giving C. This is the conventional unit-cost model used by the question. Counting the individual decimal digits written by printf, or fixed-width integer overflow at extreme n, would be a different analysis from the intended asymptotic loop count.

Original paper, page 14 · Answer key

2 marks · MCQ
Report issue

Finite Automata

Question 39, GATE 2017: An ε-NFA has transition table (ε,a,b): q0→({q2},{q1},{q0}); q1→({q2},{q2},{q3}); q2→({q0},∅,∅); q3→(∅,∅,{q2}). Compute the extended transition from q2 on aba. A:∅. B:{q0,q1,q3}. C:{q0,q1,q2}. D:{q0,q2,q3}.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (4 steps)

1. Begin with ε-closure({q2}), not just {q2}. The ε edge reaches q0, whose ε edge returns to q2, so the starting set is {q0,q2}.

2. Read the first a: only q0 has an a transition, to q1. The ε-closure of q1 adds q2 and q0, giving {q0,q1,q2}. Read b next: q0 goes to q0 and q1 to q3; q2 has no b move. Closing {q0,q3} under ε adds q2, giving {q0,q2,q3}.

3. Read the final a: only q0 contributes q1. Its ε-closure is again {q0,q1,q2}, option C. Applying ε-closure both before input and after every consumed symbol is essential; ε transitions do not consume letters of aba.

Original paper, page 15 · Answer key

2 marks · MCQ
Report issue

Context-Free Grammars & Languages

Question 40, GATE 2017: L1={a^p | p prime}; L2={a^n b^m c^(2m) | n,m≥0}; L3={a^n b^n c^(2n) | n≥0}; L4={a^n b^n | n≥1}. Which claims hold? I:L1 is CFL but not regular. II:L2 is not CFL. III:L3 is not CFL but recursive. IV:L4 is deterministic CFL. A:I,II,IV. B:II,III. C:I,IV. D:III,IV.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. I is false. If L1 were context-free, choose a prime q above its pumping length. Any pumping decomposition increases the unary length by a positive d when pumped once extra. Pumping q extra copies gives length q+qd=q(1+d), a composite number, contradicting membership.

2. II is false: a CFG for L2 is S→aS|B and B→bBcc|ε. It independently generates any number of a symbols, then matches each b with two c symbols.

3. III is true. L3 is decidable by checking symbol order and counting the three runs. If it were CFL, inverse homomorphism under h(a)=a,h(b)=b,h(c)=cc would make {an bn cn} context-free, a contradiction to that standard non-CFL result. IV is true: a deterministic PDA pushes for a symbols, switches on the first b and pops for each b, accepting exactly matching positive counts. Therefore III and IV, D.

Original paper, page 15 · Answer key

2 marks · MCQ
Report issue

Decidability & Computability

Question 41, GATE 2017: Which problems are undecidable? I:given regular expression R and string w, test w∈L(R). II:given CFG G, test L(G)=∅. III:given CFG G over Σ, test L(G)=Σ*. IV:given Turing machine M and string w, test w∈L(M). A:I,IV. B:II,III. C:II,III,IV. D:III,IV.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. I is decidable: convert the regular expression to a finite automaton and simulate it on the finite input string. The simulation terminates after processing the input.

2. II is decidable: repeatedly mark CFG variables that can derive terminal strings, beginning with terminal-only or ε productions. Because there are finitely many variables the marking reaches a fixed point. The language is nonempty exactly when the start variable is marked.

3. III is the general CFG universality problem, which is undecidable. IV is Turing-machine acceptance, also undecidable: simulation may run forever on a rejected/nonaccepted input, so it is only a recognizer, not a decider. Thus the undecidable pair is III and IV, D. Do not confuse decidable CFG membership or emptiness with universality.

Original paper, page 16 · Answer key

2 marks · MCQ
Report issue

Counters & Timing

Question 42, GATE 2017: A two-bit saturating up-counter has next states 00→01,01→10,10→11,11→11. It uses synchronous T flip-flops for bits Q1,Q0. Choose (T1,T0). A:(Q1Q0,¬Q1¬Q0). B:(¬Q1Q0,¬Q1+¬Q0). C:(Q1+Q0,¬Q1+¬Q0). D:(¬Q1Q0,Q1+Q0).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. A T flip-flop holds its state when T=0 and toggles when T=1. Thus its required input is T=Q XOR Qnext; compute it separately for each bit.

2. For current states 00,01,10,11, the high-bit toggle requirements are 0,1,0,0. Only state 01 toggles Q1, giving T1=¬Q1·Q0. The low-bit requirements are 1,1,1,0, since Q0 changes on every transition except the saturated 11→11.

3. Therefore T0=¬(Q1Q0)=¬Q1+¬Q0. This pair is B. In particular the final state must hold rather than wrap to 00, so both T inputs must be zero at 11.

Original paper, page 16 · Answer key

2 marks · NAT
Report issue

Arrays & Strings

Question 43, GATE 2017: C code initializes array[]={3,5,1,4,6,2}, done=0. While done==0, set done=1; for i=0..4, if array[i]<array[i+1], swap them and set done=0; then for i=5..1 descending, if array[i]>array[i-1], swap them and set done=0. After the loop printf("%d",array[3]). swap exchanges the two addressed values. What is printed?
Tap to enlarge
Answer & solution

Official answer: 3.0

Our answer: 3

Step through it (32 steps)

1. Both passes correct adjacent pairs toward descending order. In the forward pass a smaller value on the left is swapped right; in the backward pass a larger value on the right is swapped left. The initial forward pass changes [3,5,1,4,6,2] into [5,3,4,6,2,1].

2. Its backward pass produces [6,5,3,4,2,1]. In the next forward pass the remaining out-of-order pair 3,4 swaps, producing [6,5,4,3,2,1]; the backward pass then makes no changes.

3. Because a swap occurred, done remains 0 and one more full iteration verifies that no swaps are needed. Every strict adjacent inversion swap decreases a finite inversion count, so termination is justified. The final zero-based index 3 contains 3, which is printed. Index 3 means the fourth element, not the third.

Original paper, page 17 · Answer key

2 marks · NAT
Report issue

Transactions & Concurrency Control

Question 44, GATE 2017: Transactions are T1:r1(X),w1(X),r1(Y),w1(Y) and T2:r2(Y),w2(Y),r2(Z),w2(Z). Here r and w denote read and write operations. How many order-preserving interleavings of the eight operations are conflict serializable?
Tap to enlarge
Answer & solution

Official answer: 54.0

Our answer: 54

1. Each schedule is an interleaving of four operations from each transaction, so there are C(8,4)=70 candidates. Only Y is shared; read/write or write/write pairs on Y create precedence-graph edges. A schedule is serializable precisely when it does not create edges in both directions.

2. For order T1→T2, w1(Y) must precede r2(Y). Since these are respectively the last T1 and first T2 operations, this requires the single serial schedule 11112222, where digits identify transactions.

3. For order T2→T1, w2(Y) must precede r1(Y): the second 2 must occur before the third 1. Count its complement, third 1 before second 2. If the third 1 occurs at position 3, the prefix is 111 and the last 1 has 5 possible positions. If it occurs at position 4, the first three positions contain two 1s and one 2 in 3 arrangements, and the final 1 has 4 positions. The complement has 5+12=17 schedules, so this serial order has 70-17=53.

4. The two acyclic cases are disjoint, yielding 1+53=54. This counts conflict serializability, not only the two fully serial schedules. Independent enumeration of all 70 order-preserving interleavings confirms the count.

Original paper, page 18 · Answer key

2 marks · NAT
Report issue

Cache Memory

Question 45, GATE 2017: I-cache read time/hit ratio:2 ns/0.8; D-cache:2 ns/0.9; shared L2:8 ns/0.9. Main-memory read time is 90 ns. Caches are direct mapped, use referred-word-first and write-back, and every dirty bit is 0. Of reads,60% fetch instructions and 40% fetch operands. Find average read time in ns to two decimals.
Tap to enlarge
Answer & solution

Official answer: 4.72

1. Compute the chance of reaching L2 by weighting the two L1 miss rates: 0.6(1-0.8)+0.4(1-0.9)=0.12+0.04=0.16. Every read first pays the 2 ns L1 lookup.

2. Conditional on an L1 miss, the L2 lookup adds 8 ns. Its local miss probability is 0.1, and such a miss adds 90 ns for memory. The expected additional time on an L1 miss is therefore 8+0.1·90=17 ns.

3. AMAT=2+0.16·17=4.72 ns. As a separate check, instruction reads average 2+0.2·17=5.4 ns and data reads 2+0.1·17=3.7 ns; 0.6·5.4+0.4·3.7=4.72. Clean blocks eliminate dirty write-back penalties, and referred-word-first permits the demanded read to finish without waiting for an unspecified whole-block transfer.

Original paper, page 18 · Answer key

2 marks · NAT
Report issue

SQL & Queries

Question 46, GATE 2017: top_scorer(player,country,goals) rows: Klose,Germany,16; Ronaldo,Brazil,15; G Müller,Germany,14; Fontaine,France,13; Pelé,Brazil,12; Klinsmann,Germany,11; Kocsis,Hungary,11; Batistuta,Argentina,10; Cubillas,Peru,10; Lato,Poland,10; Lineker,England,10; T Müller,Germany,10; Rahn,Germany,10. 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'). How many tuples result?
Tap to enlarge
Answer & solution

Official answer: 7.0

Our answer: 7

1. The Spain subquery returns no rows. A comparison quantified by ALL over an empty set is true, because there is no counterexample. Hence the first predicate eliminates none of the outer rows.

2. The Germany subquery returns goals 16,14,11,10,10. The >ANY condition requires exceeding at least one of them, so with these non-NULL values it is equivalent to goals>10, not goals>16.

3. Seven rows have goal counts above 10: 16,15,14,13,12,11,11. They yield Klose,Ronaldo,G Müller,Fontaine,Pelé,Klinsmann,Kocsis, so the result has 7 tuples. The query does not say DISTINCT, but these seven selected player values are distinct anyway. Empty ALL and empty ANY behave differently.

Original paper, page 19 · Answer key

2 marks · NAT
Report issue

Recurrences & Generating Functions

Question 47, GATE 2017: The ordinary generating function of sequence (a_n) for n≥0 is (1+z)/(1−z)³. Find a3−a0.
Tap to enlarge
Answer & solution

Official answer: 15.0

Our answer: 15

1. Use the binomial-series identity (1-z)-3=Σ(n≥0)C(n+2,2)zn. Its first coefficients are 1,3,6,10,… .

2. Multiplication by 1+z adds each coefficient to the preceding one. Thus a0=1 and a3=C(5,2)+C(4,2)=10+6=16. Directly, (1+z)(1+3z+6z²+10z³+…)=1+4z+9z²+16z³+… .

3. Therefore a3-a0=16-1=15. More generally an=C(n+2,2)+C(n+1,2)=(n+1)² for n≥1. The numerator shifts coefficients; it cannot simply be ignored when reading a3.

Original paper, page 19 · Answer key

2 marks · NAT
Report issue

Probability & Random Variables

Question 48, GATE 2017: X has a Poisson distribution with mean 5. Find E[(X+2)²].
Tap to enlarge
Answer & solution

Official answer: 54.0

Our answer: 54

1. A Poisson variable has variance equal to its mean, so E[X]=5 and Var(X)=5. The second-moment identity Var(X)=E[X²]-(E[X])² gives E[X²]=5+25=30.

2. Expand before taking expectations: (X+2)²=X²+4X+4. Linearity of expectation therefore gives E[(X+2)²]=30+4·5+4=54.

3. A useful check is Var(X+2)+(E[X+2])²=5+7²=54, since adding a constant does not change variance. Squaring the mean alone would give 49 and omit the variance contribution.

Original paper, page 20 · Answer key

2 marks · NAT
Report issue

B-Trees & Multiway Search Trees

Question 49, GATE 2017: In a B+ tree, search keys occupy 8 bytes, blocks are 512 bytes, and block pointers occupy 2 bytes. What is the maximum order of the tree?
Tap to enlarge
Answer & solution

Official answer: 52.0

Our answer: 52

1. Use the conventional definition of order m as the maximum number of child pointers in an internal node. Such a node needs m pointers and m-1 separator keys, since keys separate adjacent child ranges.

2. The capacity inequality is 2m+8(m-1)≤512. Expanding gives 10m-8≤512, hence 10m≤520 and m≤52.

3. At m=52, the node uses 104 pointer bytes plus 408 key bytes, exactly 512. Increasing to 53 would require 522 bytes, so the maximum is 52. This is an internal-node calculation that ignores unspecified metadata; a different convention defining order as the number of keys must not be substituted silently.

Original paper, page 20 · Answer key

2 marks · NAT
Report issue

Greedy Algorithms

Question 50, GATE 2017: A message uses symbols P,Q,R,S,T with probabilities 0.22,0.34,0.17,0.19,0.08 respectively. For a 100-character message encoded with binary Huffman coding, what is the expected encoded length in bits?
Tap to enlarge
Answer & solution

Official answer: 225.0

Our answer: 225

1. Huffman coding repeatedly merges the two smallest current weights. Merge T and R:0.08+0.17=0.25. Next merge S and P:0.19+0.22=0.41. The remaining weights are 0.25,0.34,0.41; merge 0.25+0.34=0.59, then 0.41+0.59=1.

2. The resulting depths are 2 for P,Q,S and 3 for R,T. One valid code assignment is S=00,P=01,T=100,R=101,Q=11; swapping branch labels changes codewords but not lengths.

3. Expected bits per symbol are 2(0.22+0.34+0.19)+3(0.17+0.08)=1.5+0.75=2.25. Equivalently sum the merge weights 0.25+0.41+0.59+1=2.25. For 100 symbols the expectation is 225 bits, excluding codebook/container overhead. It is an expectation, not a guarantee for every possible 100-symbol sequence.

Original paper, page 20 · Answer key

2 marks · NAT
Report issue

CPU Scheduling

Question 51, GATE 2017: Processes have (arrival time,CPU burst,priority), all times in ms: P1:(0,11,2), P2:(5,28,0), P3:(12,2,3), P4:(2,10,1), P5:(9,16,4). Priority 0 is highest, there are no I/O bursts, and scheduling is preemptive priority with zero unspecified switching overhead. Find average waiting time.
Tap to enlarge
Answer & solution

Official answer: 29.0

Our answer: 29

Step through it (10 steps)

1. P1 starts at 0. At 2, higher-priority P4 arrives and preempts it; P1 has 9 ms left. At 5, highest-priority P2 arrives and preempts P4, which has 7 ms left. P2 runs uninterrupted to 33; later arrivals P5 and P3 have lower priorities.

2. Among waiting processes, run P4 from 33–40, P1 from 40–49, P3 from 49–51, then P5 from 51–67. Completion times are C1=49,C2=33,C3=51,C4=40,C5=67.

3. With no I/O, waiting time equals completion minus arrival minus CPU burst. Thus W1=49-0-11=38; W2=33-5-28=0; W3=51-12-2=37; W4=40-2-10=28; W5=67-9-16=42. The total is 145, so the average is 145/5=29 ms. Do not confuse waiting time with turnaround, which also includes execution.

Original paper, page 21 · Answer key

2 marks · NAT
Report issue

Linear Algebra

Question 52, GATE 2017: A real 3×3 matrix has characteristic polynomial λ³−4λ²+aλ+30. One eigenvalue is 2. Find the largest absolute value among its eigenvalues.
Tap to enlarge
Answer & solution

Official answer: 5.0

Our answer: 5

1. An eigenvalue is a root of the characteristic polynomial. Substitute λ=2: 8-16+2a+30=0, so 2a+22=0 and a=-11.

2. The polynomial becomes λ³-4λ²-11λ+30. Divide by λ-2 to obtain λ²-2λ-15, which factors as (λ-5)(λ+3). The eigenvalues are therefore 2,5,-3.

3. Take absolute values before comparing: 2,5,3. Their maximum is 5. The requested quantity is the spectral radius, not the largest magnitude coefficient or the sum of eigenvalues. As a check the roots sum to 4 and their product is -30, consistent with the polynomial.

Original paper, page 21 · Answer key

2 marks · NAT
Report issue

Cache Memory

Question 53, GATE 2017: A byte-addressable main memory contains 2^32 bytes, divided into 32-byte blocks. A direct-mapped cache has 512 lines. How many address bits form the tag field?
Tap to enlarge
Answer & solution

Official answer: 18.0

Our answer: 18

Step through it (6 steps)

1. There are 232 separately addressable bytes, so a memory address needs 32 bits. A 32-byte block needs log₂32=5 low-order offset bits to select a byte within it.

2. A direct-mapped cache with 512=29 lines uses 9 index bits to select the one cache line where a block may reside.

3. The remaining high-order bits distinguish the different memory blocks that map to that same line: tag=32-5-9=18 bits. Equivalently, memory has 227 blocks and each of 29 lines represents 218 possible blocks. Do not use 512 as the cache byte capacity; it is the number of lines.

Original paper, page 21 · Answer key

2 marks · NAT
Report issue

Expressions, Operators & Types

Question 54, GATE 2017: C program fragment: int m=10; int n,n1; n=++m; n1=m++; n--; --n1; n-=n1; printf("%d",n);. What is printed?
Tap to enlarge
Answer & solution

Official answer: 0.0

Our answer: 0

Step through it (12 steps)

1. Prefix increment changes the operand before producing its value. Thus n=++m first makes m=11 and then assigns n=11.

2. Postfix increment produces the old value and increments the operand by the end of the full expression. Hence n1=m++ assigns n1=11 and leaves m=12.

3. The separate statements n-- and --n1 reduce n and n1 to 10. Their prefix/postfix distinction does not matter when their expression values are discarded. Finally n-=n1 computes n=10-10=0, which is printed. These modifications occur in separate full expressions, so there is no unsequenced-increment ambiguity.

Original paper, page 22 · Answer key

2 marks · NAT
Report issue

Pointers & Memory

Question 55, GATE 2017: C program includes stdio.h and string.h, then executes char *c="GATECSIT2017"; char *p=c; printf("%d",(int)strlen(c+2[p]-6[p]-1));. What output is intended, and what caveat applies to the printed expression?
Tap to enlarge
Answer & solution

Official answer: 2.0

Our answer: 2 under intended character-offset arithmetic; strict C undefined behavior

1. C defines a[b] as *(a+b), so 2[p]=p[2] and 6[p]=p[6]. In the string, these are T and I. Under ASCII-compatible character values, T-I-1=84-73-1=10.

2. If this integer offset is computed before pointer addition, c+10 points to the suffix "17" of GATECSIT2017. strlen then returns 2, and the explicit cast to int matches the %d format. This explains the official intended numerical answer.

3. Strictly, however, the printed additive expression is left-associative: ((c+2[p])-6[p])-1. Its first addition forms c+84, far outside the string object (12 characters plus its terminator). C does not allow that intermediate out-of-bounds pointer arithmetic, even if later subtraction would return to a valid offset. The printed program therefore has undefined behavior rather than a guaranteed output.

4. Writing c+(2[p]-6[p]-1) would avoid that intermediate-pointer problem under the intended encoding. The answer 2 additionally assumes an encoding giving the specified T-I difference; C does not require alphabetic characters to have ASCII codes. Preserve both the official intended answer and the strict-C/encoding caveat.

Original paper, page 22 · Answer key