GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 2016 · Set 1

65 questions

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

03:00:00
1 mark · MCQ
Report issue

English Grammar & Usage

Question 1, GATE 2016: Choose the grammatically and idiomatically correct sentence. A: I will not leave the place until the minister does not meet me. B: I will not leave the place until the minister doesn't meet me. C: I will not leave the place until the minister meet me. D: I will not leave the place until the minister meets me.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Until introduces the positive event that ends the refusal: I will not leave until the minister meets me. Singular minister requires meets, and a second negation reverses the intended condition. Thus D.

The word until marks the event that ends the waiting period. The intended meaning is that leaving becomes possible after a meeting occurs, not after a refusal to meet. In a future time clause, English normally uses present tense: “until he meets,” even though the main clause says “will.” A and B have the same unnecessary negation; C lacks the third-person singular ending. These are separate meaning and agreement checks, both satisfied by D.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Vocabulary & Verbal Analogies

Question 2, GATE 2016: A rewording of something written or spoken is a _____. A: paraphrase. B: paradox. C: paradigm. D: paraffin.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

A paraphrase restates written or spoken material in different words while preserving its meaning. Thus A.

The defining feature is preservation of meaning while changing wording. For example, “She departed early” paraphrases “She left ahead of time.” A paradox is an apparently contradictory statement, a paradigm is a model or pattern, and paraffin is a substance. Matching the definition to the word is more reliable than choosing solely by the shared prefix para-.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Reading Comprehension & Verbal Reasoning

Question 3, GATE 2016: Archimedes said, “Give me a lever long enough and a fulcrum on which to place it, and I will move the world.” What kind of statement is this? A: figurative. B: collateral. C: literal. D: figurine.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Moving the world with a lever is an exaggerated illustration of leverage, not a literal proposal. This is figurative language, A.

The image dramatizes the mechanical advantage of a lever by using an impossible scale. Figurative language includes this kind of hyperbole. Literal would mean the statement describes an actual practical undertaking without exaggeration; figurine means a small statue and is not the adjective for figurative speech. Collateral means accompanying or secondary and does not classify this rhetorical use.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Data Interpretation & Logical Reasoning

Question 4, GATE 2016: In a code, relftaga means carefree, otaga means careful, and fertaga means careless. Which could mean aftercare? A: zentaga. B: tagafer. C: tagazen. D: relffer.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

The shared element taga corresponds to care. In all three examples the other English component follows care but its coded component precedes taga, so the component order is reversed. Aftercare therefore puts taga first, followed by a new component for after: tagazen, C.

Compare repeated parts rather than guessing whole words. Care is common to all three meanings, and taga is common to all three codes. The fragments relf, o, and fer therefore stand for free, ful, and less. In the examples these fragments precede taga even though they follow care in English. Maintaining that reversal makes aftercare become care-code followed by after-code. B would use the already assigned fragment for less, so it cannot introduce after.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Geometry & Spatial Aptitude

Question 5, GATE 2016: A large cube is assembled from 64 unit-side cubes. One unit cube is removed from each of its eight corners. Find the surface area of the remaining solid in square units. A: 56. B: 64. C: 72. D: 96.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The original cube has side 4 and surface area 6·4²=96. Removing a corner unit cube removes three exposed unit faces but reveals three previously internal unit faces. The eight corner removals do not overlap, so net area change is zero. Thus 96, D.

A useful distinction is between surface area and volume. The volume falls from 64 to 56, but 56 is not the surface area. At each removed corner, the lost faces are the three exterior faces meeting at that corner; its other three faces were touching neighboring cubes and become newly exposed. Counting all newly exposed faces, including the inward-facing recess surfaces, leaves the total unchanged. Since the side length is 4, different corner cuts do not remove adjacent cubes or overlap one another's exposed faces.

Original paper, page 1 · Answer key

2 marks · MCQ
Report issue

Data Interpretation & Logical Reasoning

Question 6, GATE 2016: A company sells four razors at unit prices in rupees: Elegance 48, Smooth 63, Soft 78, Executive 173. Quarterly quantities, in that product order, are Q1:(27300,20009,17602,9999), Q2:(25222,19392,18445,8942), Q3:(28976,22429,19544,10234), Q4:(21012,18229,16595,10109). Which product contributes the greatest fraction of annual revenue? A: Elegance. B: Executive. C: Smooth. D: Soft.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Sum the quarterly quantities and multiply by unit prices. Annual revenues are Elegance 4,920,480; Smooth 5,043,717; Soft 5,630,508; Executive 6,796,132 rupees. The common total-revenue denominator does not affect ordering, so Executive contributes the greatest fraction, B.

The annual quantities are 102510,80059,72186,39284 in the given product order. Revenue is price times quantity, not quantity alone: the cheapest product sells the most units but is not the revenue leader. To compare revenue fractions Ri/(sum Rj), cancel the common positive denominator and compare the four numerators. This avoids unnecessary percentage calculations and explains why Executive's higher price outweighs its smaller sales volume.

Original paper, page 2 · Answer key

2 marks · MCQ
Report issue

Reading Comprehension & Verbal Reasoning

Question 7, GATE 2016: Indian currency notes display denominations in at least seventeen languages. The passage says, “If this is not an indication of the nation's diversity, nothing else is.” What follows? A: India has exactly seventeen languages. B: Linguistic pluralism is the only indicator of national diversity. C: The notes have enough space for all Indian languages. D: Linguistic pluralism is strong evidence of India's diversity.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

At least 17 displayed languages is offered as strong evidence of diversity. It does not say exactly 17 languages exist, that language is the sole possible evidence, or that all languages fit. Thus D.

“At least” supplies a lower bound, not an exact count, eliminating A. The second sentence is emphatic praise of this particular evidence; it does not quantify over all possible indicators of diversity, so B is too strong. Nothing in the passage concerns available printing space, which excludes C. D preserves the actual evidential claim without adding uniqueness, completeness or an unsupported number of languages.

Original paper, page 2 · Answer key

2 marks · MCQ
Report issue

Data Interpretation & Logical Reasoning

Question 8, GATE 2016: Four poker players satisfy: P always beats Q; R always beats S; S loses to P only sometimes; R always loses to Q. Which conclusions follow? (i) P is likely to beat all three others. (ii) S is the absolute worst player. A: i only. B: ii only. C: both. D: neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The premises give pairwise outcomes, not a transitive total skill ranking or numerical winning probabilities. P sometimes loses to S, and no P-versus-R outcome is supplied, so i is not entailed. S sometimes beats P, which rules out the asserted absolute-worst conclusion ii. Therefore neither follows, D.

Do not silently make “beats” a transitive relation: a beats b and b beats c do not logically entail a beats c in a game. Nor does “sometimes” provide a numerical win probability. Thus the given individual matchup statements cannot establish that P is likely to defeat everyone. S has victories against P, so an absolute bottom ranking is not established either. The test is what the premises entail, not a plausible informal ranking from selected outcomes.

Original paper, page 2 · Answer key

2 marks · MCQ
Report issue

Algebra, Equations & Number Patterns

Question 9, GATE 2016: For f(x)=2x^7+3x−5, which is a polynomial factor? A: x^3+8. B: x−1. C: 2x−5. D: x+1.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

By the factor theorem, f(1)=2+3−5=0, so x−1 divides f(x), B.

The factor theorem says x−r divides a polynomial exactly when substituting r gives zero. Testing the simple candidate root 1 is enough to identify B. As checks, f(−1)=−10 excludes D, while the root 5/2 of C does not give zero. A has root−2, but f(−2)=−267, so x3+8 cannot divide f. There is no need to factor the entire seventh-degree polynomial.

Original paper, page 2 · Answer key

2 marks · MCQ
Report issue

Algebra, Equations & Number Patterns

Question 10, GATE 2016: The number N of cycles until failure decreases exponentially as load L increases. N(80)=100 and N(40)=10000. At which load is N=5000? A:40.00. B:46.02. C:60.01. D:92.02.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Write cycles N(L)=A exp(−kL). The ratio N(40)/N(80)=100 gives 40k=ln 100. To reduce 10000 cycles at load 40 to 5000, increase load by ln 2/k=40ln2/ln 100≈6.0206. Required load 46.02, B.

The exponential assumption makes log N linear in L, not N itself. The two known loads differ by 40 and their cycle counts differ by a factor 100. Halving 10000 to 5000 is therefore only log(2)/log(100) of that load interval, about 15.05%, not half the interval. Adding that increment to 40 gives 46.0206. The result lies between 40 and 80, as it must because 5000 lies between 100 and 10000.

Original paper, page 3 · Answer key

1 mark · NAT
Report issue

Propositional & Predicate Logic

Question 1, GATE 2016: For an integer x≥2, define p: x belongs to {8,9,10,11,12}; q: x is composite; r: x is a perfect square; s: x is prime. Find x satisfying NOT((p implies q) AND (NOT r OR NOT s)).
Tap to enlarge
Answer & solution

Official answer: 11.0 : 11.0

Our answer: 11

De Morgan gives ¬(p→q)∨(r∧s)=(p∧¬q)∨(r∧s). No integer≥2 is both a perfect square and prime, so the second term is false. Among 8, 9, 10, 11, 12 only 11 is not composite. Therefore x=11.

First replace the implication p⇒q by ¬p∨q. Negating the outside conjunction produces (p∧¬q)∨(r∧s), so only two kinds of integer could qualify. A square x=k2 with x≥2 has k≥2 and a proper divisor k; it cannot also be prime. Consequently x must lie in the listed set while failing compositeness. Checking that set leaves exactly 11, and substituting 11 makes the original inner conjunction false as required.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Recurrences & Generating Functions

Question 2, GATE 2016: Let a_n count length-n binary strings with no consecutive 1s. Which recurrence holds? A: a_n=a_(n−1)+2a_(n−2). B: a_n=a_(n−1)+a_(n−2). C: a_n=2a_(n−1)+a_(n−2). D: a_n=2a_(n−1)+2a_(n−2).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Partition valid n-bit strings by their last symbol. Those ending 0 append 0 to any valid (n−1)-bit string. Those ending 1 must end 01 and append 01 to a valid (n−2)-bit string. Hence an=an−1+an−2, B, with a0=1, a1=2.

The two cases must be disjoint and exhaustive. For n≥2, a valid string ends either in 0, or in 01; the latter is forced because a final 1 cannot follow another 1. Removing those suffixes gives arbitrary valid shorter strings and is reversible, so there is neither overcounting nor omission. For example a2=3 corresponds to 00,01,10, matching a1+a0=2+1. Initial values accompany the recurrence even though only the recurrence is requested.

Original paper, page 4 · Answer key

1 mark · NAT
Report issue

Calculus

Question 3, GATE 2016: Evaluate lim as x approaches 4 of sin(x−4)/(x−4), with angles in radians.
Tap to enlarge
Answer & solution

Official answer: 1.0 : 1.0

Our answer: 1

Substitute u=x−4. The limit is lim(u→0) sin(u)/u=1, with angles in radians.

Direct substitution gives 0/0, which is indeterminate rather than the numerical answer 0. The substitution u=x−4 moves the approach point to 0 and exposes the standard sine limit. Equivalently, differentiability of sine at 0 gives sin u=u+O(u3), so the quotient approaches 1 from either side. The radians convention matters: a sine measured in degrees has derivative π/180 at zero instead.

Original paper, page 4 · Answer key

1 mark · NAT
Report issue

Probability & Statistics

Question 4, GATE 2016: A probability density equals 1/x^2 on [a,1] and zero outside. Find a.
Tap to enlarge
Answer & solution

Official answer: 0.5 : 0.5

Our answer: 0.5

Normalize the density: integral from a to 1 of x−2 dx=1/a−1=1, yielding a=1/2. The support cannot cross zero because the integral there diverges.

A probability density must be nonnegative and have total area 1. Here its integral is [−1/x]_a1=−1+1/a, provided 0<a<1. Solving the normalization equation gives a=1/2, and substituting back yields 2−1=1. An interval containing zero would make this improper integral diverge, so algebraic manipulations across that singularity would not define a probability distribution.

Original paper, page 4 · Answer key

1 mark · NAT
Report issue

Linear Algebra

Question 5, GATE 2016: Two eigenvalues of a real 3×3 matrix P are 2+i and 3, where i^2=−1. Find det(P).
Tap to enlarge
Answer & solution

Official answer: 15.0 : 15.0

Our answer: 15

A real matrix has conjugate nonreal eigenvalues, so alongside 2+i it has 2−i. The determinant is their product times 3: (4+1)·3=15.

The characteristic polynomial of a real matrix has real coefficients. Therefore if a nonreal number is a root, its complex conjugate is also a root with the same multiplicity. A3×3 matrix has three eigenvalues counting multiplicity, so the missing one is fixed as 2−i. Their product is the determinant; their sum would instead give the trace. Multiplying the conjugate pair first cancels the imaginary terms and yields 5, then multiplying by 3 gives 15.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Boolean Algebra & Logic Gates

Question 6, GATE 2016: A Boolean operator # obeys x#0=x, x#1=NOT x, x#x=0, and x#(NOT x)=1. Identify x#y. Writing ¬ for NOT, concatenation for AND and + for OR, the options are A: x¬y+¬xy. B: x¬y+¬x¬y. C: ¬xy+xy. D: xy+¬x¬y.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

The four truth-table cases specified for # are exactly exclusive OR: different operands give 1 and equal operands give 0. Therefore x#y=x¬y+¬xy, A.

Construct the rows explicitly: 0#0=0, 0#1=1, 1#0=1, 1#1=0. An SOP has a minterm for each output-one row, namely ¬xy and x¬y. These are XOR's two unequal-input cases. Option D would be XNOR, which instead outputs 1 for equal inputs. The complement symbols in the options are essential; replacing them with ordinary variables changes the operator.

Original paper, page 5 · Answer key

1 mark · NAT
Report issue

Number Systems & Computer Arithmetic

Question 7, GATE 2016: Find the signed decimal value of the 16-bit two's-complement word 1111 1111 1111 0101.
Tap to enlarge
Answer & solution

Official answer: -11.0 : -11.0

Our answer: −11

Step through it (4 steps)

Invert 1111111111110101 and add 1 to obtain 0000000000001011=11. The leading sign bit is 1, so the two’s-complement value is−11.

A second method treats the word as an unsigned integer and subtracts 216 because the sign bit is 1. The unsigned hexadecimal value is FFF 5, or 65525;65525−65536=−11. The invert-and-add-one method and this positional-weight method agree. A leading 1 does not mean simply attaching a minus sign to the remaining 15-bit magnitude; that would be sign-magnitude, a different representation.

Original paper, page 5 · Answer key

1 mark · NAT
Report issue

Counters & Timing

Question 8, GATE 2016: A synchronous counter repeatedly outputs 0,1,0,2,0,3. What is the minimum number of J-K flip-flops required?
Tap to enlarge
Answer & solution

Official answer: 3.0 : 4.0

Our answer: 3

The repeating output sequence has six distinct phases. Its three occurrences of 0 require different future successors 1, 2, 3, so they cannot share one deterministic internal state. At least six states require ceil(log₂6)=3 flip-flops; a six-state cycle with output decoding attains this. The official accepted interval 3.0 : 4.0 is preserved even though the minimum derived here is 3.

Counting distinct output labels alone would suggest four states, but a deterministic counter must also remember where it is in the cycle. The zero before 1, the zero before 2 and the zero before 3 have different next outputs and so need different internal states. A possible 6-state encoding uses 000 through 101 and decodes them to 0,1,0,2,0,3. Three bits store those phases; suitable J-K input logic realizes the transition cycle. The official interval remains a scoring fact, not a proof that four is the minimum.

Original paper, page 5 · Answer key

1 mark · NAT
Report issue

Memory Organization & Address Translation

Question 9, GATE 2016: A processor supports up to 4 GB of word-addressable memory, with two bytes per word. What is the minimum address-bus width in bits?
Tap to enlarge
Answer & solution

Official answer: 31.0 : 31.0

Our answer: 31

Using the exam’s binary memory-size convention, 4 GB=2³² bytes. A word address identifies two bytes, leaving 2³¹ addressable words and requiring 31 address bits. Decimal 4·10⁹ bytes gives the same ceiling 31.

The address bus counts addressable units, not bytes unless memory is byte-addressable. Here each address selects one two-byte word, so divide byte capacity by 2 before taking the base-two logarithm. With 31 address bits there are 231 distinct patterns, exactly enough for the word addresses. Thirty bits would reach only 230 words, or 2 GiB, so the lower width is insufficient. Data-bus width and address-bus width are separate questions.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Stacks & Queues

Question 10, GATE 2016: An efficiently implemented array-based queue contains n items. Which complexity statement is correct? A: Both ENQUEUE and DEQUEUE can be O(1). B: At most one is O(1), with the other worst-case Ω(n). C: Both are worst-case Ω(n). D: Both are worst-case Ω(log n).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

A fixed-capacity circular array stores front/rear indices and wraps them modulo capacity. Enqueue writes at rear and advances it; dequeue reads at front and advances it. Both take O(1) without shifting elements, A, with overflow handled separately from dynamic resizing.

Maintain an item count or an extra full/empty flag to distinguish a full circular queue from an empty one when indices coincide. Each operation performs a bounded number of array accesses and index updates independent of n. Removing the head does not require compacting the stored elements because the front index identifies the new head. An implementation that shifts every item is possible, but the question asks what an efficient representation can achieve, not what every array implementation does.

Original paper, page 5 · Answer key

1 mark · NAT
Report issue

Graph Algorithms

Question 11, GATE 2016: Count the topological orders of the directed graph with vertices {a,b,c,d,e,f} and exactly the edges a→b, b→c, c→f, a→d, d→e, e→f. These two directed branches are the complete content of the source diagram.
Tap to enlarge
Answer & solution

Official answer: 6.0 : 6.0

Our answer: 6

Step through it (8 steps)

The graph consists of a→b→c→f and a→d→e→f. Vertex a must come first and f last. Interleave the two ordered middle chains(b, c) and(d, e), choosing their two positions among four: C(4, 2)=6.

After fixing a and f, the middle orders are bcde, bdce, bdec, dbce, dbec, debc. Each respects b before c and d before e. Choosing the two positions occupied by b,c determines the remaining positions for d,e, giving the binomial coefficient without listing all 4! permutations. A topological order need not follow a single path; it is any ordering in which every directed edge points forward.

Original paper, page 6 · Answer key

1 mark · MCQ
Report issue

Expressions, Operators & Types

Question 12, GATE 2016: Given void f(int,short); and a main body declaring int i=100; short s=12; short *p=&s;, which expression can fill a call-site blank without a type-checking error? A: f(s,*s). B: i=f(i,s). C: f(i,*s). D: f(i,*p). The printed wrapper uses void main(); judge the candidate expressions.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The function expects int and short and returns void. In D, i is int and *p is short, so f(i,*p) is well typed. A and C incorrectly dereference the nonpointer s; B tries assigning a void result to i. Thus D, evaluating the blank expression independently of the nonstandard void main wrapper.

The unary * operator requires a pointer operand. Since s is a short integer, *s is invalid regardless of the value 12 stored in it. By contrast p has type short*, so *p is a short lvalue compatible with f's second parameter. In B the arguments themselves are compatible, but f returns no value, so its call cannot supply an integer assignment value. Separate argument-type checking from return-value checking.

Original paper, page 6 · Answer key

1 mark · MCQ
Report issue

Searching, Sorting & Selection

Question 13, GATE 2016: Select the worst-case running times of insertion sort, merge sort, and quicksort, in that order. A: Θ(n log n), Θ(n log n), Θ(n^2). B: Θ(n^2), Θ(n^2), Θ(n log n). C: Θ(n^2), Θ(n log n), Θ(n log n). D: Θ(n^2), Θ(n log n), Θ(n^2).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Insertion sort may shift Θ(n) elements on each of n insertions, giving Θ(n²). Merge sort uses Θ(n) work across each of Θ(log n) levels, giving Θ(n log n). Quicksort’s most unbalanced partitions give n+(n−1)+...+1=Θ(n²). Thus D.

For reverse-sorted input, insertion sort shifts 1+2+...+(n−1) elements. Merge sort's balanced divide-and-conquer recurrence T(n)=2T(n/2)+Θ(n) yields Θ(n log n) regardless of initial order. Quicksort can repeatedly choose an extreme pivot, leaving subproblems of sizes 0 and n−1, so its recurrence becomes T(n)=T(n−1)+Θ(n). Its average-case or expected randomized Θ(n log n) bound must not be substituted for this requested worst-case bound.

Original paper, page 7 · Answer key

1 mark · MCQ
Report issue

Graph Algorithms

Question 14, GATE 2016: In a connected weighted undirected graph with distinct positive edge weights, add the same positive amount to every edge weight. Evaluate P: the minimum spanning tree is unchanged; Q: the shortest path between every pair is unchanged. A: P only. B: Q only. C: neither. D: both.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Every spanning tree has |V|−1 edges, so adding a constant c to each edge adds the same c(|V|−1) to every tree’s weight, preserving the unique MST. Paths may have different edge counts: triangle weights 1, 2, 4 initially favor 1+2 over 4, but adding 2 makes the direct 6 shorter than 3+4. Thus only P, A.

The invariant for trees is equal edge count, not merely preserved ordering of individual edge weights. Compare two trees T1,T2: the added terms cancel in their weight difference. By contrast a k-edge path gains kc, and another path with fewer edges gains less. The triangle counterexample demonstrates an actual reversal while retaining positive, distinct edge weights, so Q fails as a universal statement even though some particular graphs keep their shortest paths.

Original paper, page 7 · Answer key

1 mark · NAT
Report issue

Pointers & Memory

Question 15, GATE 2016: Find the printed value in this C program (stdio.h is included):
void mystery(int *ptra,int *ptrb){int *temp;temp=ptrb;ptrb=ptra;ptra=temp;}
int main(){int a=2016,b=0,c=4,d=42;mystery(&a,&b);if(a<c)mystery(&c,&a);mystery(&a,&d);printf("%d\n",a);}
Tap to enlarge
Answer & solution

Official answer: 2016.0 : 2016.0

Our answer: 2016

mystery swaps only its local pointer parameters; it never writes through either pointer. All pointed-to integers remain unchanged and the conditional a<c is false. The printed a is 2016.

C passes the pointer values by value, producing local copies of the addresses. Changing which address ptra or ptrb contains does not modify a,b,c or d. To swap integers the function would need assignments through *ptra and *ptrb; to swap caller pointer variables it would need a different interface. After the first call a remains 2016, so 2016<4 is false. The final call likewise has no effect on a before printing.

Original paper, page 8 · Answer key

1 mark · MCQ
Report issue

Context-Free Grammars & Languages

Question 16, GATE 2016: Which language is generated by S→aS | bS | ε? A: {a^n b^m:n,m≥0}. B: All words over {a,b} with equal numbers of a and b. C: {a^n:n≥0} union {b^n:n≥0} union {a^n b^n:n≥0}. D: {a,b}*.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

At every step S can emit either a or b and recurse, then terminate with epsilon. Every finite binary-alphabet word, including epsilon, is generated, giving {a, b}*, D.

For any desired word w, choose the production beginning with its next character repeatedly, then use S→ε after its final character. For example baba follows S⇒bS⇒baS⇒babS⇒babaS⇒baba. Conversely, every production emits only a or b, so no other alphabet symbols can appear. This two-direction argument proves equality with {a,b}*, rather than merely showing a few example strings are generated. The ε production explicitly includes the empty word.

Original paper, page 8 · Answer key

1 mark · MCQ
Report issue

Decidability & Computability

Question 17, GATE 2016: Which decision problems are undecidable? I: Given NFAs N1,N2, is L(N1) intersection L(N2) empty? II: Given CFG G and string x, is x in L(G)? III: Given CFGs G1,G2, are their languages equal? IV: Given Turing machine M, is L(M) empty? A: I,IV. B: II,III. C: III,IV. D: II,IV.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

NFA intersection emptiness is decidable by product-automaton reachability. CFG membership is decidable by parsing. Equivalence of arbitrary CFGs is undecidable, and TM-language emptiness is a nontrivial semantic property covered by Rice’s theorem. Thus III and IV, C.

For I, the product automaton accepts exactly the intersection, and finite graph search checks whether an accepting state is reachable. For II, a finite input can be handled by a terminating CFG parsing algorithm. Neither argument extends to III: comparing all words of two arbitrary CFGs is an undecidable equivalence problem. For IV, empty-language and nonempty-language Turing machines both exist, making emptiness a nontrivial property of recognized languages and hence undecidable by Rice's theorem.

Original paper, page 9 · Answer key

1 mark · MCQ
Report issue

Regular Expressions & Languages

Question 18, GATE 2016: Let Σ={0,1}; + denotes union and * Kleene star. Which regex specifies strings containing both 00 and 11 as substrings? A: Σ*0011Σ*+Σ*1100Σ*. B: Σ*(00Σ*11+11Σ*00)Σ*. C: Σ*00Σ*+Σ*11Σ*. D:00Σ*11+11Σ*00.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

A word must contain both a 00 occurrence and a 11 occurrence, in either order, with an arbitrary middle substring and arbitrary prefix/suffix. They cannot overlap because their symbols differ. Hence Σ*(00Σ*11+11Σ*00)Σ*, B. A forces adjacent blocks, C requires only one, and D disallows arbitrary outside context.

Take the earlier of a 00 occurrence and a 11 occurrence. Their positions cannot overlap, so one appears before the other with some possibly empty substring between them. This establishes the two alternatives in B. As a diagnostic example,001011 has both required pairs separated by 10, so it is valid but A rejects it. C incorrectly accepts 00 alone; D rejects valid words with extra prefix or suffix. Arbitrary prefix, middle and suffix are all needed.

Original paper, page 9 · Answer key

1 mark · NAT
Report issue

Intermediate Code

Question 19, GATE 2016: Find the minimum total number of variable names in static single-assignment form for this straight-line code, including incoming variables:
x=u−t;
y=x*v;
x=y+w;
y=t−z;
y=x*y;
Tap to enlarge
Answer & solution

Official answer: 10.0 : 10.0

Our answer: 10

The five incoming values u, t, v, w, z each need one name. The two definitions of x and three of y need five distinct SSA names: x1=u−t; y1=x1*v; x2=y1+w; y2=t−z; y3=x2*y2. Total 5+5=10 variables, counting incoming values as requested.

In SSA, each name has exactly one definition, but it can be read many times. Hence the two reads of t share one incoming name, while the successive writes to y cannot share a name. When renaming, every use must refer to its most recent preceding definition: the final product uses x2 and y2, not the original names. There are no branches here, so no φ-functions are necessary. Five new defined names plus five distinct incoming names is the requested total.

Original paper, page 9 · Answer key

1 mark · MCQ
Report issue

CPU Scheduling

Question 20, GATE 2016: CPU-bound processes with unequal burst lengths all arrive simultaneously. Which scheduling policy minimizes average ready-queue waiting time? A: shortest remaining time first. B: round robin with quantum shorter than every burst. C: uniform random. D: highest priority first, with priority proportional to burst length.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

All processes are available initially and are CPU-bound, so shortest-remaining-time-first reduces to shortest-job-first. If a longer job immediately precedes a shorter one, swapping them reduces the sum of waiting times by the burst-length difference. Repeated exchanges yield increasing burst order, which is optimal. Thus A.

Suppose adjacent bursts have lengths a>b. Executing a before b contributes a to b's wait, whereas reversing them contributes b to a's wait; completion time of the pair and waits of later jobs stay unchanged. The swap decreases total wait by a−b. Eliminating all such inversions gives ascending burst order. Since all arrivals occur at time zero, no newly arriving short job triggers a distinct preemption issue; SRTF executes this same optimal order.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Functional Dependencies & Keys

Question 21, GATE 2016: A relational schema has attributes V,W,X,Y,Z and primary key VY. Which choice is NOT a superkey? A: VXYZ. B: VWXZ. C: VWXY. D: VWXYZ. No other functional dependencies are specified; distinguish the intended answer from what the premise alone guarantees.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Our answer: B is not guaranteed; literal insufficiency of dependencies

A, C, D contain the given primary key VY and are therefore superkeys. B=VWXZ omits Y, so it is the only set not guaranteed to be a superkey by that key alone, intended B. However a primary key does not exclude other candidate keys: adding X→Y would make B a superkey too while VY can remain minimal. No complete FD set is supplied, so the literal assertion that B is not a superkey needs the implicit assumption that no other dependency determines Y.

A superkey determines every attribute; any superset of a known key is therefore automatically a superkey. This immediately verifies A,C,D. Under only the supplied key dependency VY→VWX YZ, closure of VWXZ lacks Y, giving intended B. But “primary” means the chosen candidate key, not the only candidate key. If X→Y is additionally valid, VWXZ closes to all attributes. Keeping this caveat prevents a multiple-choice convention from being taught as a false database theorem.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Transactions & Concurrency Control

Question 22, GATE 2016: Which is NOT an ACID transaction property? A: Atomicity. B: Consistency. C: Isolation. D: Deadlock-freedom.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

ACID expands to Atomicity, Consistency, Isolation and Durability. Deadlock freedom is a concurrency/liveness property, not an ACID component. Thus D.

Atomicity means all-or-nothing effects; consistency preserves the database's declared constraints; isolation controls interactions among concurrent transactions; durability preserves committed results. A locking implementation can satisfy these properties while occasionally encountering a deadlock, provided it detects and resolves that deadlock by aborting a transaction. Thus deadlock-freedom is a separate liveness guarantee rather than the missing fourth letter of ACID, which is durability.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Normalization & Decomposition

Question 23, GATE 2016: An article relation has attributes Volume,Number,StartPage,EndPage,Title,Year,Price. Its primary key K is (Volume,Number,StartPage,EndPage), with FDs K→Title, (Volume,Number)→Year, K→Price. It is decomposed into (Volume,Number,StartPage,EndPage,Title,Price) and (Volume,Number,Year). What is the weakest normal form the new database satisfies but the old one does not? A:1NF. B:2NF. C:3NF. D:BCNF.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (3 parts)

The old relation has a partial dependency (Volume, Number)→Year from a proper subset of the composite key to a nonprime attribute, violating 2NF. Splitting off(Volume, Number, Year) removes it; under the supplied FDs both resulting determinants are keys. The weakest newly satisfied form is 2NF, B, although the new schemas also satisfy higher forms under these dependencies.

Second normal form forbids a nonprime attribute from depending on only part of a candidate key. Year violates precisely this condition because Volume and Number are a proper subset of K. In the new Year relation, that pair is the whole key, so its dependency is no longer partial. In the other relation, Title and Price depend on its full key. The word weakest is decisive: even if BCNF also holds under the stated FDs,2NF is the first level crossed.

Original paper, page 11 · Answer key

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

IP Addressing, Fragmentation & Address Resolution

Question 24, GATE 2016: Which protocol is NOT used to resolve one form of address to another? A: DNS. B: ARP. C: DHCP. D: RARP.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

DNS resolves names to addresses, ARP resolves network-layer addresses to link-layer addresses, and RARP performs the reverse mapping. DHCP leases/configures host addressing rather than acting as an address-resolution protocol. Thus C.

Think of the direction of each lookup: DNS maps a domain name to an IP address; ARP maps a local network-layer address to a hardware address; RARP requests a protocol address from a hardware-address identity. DHCP instead assigns a lease and supplies configuration such as a subnet mask and default gateway. It may use address information internally, but that does not make its primary role address resolution in the sense asked here.

Original paper, page 11 · Answer key

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Application Protocols

Question 25, GATE 2016: Which are stateful application-layer protocols? i:HTTP; ii:FTP; iii:TCP; iv:POP 3. A: i,ii only. B: ii,iii only. C: ii,iv only. D: iv only.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

FTP maintains control-session state and POP 3 proceeds through authorization, transaction and update states. HTTP is conventionally stateless at the protocol level despite application cookies, while TCP is stateful but belongs to the transport layer. Therefore FTP and POP 3, C.

Apply both filters in the question: stateful, and application-layer. TCP satisfies the first but fails the second because it is a transport protocol. HTTP's request semantics do not require retained server session context; a website's cookies or login sessions are application mechanisms layered on HTTP. FTP keeps connection, authentication and transfer-mode context, while POP 3 has protocol states with different permitted commands. Only ii and iv satisfy both filters.

Original paper, page 11 · Answer key

2 marks · NAT
Report issue

Recurrences & Generating Functions

Question 26, GATE 2016: Find the coefficient of x^12 in (x^3+x^4+x^5+x^6+...)^3.
Tap to enlarge
Answer & solution

Official answer: 10.0 : 10.0

Our answer: 10

Factor the series as x³/(1−x). Its cube is x⁹(1−x)−3, so the coefficient of x¹² equals that of x³ in(1−x)−3, namely C(5, 2)=10. Equivalently distribute three excess units across three exponents, each originally at least 3.

Each of the three factors contributes one exponent at least 3. Write those exponents as 3+i,3+j,3+k with i,j,k≥0. To total 12, their excesses must satisfy i+j+k=3. Stars-and-bars counts C(3+3−1,3−1)=10 solutions. The three factors are distinguishable, so choices such as(3,4,5) and(4,3,5) contribute separately; counting unordered partitions would undercount the coefficient.

Original paper, page 12 · Answer key

2 marks · NAT
Report issue

Recurrences & Generating Functions

Question 27, GATE 2016: The sequence satisfies a_1=8 and a_n=6n^2+2n+a_(n−1). If a_99=K×10^4, find K.
Tap to enlarge
Answer & solution

Official answer: 197.9 : 198.1

Our answer: 198

The initial a 1=8 equals 6·1²+2·1, so a 99=sum(n=1..99)(6n²+2n). Using sum n²=N(N+1)(2N+1)/6 and sum n=N(N+1)/2 gives N(N+1)(2N+2)=2N(N+1)². At 99 this is 1,980,000=198·10⁴, hence K=198.

Unrolling adds the increments 6n2+2n for n=2 through 99 to the base 8. Because 8 is exactly the same expression at n=1, one uniform sum covers all terms. Simplifying before substituting avoids large arithmetic:6Σn2+2Σn=N(N+1)(2N+1)+N(N+1)=2N(N+1)2. A quick check at N=1 gives 8 and at N=2 gives 36, agreeing with the recurrence. Divide the final value by 10000, not multiply, to recover K.

Original paper, page 12 · Answer key

2 marks · NAT
Report issue

Sets, Relations & Functions

Question 28, GATE 2016: A function f from positive integers to positive integers satisfies f(n)=f(n/2) for even n and f(n)=f(n+5) for odd n. If R is its set of attained values, what is the maximum possible size of R?
Tap to enlarge
Answer & solution

Official answer: 2.0 : 2.0

Our answer: 2

For even n halve n. For odd n>5, applying the odd rule and then halving sends n to(n+5)/2<n. Thus every value eventually reaches 1..5. The numbers 1, 2, 3, 4 are connected by the cycle 1→6→3→8→4→2→1, while 5→10→5 forms another component. Divisibility by 5 is invariant under both rule equalities, so these components never merge. A function constant 1 on nonmultiples of 5 and constant 2 on multiples satisfies both rules and realizes two values. Therefore the maximum range size is 2.

The equations force f to be constant on connected components generated by the permitted transformations. Descent shows there are at most two components, while the divisibility-by 5 invariant proves that they cannot merge. For an odd n,5 divides n+5 exactly when it divides n; for an even n, halving preserves divisibility by 5 because 2 is invertible modulo 5. Assigning two different positive values to these two classes supplies an explicit function attaining the upper bound, so this is a maximum rather than just an estimate.

Original paper, page 12 · Answer key

2 marks · NAT
Report issue

Probability & Random Variables

Question 29, GATE 2016: Repeatedly toss a fair coin twice. TH outputs Y and stops; HH or HT outputs N and stops; TT restarts the experiment. Find the probability of eventually outputting Y, to two decimal places.
Tap to enlarge
Answer & solution

Official answer: 0.33 : 0.34

Our answer: 1/3 ≈0.33

Let p be the probability of eventual Y. A first-round TH gives Y with probability 1/4, while TT with probability 1/4 restarts independently. Thus p=1/4+p/4, so p=1/3. Infinite restart has probability lim(1/4)n=0. Two-decimal answer 0.33.

Another derivation conditions on the first round that does not restart. Of the equally likely terminal outcomes TH,HH,HT, exactly one produces Y, giving 1/3. Or sum the disjoint cases: Y after k restarts has probability(1/4)k(1/4), and their geometric series is(1/4)/(1−1/4). The single-round probability 1/4 is not the final answer because TT does not end the experiment in failure.

Original paper, page 12 · Answer key

2 marks · MCQ
Report issue

Logic Minimization & Karnaugh Maps

Question 30, GATE 2016: Two 2-to-1 multiplexers are cascaded. The first has select P, input 0 tied to 0 and input 1 tied to R. Its output feeds input 1 of the second multiplexer. The second has select Q and input 0 tied to ¬R; output is X. Find the minimal SOP. A: ¬P¬Q+PQR. B: ¬PQ+QR. C: PQ+¬P¬QR. D: ¬Q¬R+PQR. A select 0 chooses input 0, and select 1 chooses input 1.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The first mux selects 0 for P=0 and R for P=1, giving PR. The second selects ¬R for Q=0 and PR for Q=1. Therefore X=¬Q¬R+PQR, D. The isolated 111 minterm requires PQR, and the two minterms with Q=R=0 require the other implicant, so this SOP is minimal.

A2:1 mux implements ¬s·I0+s·I1. Applying that equation once gives PR and applying it again gives ¬Q¬R+QPR. In PQR order the 1-minterms are 000,100,111. The first two differ only in P and combine to ¬Q¬R. The 111 minterm has no neighboring 1-minterm and must remain the three-literal term PQR. This verifies both equivalence and minimality, rather than merely matching an option's algebraic shape.

Original paper, page 13 · Answer key

2 marks · NAT
Report issue

Input/Output, DMA & Interrupts

Question 31, GATE 2016: A DMA controller has a 16-bit data-count register. It must transfer 29154 kilobytes from disk into byte-addressable main memory. What is the minimum number of bus acquisitions needed to transfer the file? Use the paper's binary kilobyte and block-transfer convention.
Tap to enlarge
Answer & solution

Official answer: 456.0 : 456.0

Our answer: 456

Under binary kilobytes and burst transfer, a 16-bit count supports at most 2¹⁶ bytes per programmed transfer (or 65535 under a literal maximum-count convention, which gives the same ceiling here). The file has 29154·1024 bytes. Ceiling(29154/64)=456 bus acquisitions. This assumes a DMA burst retains the bus for its programmed block; cycle stealing would count differently. Decimal kilobytes would yield 445, so the binary-unit convention matters.

The file contains 29853696 bytes. A count register bounds bytes per programmed block in byte-addressable memory, so use a ceiling:455 full 64 KiB blocks carry 29818880 bytes, leaving 34816 bytes for one more block. Rounding down would leave data untransferred. If the usable maximum count is 65535 rather than 65536,455 such blocks still fall short and 456 suffice. The answer concerns block ownership episodes, not one bus acquisition per individual byte.

Original paper, page 13 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 32, GATE 2016: A4-stage pipeline has delays 800,500,400,300 ps. Replace its 800 ps stage by two equivalent stages of 600 ps and 350 ps. Ignoring unspecified register overhead, find the percentage increase in steady-state throughput.
Tap to enlarge
Answer & solution

Official answer: 33.0 : 34.0

Our answer: 33.33%

Ignoring unstated register overhead, the old steady-state clock is 800 ps and the new bottleneck 600 ps. Throughput rises from 1/800 to 1/600 instructions/ps. Relative increase=(800/600−1)·100%=33.333...%, rather than the 25% decrease in clock period.

A pipeline clock must accommodate its slowest stage, so the new clock is max(600,350,500,400,300)=600 ps. After filling, an ideal pipeline completes one item each clock; the number of stages affects latency but not this rate. The ratio of rates is (1/600)/(1/800)=4/3. Subtracting 1 and converting to percent gives 33⅓%. Computing(800−600)/800 instead measures a 25% period reduction, a different requested quantity.

Original paper, page 13 · Answer key

2 marks · MCQ
Report issue

Data Representation & Arithmetic

Question 33, GATE 2016: An n-bit carry-lookahead adder uses gates with fan-in at most 2. What is its asymptotic addition time? A: Θ(1). B: Θ(log n). C: Θ(√n). D: Θ(n).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

With bounded fan-in 2, carry generate/propagate combines through a balanced prefix tree of depthΘ(log n). The high-order result depends on Θ(n) inputs, and depth d gates can depend on at most 2d inputs, giving a matching Ω(log n) lower bound. Thus Θ(log n), B.

A carry can be summarized by generate and propagate signals, and adjacent summaries combine associatively. A balanced tree merges pairs, then groups of 4,8 and so on; after logarithmically many levels the needed carry information spans all bits. With fan-in bounded by 2, a constant number of levels cannot combine information from arbitrarily many positions. This restriction is why the unbounded-fan-in intuition of a single huge AND/OR gate cannot justify constant-time addition here.

Original paper, page 13 · Answer key

2 marks · MCQ
Report issue

Control Flow & Loop Tracing

Question 34, GATE 2016: Fill the loop condition so this C function returns the maximum array element for all n≥1:
int max(int *p,int n){int a=0,b=n−1;while(____){if(p[a]<=p[b])a=a+1;else b=b−1;}return p[a];}
A: a!=n. B: b!=0. C: b>(a+1). D: b!=a.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

At each iteration discard an endpoint no greater than the other: if p[a]≤p[b], advance a; otherwise decrement b. A maximum remains in the surviving interval. Continue until a=b, then return that sole survivor. Condition b!=a is D; stopping with two candidates is premature.

The invariant is that at least one maximum of the original array lies between indices a and b inclusive. Discarding the smaller endpoint preserves this invariant, including ties because the other equal value remains. Each step reduces b−a by 1, so termination occurs after n−1 iterations at a=b. For n=1 the correct loop runs zero times. Option C would stop with two values, potentially returning the smaller left one; A and B tie termination to fixed endpoints rather than convergence.

Original paper, page 14 · Answer key

2 marks · MCQ
Report issue

Scope, Lifetime & Storage Classes

Question 35, GATE 2016: Find the printed sequence for count(3), where:
void count(int n){static int d=1;printf("%d ",n);printf("%d ",d);d++;if(n>1)count(n−1);printf("%d ",d);}
A:3 1 2 2 1 3 4 4 4. B:3 1 2 1 1 1 2 2 2. C:3 1 2 2 1 3 4. D:3 1 2 1 1 1 2.
The printed main wrapper calls count(3); assume the usual printing declarations.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (7 steps)

The static d is shared across recursive calls. Entry pairs are(3, 1),(2, 2),(1, 3); after the third increment d=4. Each of the three returning frames then prints 4. The complete sequence is 3 1 2 2 1 3 4 4 4, A. The snippet assumes normal printf declarations and acceptance of its void-main wrapper.

There is one static storage cell for d, not one copy per recursion frame. Trace entry: count(3) prints 3,1 and increments to 2; count(2) prints 2,2 and increments to 3; count(1) prints 1,3 and increments to 4. The base call skips recursion but still executes its final print. Returning callers also execute that final print and see the same shared 4. No decrement or new initialization happens during unwinding, which explains all three trailing 4s.

Original paper, page 14 · Answer key

2 marks · MCQ
Report issue

Runtime Environments & Parameter Passing

Question 36, GATE 2016: Assume dynamic scoping and pass-by-reference in this pseudocode:
a=3;
void n(x){x=x*a;print(x);}
void m(y){a=1;a=y−a;n(a);print(a);}
void main(){m(a);}
What is printed? A:6,2. B:6,6. C:4,2. D:4,4. The source does not explicitly declare whether m's first assignment introduces a local a; preserve that ambiguity.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Our answer: D under implicit local-a binding

The intended pseudocode treats a=1 inside m as introducing a local a, while reference parameter y remains an alias of the outer a=3. Then local a=y−a=2. Passing it by reference to n makes x and dynamically resolved a refer to that same local cell: x=x*a stores 4, and both prints show 4, D. If a=1 instead assigns the existing outer dynamically scoped a, y aliases it, so a=y−a becomes 0 and the output is 0, 0. The source lacks an explicit local declaration, so its binding convention must be supplied.

Distinguish parameter aliasing from name lookup. Under the intended local-binding interpretation, y aliases the global cell containing 3, while m's local a first contains 1 and then 2. n's formal x aliases that local cell, and dynamic lookup of its free name a finds the active m frame, also that same cell. Thus the assignment squares 2 in place. Under assignment-to-existing-binding semantics both y and a refer to the global cell before subtraction, making 1−1=0. The printed key chooses the former semantics but does not remove the source ambiguity.

Original paper, page 15 · Answer key

2 marks · MCQ
Report issue

Heaps & Priority Queues

Question 37, GATE 2016: An array-stored binary heap has depth d, measured in root-to-farthest-leaf edges. After deleting the item at arbitrary index i, what is the efficient worst-case time for restoring heap order? A: O(1). B: O(d) but not O(1). C: O(2^d) but not O(d). D: O(d·2^d) but not O(2^d).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Replace the deleted element with the last heap element, reduce the heap size, then sift up if the parent order is violated or otherwise sift down. At most one root-to-leaf path is traversed, length≤d. Some deletions require movement throughΘ(d) levels, so the worst-case bound is O(d) and not O(1), B.

Replacing the deleted slot with the last array element preserves the complete-tree shape and avoids shifting an entire subtree. For a min-heap, compare the replacement with its parent: if it is too small, move it upward; otherwise any violation can only be below it, so move it downward by choosing the smaller child. The max-heap case reverses inequalities. There are at most d edges on the chosen path, with constant work at each, and worst-case inputs require traversal to the root or deepest leaf.

Original paper, page 15 · Answer key

2 marks · NAT
Report issue

Graph Algorithms

Question 38, GATE 2016: A four-vertex weighted undirected graph has weight matrix W with rows (0,2,8,5), (2,0,5,8), (8,5,0,x), (5,8,x,0). Find the largest integer x for which some shortest path between some pair uses the edge of weight x.
Tap to enlarge
Answer & solution

Official answer: 12.0 : 12.0

Our answer: 12

Without edge 3–4, the shortest route between its endpoints is 3→2→1→4 of length 5+2+5=12; the two-edge alternatives both cost 13. Any edge heavier than an alternative endpoint path cannot occur in a shortest path, since replacing it improves the route. At x=12 the edge itself ties the shortest endpoint route, so the largest integer is 12.

It suffices to compare x against the best route between its own endpoints that avoids that edge. Any shortest path using a heavier edge could be improved by substituting that alternative segment. The relevant routes from 3 to 4 have costs 13 via 1,13 via 2,12 via 2 then 1, and 18 via 1 then 2; thus 12 is the threshold. Equality is allowed because the question requires at least one shortest path, not a uniquely shortest path. At x=12, the direct edge is itself a shortest 3-to-4 path.

Original paper, page 15 · Answer key

2 marks · NAT
Report issue

Graph Algorithms

Question 39, GATE 2016: A complete undirected graph on 4 vertices has its 6 edges assigned the distinct weights 1,2,3,4,5,6. Over all assignments, find the largest possible weight of its minimum spanning tree.
Tap to enlarge
Answer & solution

Official answer: 7.0 : 7.0

Our answer: 7

Kruskal always accepts edges 1 and 2. If edge 3 does not make a triangle, it completes the tree and total is 6. If edges 1, 2, 3 form a triangle, edge 3 is rejected and the next edge 4 must join the fourth vertex, giving total 7. Assigning 1, 2, 3 to one triangle and 4, 5, 6 to the remaining incident edges attains 7.

Kruskal processes weights in increasing order and cannot reject either of the first two edges of a simple graph: a cycle requires at least three. If the first three edges do not form a triangle, they connect all four vertices and total 6. Otherwise they occupy three vertices, and every remaining edge joins that triangle to the fourth vertex, so edge 4 is necessarily accepted. This proves the upper bound 7 and the triangle arrangement witnesses attainability over all 720 weight assignments.

Original paper, page 15 · Answer key

2 marks · MCQ
Report issue

Graph Algorithms

Question 40, GATE 2016: In a simple undirected graph with distinct edge weights and an MST, consider edge e. I: If e is the lightest edge of some cycle, every MST includes e. II: If e is the heaviest edge of some cycle, every MST excludes e. Which statements are true? A:I only. B:II only. C:both. D:neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

The unique heaviest edge of a cycle is excluded by the cycle property, so II holds. I fails: take edges ab=3, bc=4, ca=5, ad=1, db=2. Edge ab is the lightest in triangle abc but the heaviest in triangle adb, hence excluded from the MST. Thus II only, B, assuming the connected graph/MST component context.

The valid cycle property concerns the heaviest edge: if a tree used it, deleting it creates a cut, and the rest of that cycle contains a lighter edge crossing the cut. Swapping would lower tree weight, contradicting minimality. The lightest edge of a cycle has no symmetric guarantee, because it might be a heavy choice relative to another route outside that cycle. Do not confuse it with the cut property, which guarantees inclusion of the unique lightest edge crossing a cut.

Original paper, page 16 · Answer key

2 marks · NAT
Report issue

Stacks & Queues

Question 41, GATE 2016: Initially queue Q holds 16 numbers and stack S is empty. Head and Top inspect without removing. Repeat while Q is nonempty: if S is empty or Top(S)≤Head(Q), dequeue Q's head and push it on S; otherwise pop S's top and enqueue it at Q's tail. What is the maximum number of loop iterations?
Tap to enlarge
Answer & solution

Official answer: 256.0 : 256.0

Our answer: 256

Let F(n) be the maximum number of loop iterations with n queued values and no relevant stack entries. Until a minimum queued value is pushed, each value originally preceding that minimum is pushed at most once and popped at most once: popped items return behind the minimum. Thus this phase costs at most 2n−1 iterations. Once the minimum is pushed it never pops, leaving at most n−1 values to process above it. Hence F(n)≤2n−1+F(n−1), giving F(n)≤n². A strictly descending initial queue attains equality at each phase, because all preceding values are pushed and popped and return in descending order behind the minimum. Therefore F(16)=256.

Each loop iteration moves one item either from Q to S or from S to Q. For a descending input 16,15,...,1, the first phase moves 15 earlier values onto the stack and back off before finally pushing 1:31 moves. That 1 never leaves, and the remaining values are again descending, giving phases 29,27,...,1. Their sum is 162=256. The upper-bound argument counts at most one push and one pop before the next minimum is fixed, so the example achieves the maximum rather than merely a large runtime.

Original paper, page 16 · Answer key

2 marks · MCQ
Report issue

Context-Free Grammars & Languages

Question 42, GATE 2016: Consider grammars G1:S→aS|B, B→b|bB; and G2:S→aA|bB, A→aA|B|ε, B→bB|ε. All options describe languages {a^m b^n} with nonnegative integer exponents. Which pair of constraints corresponds to G1,G2 respectively? A:(m>0 or n>0),(m>0 and n>0). B:(m>0 and n>0),(m>0 or n≥0). C:(m≥0 or n>0),(m>0 and n>0). D:(m≥0 and n>0),(m>0 or n>0).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

G1 emits any number of initial a symbols, then at least one b, so its language is am bn with m≥0, n>0. G2 chooses an initial a or b, then permits all remaining a symbols before its b symbols; it generates every nonempty am bn and not epsilon. Thus m>0 or n>0, giving D.

In G1 the only way to eliminate S is to enter B, and B has no ε rule, so a b is compulsory. In G2 the first production emits a or b, ruling out ε; after that, ε rules allow stopping. Once a derivation enters B, it emits only b symbols, so neither grammar can place an a after a b. Witnesses distinguish boundaries: b is in both languages, a is in G2 only, and ε is in neither. These tests select the inequalities in D.

Original paper, page 16 · Answer key

2 marks · MCQ
Report issue

Pushdown Automata

Question 43, GATE 2016: A PDA over input {a,b}, stack {X,Z}, starts with stack Z. Its start state q0 and state q2 are accepting; q1 is not. q0 loops on a,X/XX and a,Z/XZ; q0→q1 is b,X/ε; q1 loops on b,X/ε; q1→q2 is ε,Z/Z. There are no other transitions. Acceptance is by final state after consuming the whole input. Which statement is true? A:L={a^n b^n:n≥0}, not finite-automaton recognizable. B:L=a* union {a^n b^n:n≥0}, not accepted by any deterministic PDA. C:L is not accepted by any Turing machine halting on all inputs. D:L=a* union {a^n b^n:n≥0}, and is deterministic context-free.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The initial state is accepting, so epsilon and every a-only word are accepted while pushing one X per a. On the first b the machine moves to the middle state and pops one X per b; it reaches the final accepting state only when the stack returns to Z. Therefore the additional accepted words are an bn. The displayed machine is deterministic: at each state/stack combination the input transitions do not compete with epsilon transitions. The language is a* union {an bn: n≥0}, a deterministic CFL, D.

Final-state acceptance does not require an empty stack. This is why an all-a input is accepted in q0 even with X symbols left above Z, and why the double circle on the start state matters. Once a b occurs the machine cannot return to q0 or read further a symbols. It can reach q2 exactly after the number of b symbols matches the pushed X count. At q1, b-transitions require top X whereas the ε-transition requires top Z, so they are never simultaneously enabled; determinism is preserved.

Original paper, page 17 · Answer key

2 marks · MCQ
Report issue

Decidability & Computability

Question 44, GATE 2016: X is recursive; Y is recursively enumerable but not recursive. There are computable many-one reductions complement(Y)≤m W and Z≤m complement(X). Which conclusion is correct? A:W can be recursively enumerable and Z is recursive. B:W can be recursive and Z is recursively enumerable. C:W is not recursively enumerable and Z is recursive. D:W is not recursively enumerable and Z is not recursive. The complement bars are part of the printed source, although plain PDF extraction omits them.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

The source has complement bars: complement(Y) reduces to W, and Z reduces to complement(X). Since Y is RE but not recursive, complement(Y) cannot be RE, otherwise dovetailing the two recognizers would decide Y. RE languages are closed under computable many-one preimages, so W cannot be RE. X recursive implies complement(X) recursive, and its computable preimage Z is recursive. Hence C.

The direction of the reduction is crucial. To recognize complement(Y) from a recognizer for W, compute the reduction image and run that recognizer. Thus if W were RE, complement(Y) would be RE, contradicting the fact that an RE language with an RE complement is decidable. For Z, compute its reduction image and run the decider for complement(X), which halts on all inputs. This closure argument proves Z recursive without assuming anything about its syntax or structure.

Original paper, page 17 · Answer key

2 marks · NAT
Report issue

Parsing & Syntax Analysis

Question 45, GATE 2016: Three binary operators have these language-specific rules: + has highest precedence and is left-associative; − has medium precedence and is right-associative; * has lowest precedence and is left-associative. Evaluate 2−5+1−7*3.
Tap to enlarge
Answer & solution

Official answer: 9.0 : 9.0

Our answer: 9

Addition has highest precedence, giving 5+1=6. The remaining subtraction is right-associative, so 2−6−7 groups as 2−(6−7)=3. Multiplication has lowest precedence, producing 3*3=9.

Insert parentheses in precedence order before calculating: the expression becomes (2−(5+1)−7)*3, then right associativity changes the subtraction part to 2−((5+1)−7). The inner result 6−7 is−1, so the outer result is 3 and multiplying by 3 gives 9. Ordinary arithmetic precedence would put multiplication first and produce a different result; this question intentionally defines a different expression grammar.

Original paper, page 17 · Answer key

2 marks · MCQ
Report issue

Semantic Analysis & Type Checking

Question 46, GATE 2016: A syntax-directed translation scheme has S→aA {print 1}, S→a {print 2}, A→Sb {print 3}. A bottom-up parser processes input aab. What is the output? A:1 3 2. B:2 2 3. C:2 3 1. D:syntax error.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (8 steps)

Bottom-up parsing of aab first reduces the second a by S→a, printing 2. Then Sb reduces to A, printing 3. Finally aA reduces to S, printing 1. The action order is 2, 3, 1, option C.

Reduction order follows a rightmost derivation in reverse, not the textual order in which productions are listed. A valid derivation is S⇒aA⇒aSb⇒aab. Reversing those steps first collapses the second a into S, then Sb into A, then aA into S. Each semantic action is at the end of its production, so it runs at the corresponding reduction and emits 2,3,1. The successful derivation also rules out syntax error.

Original paper, page 18 · Answer key

2 marks · NAT
Report issue

Virtual Memory & Paging

Question 47, GATE 2016: A system has 40-bit virtual addresses,16-kilobyte pages and a one-level page table per process. Each entry occupies 48 bits. Find the per-process page-table size in megabytes, using binary memory units.
Tap to enlarge
Answer & solution

Official answer: 384.0 : 384.0

Our answer: 384

Step through it (6 steps)

A16 KiB page uses 14 offset bits, leaving 40−14=26 virtual-page bits. There are 226 page-table entries, each 48 bits=6 bytes, totaling 6*226 bytes=384 MiB. The official answer uses binary kilobyte/megabyte conventions and excludes unspecified table metadata.

Page-table storage depends on the number of virtual pages, not the physical RAM capacity, which is not given. Offset bits are log 2(16×1024)=14; the remaining 26 bits index 226 entries. Convert the 48-bit entry into 6 bytes before multiplying. The product 402653184 bytes divided by 220 bytes per MiB is 384. Confusing 48 bits with 48 bytes would inflate the answer by a factor 8.

Original paper, page 18 · Answer key

2 marks · NAT
Report issue

I/O & Disk Scheduling

Question 48, GATE 2016: A disk has cylinders 0–199 and pending requests 47,38,121,191,87,11,92,10. Its head starts at 63 moving upward. Using C-LOOK, find the total cylinder movement to service all requests, including the wrap movement.
Tap to enlarge
Answer & solution

Official answer: 346.0 : 346.0

Our answer: 346

Step through it (10 steps)

C-LOOK services 87, 92,121,191 on the upward pass, wraps directly to 10, then services 11, 38, 47. Movement is(191−63)+(191−10)+(47−10)=128+181+37=346 cylinders. The wrap is physical head movement and counts; the head does not visit unrequested endpoints 0 or 199.

Sort upward requests as 87,92,121,191 and below-head requests as 10,11,38,47. C-LOOK wraps from the highest pending request directly to the lowest pending request and resumes upward service, unlike C-SCAN which visits physical endpoints. The individual moves are 24,5,29,70,181,1,27,9; their sum 346 matches the compact span calculation. The large jump services no intermediate request but is still physical head travel, so excluding it would undercount.

Original paper, page 18 · Answer key

2 marks · NAT
Report issue

Virtual Memory & Paging

Question 49, GATE 2016: There are 10 initially empty physical page frames. The reference sequence is a1,a2,...,a 20,a1,a2,...,a 20, with 20 distinct pages. Find the difference between LIFO and optimal replacement in total page faults.
Tap to enlarge
Answer & solution

Official answer: 1.0 : 1.0

Our answer: 1

Assume initially empty frames. Both policies fault on all 20 first-pass pages. LIFO retains a 1 through a 9 and the most recently inserted page a 20. The second pass hits on a 1..a 9 then faults on a 10..a 20, giving 31 faults total. OPT can retain a 1..a 9, a 20 after the first pass, then uses frames of already-consumed pages to service a 10..a 19 while retaining a 20, giving 30. At least 10 second-pass faults are unavoidable because only 10 of 20 distinct pages can initially be resident, so OPT is optimal. Difference 31−30=1.

Under LIFO, page hits do not change insertion order. Once frames fill with a1 through a 10, every first-pass fault replaces the newest page in the same slot; a1 through a9 remain throughout. In the second pass, these nine hit and the other eleven fault. OPT has ten resident pages at the start of the second pass and can fault on exactly the ten absent pages by discarding pages whose final reference has already occurred. The total faults are therefore 31 versus 30, not counts of distinct pages alone.

Original paper, page 18 · Answer key

2 marks · MCQ
Report issue

Synchronization & Concurrency

Question 50, GATE 2016: There are n processes Pi, and all t[i] initially equal 0. pmax returns an integer at least as large as each argument. Each Pi repeats:
c[i]=1; t[i]=pmax(t[0],...,t[n−1])+1; c[i]=0;
for every j!=i {while(c[j]); while(t[j]!=0 && t[j]<=t[i]);}
Critical Section; t[i]=0; Remainder Section;
Which claim is true? A:At most one process is in its critical section at any time. B:Bounded waiting holds. C:Progress holds. D:Deadlock cannot occur. Analyze the usual atomic-read/write, sequentially consistent, nonoverflowing-ticket model with initially clear choosing flags c.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

This is bakery-style ticket selection without a process-ID tie-breaker. The choosing flags ensure another process waits until ticket selection finishes. Under the usual atomic-read/write, sequentially consistent, nonoverflowing-ticket model, two active contenders cannot both pass each other: a smaller nonzero ticket blocks the larger, while equal tickets block both. Thus mutual exclusion holds. Two simultaneous selections can read the same old maximum and choose equal tickets; each then waits for the other forever, so progress, deadlock-freedom and eventual bounded waiting are not guaranteed. Only A. Choosing flags are understood initially clear.

For a concrete deadlock execution with two processes, both evaluate the old maximum 0 before either publishes its ticket, and both choose 1. After their choosing flags clear, each sees the other's nonzero equal ticket and waits because 1≤1. Neither reaches the code that resets its ticket to 0. A process-ID tie-breaker, as in the standard bakery algorithm, would order equal tickets; it is absent here. This shows why mutual exclusion can hold while progress and bounded waiting fail.

Original paper, page 19 · Answer key

2 marks · MCQ
Report issue

Transactions & Concurrency Control

Question 51, GATE 2016: A transaction accessing objects O1,...,Ok first obtains exclusive locks on all of them in increasing memory-address order, then performs its operations, then releases all locks. The same protocol is followed by every transaction. What is guaranteed? A:serializability and deadlock-freedom. B:neither. C:serializability only. D:deadlock-freedom only.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Acquiring all exclusive locks before releasing any is two-phase locking, ensuring conflict serializability. Every transaction acquires locks in the same increasing object-address order. A circular wait would force a strict sequence of increasing addresses to return to its starting address, impossible. The protocol is therefore also deadlock-free, A.

The growing phase contains every lock acquisition, and the shrinking phase contains only releases, so this is stronger than ordinary two-phase locking and ensures conflict serializability. The common global address order prevents cycles in the wait-for graph: following a chain of waits requires strictly increasing lock addresses. Serializability alone would not prevent deadlock in arbitrary two-phase locking, so both parts of the argument are needed. Locking exclusively for reads is conservative but does not invalidate either guarantee.

Original paper, page 19 · Answer key

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Network Security

Question 52, GATE 2016: B digitally signs message m for A. Kx− denotes x's private key, Kx+ its public key; Kx(m) denotes the paper's encryption notation and H(m) its message digest. Which pair should B send? A:{m,KB+(H(m))}. B:{m,KB−(H(m))}. C:{m,KA−(H(m))}. D:{m,KA+(m)}.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

The signer is B, so the signature is produced with B’s private key on the message digest. A verifies it with B’s public key. The transmitted pair is {m, KB−(H(m))}, B. This is the exam’s simplified signature notation; practical signatures use a secure signature construction and encoding rather than arbitrary raw encryption.

A digital signature authenticates the sender and detects message modification; it does not by itself hide the message. The public key is for verification, not for creating a signature attributable only to B. Using A's key would authenticate the wrong party or provide encryption rather than a B signature. A verifies the received digest signature using B's public key and compares it to the digest independently computed from m. Practical schemes supply the necessary secure padding and signature encoding.

Original paper, page 20 · Answer key

2 marks · NAT
Report issue

IP Addressing, Fragmentation & Address Resolution

Question 53, GATE 2016: A router receives a 1000-byte IP datagram, including a 20-byte IP header, and must forward it over a link of MTU 100 bytes. Find the number of fragments, assuming IPv 4 fragmentation is permitted and each fragment has a 20-byte header.
Tap to enlarge
Answer & solution

Official answer: 13.0 : 13.0

Our answer: 13

Step through it (4 steps)

The original datagram contains 1000−20=980 payload bytes. Each fragment can hold 100−20=80 payload bytes, already a multiple of 8 as required for nonfinal IPv 4 fragments. Twelve fragments carry 960 bytes and a thirteenth carries 20, so 13 fragments. This assumes IPv 4 fragmentation is permitted (DF=0); otherwise the router drops rather than fragments the datagram.

The MTU bounds each entire fragment, including its own header. Thus divide the 980-byte payload by 80, not the original 1000-byte datagram by 100. Each nonfinal fragment's payload must be a multiple of 8 for IPv 4 fragment offsets, and 80 already qualifies. The last fragment has 20 payload bytes plus its 20-byte header, for 40 bytes total; the other twelve total 100 bytes each. Repeated headers make aggregate transmitted bytes 1240, which is larger than the original datagram.

Original paper, page 20 · Answer key

2 marks · NAT
Not in GATE 2027 syllabusReport issue

Transport, Congestion Control & Traffic Shaping

Question 54, GATE 2016: A token bucket is full with capacity 1 MB. Tokens arrive at 10 MB/s and the maximum output link rate is 20 MB/s. Find the minimum time to send 12 MB in the fluid token-bucket model.
Tap to enlarge
Answer & solution

Official answer: 1.1 : 1.1

Our answer: 1.1

Token conservation imposes transmitted data≤1+10t megabytes, so sending 12 MB needs t≥1.1s. The output-rate bound additionally gives t≥12/20=0.6s. Attain 1.1s by sending at 20 MB/s for 0.1s, consuming the initial 1 MB net token reserve while transmitting 2 MB, then at 10 MB/s for 1s for the remaining 10 MB. This is the standard fluid token-bucket model, with no additional packet-granularity overhead.

A full bucket permits an initial burst above the sustained token rate. While transmitting at 20 MB/s, tokens are consumed net at 20−10=10 MB/s, so the initial 1 MB reserve lasts 0.1s. During that interval 2 MB are sent, not 1 MB, because new tokens keep arriving. The remaining 10 MB then require 1s at the sustained 10 MB/s rate. The token conservation lower bound proves no alternative schedule can beat this 1.1s construction.

Original paper, page 20 · Answer key

2 marks · NAT
Report issue

Data Link, Framing, Error Control & ARQ

Question 55, GATE 2016: A sender uses stop-and-wait ARQ with 1000-byte frames at 80 Kbps. ACKs have 100 bytes and the receiver sends them at 8 Kbps. One-way propagation is 100 ms;1 Kbps=1000 bits/s. Assuming no loss and no processing delay, find sender throughput in bytes/s.
Tap to enlarge
Answer & solution

Official answer: 2500.0 : 2500.0

Our answer: 2500

Step through it (5 steps)

Data serialization takes 8000/80000=0.1s. ACK serialization takes 800/8000=0.1s, and round-trip propagation contributes 0.2s. With no specified processing delay, each stop-and-wait cycle is 0.4s and carries 1000 bytes. Throughput=1000/0.4=2500 bytes/s.

A stop-and-wait cycle includes four serial intervals: data transmission 0.1s, forward propagation 0.1s, ACK transmission 0.1s and return propagation 0.1s. The next frame cannot begin until the ACK finishes arriving. Only 1000 data bytes are useful sender throughput per cycle; adding ACK bytes to the numerator would measure a different quantity. Convert bits to bytes consistently: the data frame is 8000 bits and the ACK is 800 bits, so their unequal link rates nevertheless produce equal serialization times.

Original paper, page 20 · Answer key