GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 2019

65 questions

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

03:00:00
1 mark · MCQ
Report issue

Subject agreement and a cost breakdown

English Grammar & Usage

Question 1, GATE 2019: Choose the phrase that completes a sentence explaining how the project's expenditure is divided into equipment (Rs. 20 lakhs), salaries (Rs. 12 lakhs), and contingency (Rs. 3 lakhs): “The expenditure on the project ___ as follows …”. Choices: A break down; B break; C breaks down; D breaks.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Method: check both subject–verb agreement and the meaning of the verb phrase.

1. The grammatical subject is “expenditure”, a singular mass noun. The words “on the project” only modify it. The later list of three spending categories does not make the subject plural.
2. A present-tense verb with that singular subject takes the -s form. This eliminates “break down” and “break”.
3. “Breaks down” means can be analyzed or divided into constituent amounts, exactly what the following cost list does. “Breaks” alone suggests interruption or damage and does not express that meaning.

Result: C, “breaks down”. The individual amounts are context for the breakdown; adding them is unnecessary for this grammar question.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Selecting the verb in a fulcrum metaphor

Vocabulary & Verbal Analogies

Question 2, GATE 2019: Complete the statement that a search engine's business model ___ around the fulcrum of trust. Choices: A revolves; B plays; C sinks; D bursts.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Method: interpret the physical metaphor and then choose the matching expression.

1. A fulcrum is a pivot or support about which a lever turns. In the sentence, trust is metaphorically the central support of the business model.
2. “Revolves around” is the established expression for being organized around or depending centrally on something. It fits both “around” and “fulcrum”.
3. “Plays around” implies casual activity, “sinks” implies downward movement, and “bursts” implies rupture. None conveys rotation or central dependence in this construction.

Result: A, “revolves”. The decision is based on meaning and collocation, not on a disagreement in verb number: all four offered verbs are singular forms.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Separation of two cars

Time, Work, Speed & Distance

Question 3, GATE 2019: Two cars depart simultaneously from the same place in the same direction, at constant speeds 50 km/h and 60 km/h. How long until they are 20 km apart? Choices in hours: A 1; B 2; C 3; D 6.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Method: measure the motion of the faster car relative to the slower one.

1. After t hours, the slower car has travelled 50t km and the faster car 60t km from the shared starting point.
2. Because they travel in the same direction, their separation is the difference, 60t − 50t = 10t km. Adding the speeds would apply to motion in opposite directions, not this case.
3. Set the required separation equal to 20: 10t = 20, so t = 2 hours.
4. Check: after two hours their distances are 100 km and 120 km; the difference is indeed 20 km.

Result: B, 2 hours.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Equal contributions after two withdrawals

Arithmetic, Ratios & Percentages

Question 4, GATE 2019: Ten friends initially plan equal shares of a teacher's gift. Two withdraw, so each of the remaining eight pays Rs. 150 more than originally planned. Find the total gift cost. Choices: A Rs. 666; B Rs. 3000; C Rs. 6000; D Rs. 12000.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Method: express both individual shares in terms of the unchanged total cost.

1. Let the gift cost be G rupees. The original contribution per person is G/10.
2. With only eight contributors, the new contribution is G/8. The given increase is therefore G/8 − G/10 = 150.
3. Use common denominator 40: (5G − 4G)/40 = 150, giving G = 150 × 40 = 6000.
4. Verify both shares: 6000/10 = 600 and 6000/8 = 750. Their difference is 150, as required.

Result: C, Rs. 6000. The total extra payment by the eight remaining friends is 8 × 150 = 1200, which also equals the two missing original contributions, 2 × 600.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Workplace analogy

Vocabulary & Verbal Analogies

Question 5, GATE 2019: Complete the analogy: a court relates to a judge as which item relates to a teacher? Choices: A a student; B a punishment; C a syllabus; D a school.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Method: preserve the direction and type of the relationship in the first pair.

1. A court is the institution or workplace in which a judge performs the relevant professional role. The first item is a setting, and the second is its professional.
2. The matching setting for a teacher is a school, so school : teacher has the same structure as court : judge.
3. A student is someone taught, a syllabus is teaching content, and a punishment is a possible disciplinary action. These relate to teachers, but none is the analogous workplace.

Result: D, a school. Merely finding any association with “teacher” would not preserve the original analogy.

Original paper, page 1 · Answer key

2 marks · MCQ
Report issue

Exactly one truthful statement

Data Interpretation & Logical Reasoning

Question 6, GATE 2019: Exactly one of P, Q, R, S committed a crime, and exactly one of their statements is true. P accuses Q; Q accuses S; R denies committing it; S says Q's accusation of S is false. Identify the offender. Choices: A P; B R; C S; D Q.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Method: exploit the pair of logically opposite statements before testing suspects individually.

1. Q's statement is “S committed the crime”. S's statement denies precisely that proposition. One of these two statements must be true and the other false, regardless of the offender.
2. That pair already accounts for the one permitted true statement. Thus P's statement and R's statement must both be false.
3. P's false accusation tells us Q is not the offender. R's false denial tells us R is the offender.
4. Check the entire assignment with R guilty: P's accusation of Q is false, Q's accusation of S is false, R's denial is false, and S's denial of Q's accusation is true. There is exactly one offender and exactly one true statement.

Result: B, R. It is unnecessary to assume that the guilty person always lies; the conclusion follows from the given count of true statements.

Original paper, page 1 · Answer key

2 marks · MCQ
Report issue

Percentage of administrators in overlapping sets

Counting, Probability & Sets

Question 7, GATE 2019: A diagram uses a triangle for teachers, circle for researchers, and rectangle for administrators. Its five disjoint numbered regions contain: teachers only 70; teachers and administrators 10; administrators only 20; researchers and administrators 20; researchers only 40. Find the range containing the percentage who are administrators. Choices: A 0–15; B 16–30; C 31–45; D 46–60 percent.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Method: add disjoint regions once for the population, then add every region inside the administrator rectangle for the numerator.

1. The total represented population is 70 + 10 + 20 + 20 + 40 = 160. Region counts describe distinct people, so overlap regions must not be counted twice in this total.
2. Being an administrator does not exclude being a teacher or researcher. The rectangle contains its teacher overlap (10), administrator-only region (20), and researcher overlap (20), for 50 administrators.
3. The required percentage is (50/160) × 100 = 31.25%.
4. Compare the numeric percentage with the intervals: 31.25 lies between 31 and 45.

Result: C. Counting only the administrator-only region would give 20/160, but would omit administrators who also belong to another category.

Original paper, page 2 · Answer key

2 marks · MCQ
Report issue

Inferring the social-welfare explanation

Reading Comprehension & Verbal Reasoning

Question 8, GATE 2019: A passage describes a High Court judgment treating begging as a symptom rather than a disease, and identifies the underlying problem as state failure to protect people who fall through the social-security net. Which inference is closest? A beggars are unwilling to work; B lack of social-welfare schemes produces begging; C begging is an offence requiring firm punishment; D begging should be banned for harming state welfare.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Method: distinguish the passage's stated causal explanation from unsupported judgments about individuals or punishment.

1. The passage rejects treating begging itself as the underlying disease. It instead points to failure of public protection for vulnerable citizens.
2. Option B connects begging with inadequate social welfare. This is the closest available restatement of the passage's cause-and-symptom argument.
3. Option A introduces laziness or unwillingness to work, which the passage never asserts. Options C and D recommend criminalization or prohibition, whereas the passage explicitly questions the stigmatizing and criminalizing view.

Result: B is the intended answer. Strictly, failure or insufficiency of provision does not prove the complete absence of every welfare scheme; read lack in that practical sense. The answer is a best-supported inference among the options, not evidence for a stronger universal claim that no welfare schemes exist.

Original paper, page 2 · Answer key

2 marks · MCQ
Report issue

Club union and the college population

Counting, Probability & Sets

Question 9, GATE 2019: The exclusive club memberships are Drama only 60, Dance only 80, Maths only 30. Inclusive pairwise memberships are Drama–Dance 40, Dance–Maths 12, Drama–Maths 7; all three clubs contain 2 students. Seventy-five percent of the college belongs to none. Find total enrolment. Choices: A 1000; B 975; C 900; D 225.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Method: first convert the overlapping counts into disjoint regions, then use the percentage outside the union.

1. Each inclusive pair count contains the two students belonging to all three clubs. Thus exactly Drama and Dance contains 40 − 2 = 38; exactly Dance and Maths contains 12 − 2 = 10; exactly Drama and Maths contains 7 − 2 = 5.
2. Add all seven disjoint regions once: 60 + 80 + 30 + 38 + 10 + 5 + 2 = 225 students in at least one club.
3. If 75% belong to no club, the union is the remaining 25% of the college. With total N, 0.25N = 225.
4. Hence N = 225/0.25 = 900. As a check, 675 outside plus 225 inside gives 900, and 675/900 = 75%.

Result: C, 900. The value 225 is only the club union, not the whole college.

Original paper, page 2 · Answer key

2 marks · MCQ
Report issue

Hostel room allocation with a rotated compass

Geometry & Spatial Aptitude

Question 10, GATE 2019: Choose among four hostel allocation plans. X must avoid a wing next to a garden; Y wants maximum separation from the washrooms; Z wants the south-west wing. In the drawing, north is upper-left, east upper-right, south lower-right, west lower-left. Washrooms occupy the two left corners; gardens run along the right exterior, above and below the right-side entrance. Candidate placements: A has Z mid-left, X bottom near the left washroom, Y bottom toward the right; B has X top-right by the garden, Z mid-left, Y right below the entrance; C has Z top-right, X bottom-left, Y right below the entrance; D has X bottom-left, Z in the bottom wing toward the right, and Y on the right below the entrance. Shaded rooms are unavailable.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Method: translate the unusual compass first, then test each person's constraint separately.

1. The compass is rotated relative to the page. South points lower-right and west lower-left, so the direction midway between them, south-west, points toward the bottom of the page. Z therefore needs the bottom wing, not the left wing as a conventional north-up assumption might suggest.
2. In A and B, Z is in the mid-left wing, so the south-west condition fails. In C, Z is at the top-right of the plan, also not the required bottom wing.
3. In D, Z occupies a room in the bottom wing. X is near the lower-left washroom, away from the gardens that lie along the right side; X has no restriction about washrooms.
4. D places Y on the far-right side, away from the two left-side washrooms. This meets Y's distance preference. B also fails X's condition directly because X is beside the upper garden.

Result: D satisfies all three requests. The linked original remains the reference for exact room boundaries, shaded occupancy, and the complete floor-plan geometry.

Original paper, page 3 · Answer key

1 mark · MCQ
Report issue

Tag and index bits in a fully associative cache

Cache Memory

Question 1, GATE 2019: A byte-addressed processor has 32-bit addresses and a fully associative 16 kB cache with 16-byte blocks. Find tag bits and index bits, in that order. Choices: A (24,0); B (28,4); C (24,4); D (28,0).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Step through it (6 steps)

Method: partition the address into tag, set index, and block offset.

1. Because memory is byte-addressed, the offset selects one of the 16 bytes in a block. It requires log2(16) = 4 bits.
2. A fully associative cache has only one set containing all cache lines. Any memory block can occupy any line, so the processor address supplies no set index: log2(1) = 0 bits.
3. The remaining address bits identify which memory block is stored: tag bits = 32 − 4 − 0 = 28.
4. The 16 kB capacity determines the number of available lines, not an address index in this organization. Interpreting kB as 1024 bytes gives 1024 lines, all compared associatively.

Result: D, 28 tag bits and 0 index bits. The four low-order bits are an offset, not an index.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Decoding a DRAM chip-select address range

Memory Organization & Address Translation

Question 2, GATE 2019: Sixteen address lines are A15 through A0. A five-input AND chip-select gate receives A15, A14, inverted A13, inverted A12, and A11. Which address range enables the chip? Choices: A C800–CFFF; B CA00–CAFF; C C800–C8FF; D DA00–DFFF, all hexadecimal.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Method: turn the gate into fixed high-order bits and let every unused low-order address bit vary.

1. The active-high AND output is CS = A15 AND A14 AND NOT A13 AND NOT A12 AND A11. It is 1 only when A15…A11 = 11001.
2. Address lines A10…A0 do not enter the gate. Their 11 bits may take any values, giving 211 = 2048 consecutive addresses for the selected chip.
3. The lowest address sets those bits to zero: 1100 1000 0000 0000 in binary, or C800 in hexadecimal.
4. The highest address sets them all to one: 1100 1111 1111 1111, or CFFF. The number of addresses is CFFF − C800 + 1 = 0800 hexadecimal = 2048, agreeing with step 2.

Result: A, C800 through CFFF inclusive. The circles on A13 and A12 are inversions, so those original address lines must be zero, not one.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Which derivation an LR parser reconstructs

Parsing & Syntax Analysis

Question 3, GATE 2019: An LR parser corresponds to which derivation order? Choices: A leftmost; B leftmost in reverse; C rightmost; D rightmost in reverse.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Method: distinguish the left-to-right scan of the input from the order of grammar productions reconstructed by reductions.

1. LR parsing is bottom-up. A reduction replaces a handle, a right-hand side of a production, by its left-hand-side nonterminal.
2. This operation undoes a production application rather than applying it from the start symbol outward. Therefore the derivation is reconstructed in reverse.
3. The handles reduced by an LR parser are exactly those obtained by reversing a rightmost derivation. For example, with S → AB, A → a, B → b, a rightmost derivation is S ⇒ AB ⇒ Ab ⇒ ab. Reversing it gives ab ⇒ Ab ⇒ AB ⇒ S, the bottom-up reduction sequence.
4. In the name LR, L denotes scanning input left-to-right and R denotes reconstructing a rightmost derivation. The L does not mean leftmost derivation.

Result: D, a rightmost derivation in reverse.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Sixteen-bit two’s-complement encoding of −28

Number Systems & Computer Arithmetic

Question 4, GATE 2019: Find the 16-bit two's-complement representation of decimal −28. Choices: A 1111 1111 0001 1100; B 0000 0000 1110 0100; C 1111 1111 1110 0100; D 1000 0000 1110 0100.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (5 steps)

Method: represent the positive magnitude at the specified width, complement every bit, and add one.

1. Positive 28 is 16 + 8 + 4, so its 16-bit binary representation is 0000 0000 0001 1100.
2. Complement all 16 bits: 1111 1111 1110 0011.
3. Add one: 1111 1111 1110 0100, which is hexadecimal FFE4.
4. Check by the modular interpretation: a negative integer −28 is encoded as 216 − 28 = 65508. FFE4 has unsigned value 65508 and signed value 65508 − 65536 = −28.

Result: C. Setting just the most significant bit would be sign-magnitude encoding, not two's complement; retaining the positive low byte after filling leading ones would also give the wrong number.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Counting a subset with a marked member

Sets, Relations & Functions

Question 5, GATE 2019: Let U = {1,…,n} and A contain pairs (x,X) with X a subset of U and x a member of X. Statement I claims |A| = n·2^(n−1). Statement II claims |A| = sum from k=1 to n of k·C(n,k). Decide whether only I, only II, both, or neither is true; these are choices A, B, C, D respectively.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Method: count the same objects in two different orders.

1. First choose the marked member x. There are n choices. Its membership in X is then compulsory, but each of the other n − 1 elements may independently be included or excluded.
2. Consequently there are 2n−1 subsets X for each chosen x, and n·2n−1 pairs overall. Statement I is true.
3. Alternatively, fix the subset size k. There are C(n,k) ways to choose X, and then k choices for its marked member x. This contributes k·C(n,k) pairs.
4. Sum over k = 1,…,n. The empty subset contributes no pair because it has no member to mark. This gives the expression in II, so II is also true.

Result: C, both statements. This is a double-counting proof of the identity sum k·C(n,k) = n·2n−1; it also explains why merely counting all 2n subsets would miss the possible choices of x.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Testing a proposed Boolean identity

Boolean Algebra & Logic Gates

Question 6, GATE 2019: Let + mean Boolean OR, juxtaposition mean AND, prime mean NOT, and ⊕ mean XOR. Identify the invalid identity: A (x⊕y)⊕z = x⊕(y⊕z); B (x+y)⊕z = x⊕(y+z); C x⊕y = x+y when xy=0; D x⊕y = (xy+x′y′)′.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Method: a universal identity is disproved by one assignment; valid alternatives can be checked from XOR's meaning.

1. For B, set x = 1, y = 1, z = 0. The left side is (1 OR 1) XOR 0 = 1 XOR 0 = 1. The right side is 1 XOR (1 OR 0) = 1 XOR 1 = 0. The two sides differ, so B is invalid.
2. A is XOR associativity. Both sides indicate whether an odd number of x, y, z are one, independent of grouping.
3. For C, xy = 0 excludes the only assignment, x = y = 1, on which OR and XOR differ. Therefore the conditional identity is valid.
4. In D, xy + x′y′ is true exactly when x and y agree: both one or both zero. Complementing that equality condition gives XOR, which is true exactly when they differ.

Result: B. XOR is associative with itself, but mixing it with OR does not preserve that associativity pattern.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Which language operation need not preserve regularity

Closure Properties & Language Hierarchy

Question 7, GATE 2019: Given a regular language L over {a,b}, compare A L·L^R, where L^R is the set of reversed words; B {ww^R : w∈L}; C Prefix(L), all prefixes of words in L; D Suffix(L), all suffixes. The source asks which is “NOT regular”; evaluate this as which operation is not guaranteed to preserve regularity.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Our answer: B under not-necessarily-regular interpretation

Method: use closure constructions for A, C, D, and a counterexample for B.

1. Regular languages are closed under reversal and concatenation. Reversing an automaton's edges and exchanging start/final roles gives an NFA for LR; concatenating automata then recognizes L·LR. Thus A is always regular. Its two factors are chosen independently.
2. For Prefix(L), take a DFA for L and mark as accepting every state from which some original accepting state is reachable. A word reaches such a state exactly when it can be extended to a word of L. Thus C is regular.
3. For Suffix(L), use an NFA whose possible initial states are all states reachable from the original start, while keeping the original accepting states. It recognizes strings that can follow some prefix to complete a word of L. Thus D is regular.
4. B requires the second half to be the reversal of the very same first half. Choose regular L = {a,b}*. B then contains precisely the even-length palindromes. If it had pumping length p, the palindrome ap bb ap would have a nonempty pumped part wholly among its first p a's. Pumping that part down shortens only the left a-run, producing a non-palindrome. This contradicts the pumping lemma.

Result: B identifies the operation that does not preserve regularity. Literally B can be regular for finite or empty L, so the unconditional wording must mean not necessarily regular. The recorded regularity-quantifier discrepancy is retained.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Width required for sign-magnitude subtraction

Number Systems & Computer Arithmetic

Question 8, GATE 2019: X and Y use n-bit sign-magnitude representations, and Z = X − Y must also use sign magnitude. Find the minimum width that avoids overflow for all operands. Choices: A n; B n−1; C n+1; D n+2 bits.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Method: find the largest possible magnitude of a difference, then reserve a separate sign bit.

1. In an n-bit sign-magnitude number, one bit is the sign and n − 1 bits encode the magnitude. Thus each operand has absolute value at most M = 2n−1 − 1.
2. The largest positive difference occurs at X = M and Y = −M, giving Z = 2M = 2n − 2. Reversing these operands produces the negative extreme of the same magnitude.
3. For n ≥ 2, n − 1 magnitude bits cannot hold 2n − 2, but n magnitude bits can, since their maximum is 2n − 1. Therefore n magnitude bits are necessary and sufficient.
4. Add the sign bit: the result needs n + 1 total bits. For example, with n = 4, inputs range from −7 to +7; their difference can be +14, requiring four magnitude bits plus a sign.

Result: C, n+1 bits. The degenerate n=1 format represents only signed zero and is outside the usual nontrivial-width interpretation.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Invertibility and a nonzero determinant

Linear Algebra

Question 9, GATE 2019: For a square matrix X, compare I: X is invertible; II: det(X) is nonzero. Choices: A only I implies II; B only II implies I; C neither implication; D the two statements are equivalent.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Method: prove each implication separately for an ordinary square matrix over the real or complex numbers.

1. Suppose X is invertible. Then XX−1 = I. Taking determinants gives det(X)·det(X−1) = det(I) = 1. A product equal to 1 cannot have a zero factor, so det(X) ≠ 0. Hence I implies II.
2. Conversely, suppose det(X) ≠ 0. The adjugate identity says X·adj(X) = det(X)I. Dividing by the nonzero determinant gives X·[adj(X)/det(X)] = I and similarly on the other side.
3. Therefore adj(X)/det(X) is an inverse of X, proving II implies I. Equivalently, a nonzero determinant means full rank and no nonzero vector in the nullspace.

Result: D, I and II are equivalent. The square-matrix assumption matters because ordinary two-sided invertibility and this determinant criterion are not defined in the same way for rectangular matrices.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Equivalence relations on an arbitrary group

Sets, Relations & Functions

Question 10, GATE 2019: In an arbitrary group G, relation R1 is a R1 b iff a = g^−1bg for some g∈G. Relation R2 is a R2 b iff a = b^−1. Which are necessarily equivalence relations? Choices: A both; B R1 only; C R2 only; D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Method: verify reflexivity, symmetry, and transitivity for conjugacy, then seek a counterexample for the inverse relation.

1. R1 is reflexive: taking g to be the identity e gives a = e−1ae.
2. R1 is symmetric: if a = g−1bg, rearrange to b = gag−1. This has the required form h−1ah with h = g−1.
3. R1 is transitive: if a = g−1bg and b = h−1ch, substitute to obtain a = g−1h−1chg = (hg)−1c(hg). Thus a R1 c.
4. R2 need not even be reflexive. In the cyclic group of order three, let u be a nonidentity generator. Then u−1 = u² ≠ u, so u is not related to itself by R2. One failure of reflexivity is enough to disprove that R2 is necessarily an equivalence relation.

Result: B, R1 only. R2 can be an equivalence relation in special groups where every element equals its inverse, but “arbitrary group” requires the claim to hold for every group.

Original paper, page 5 · Answer key

1 mark · MCQ
Report issue

Serializability under strict 2PL and Thomas’s rule

Transactions & Concurrency Control

Question 11, GATE 2019: Assess two claims: I strict two-phase locking generates conflict-serializable and recoverable schedules; II timestamp ordering with Thomas's Write Rule can generate view-serializable schedules that are not conflict-serializable. Choices: A I only; B II only; C both; D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Method: separate the ordering guarantee of locking from the weaker observational guarantee allowed by ignoring obsolete writes.

1. In two-phase locking, a transaction first acquires locks and then releases them; it cannot acquire a new lock after releasing one. Ordering transactions by their lock points yields an order consistent with their conflicting operations. Hence 2PL gives conflict serializability.
2. Strict 2PL additionally retains exclusive locks until commit or abort. A second transaction cannot read a value written by the first before that writer commits, so it cannot commit while depending on an uncommitted writer. This prevents cascading dirty reads and implies recoverability. Thus I is true.
3. Thomas's Write Rule modifies timestamp ordering: if a proposed write is older than an already recorded write timestamp, and the relevant read-timestamp check does not require abort, that obsolete write can be ignored. It need not replace the newer value.
4. Ignoring such a write can preserve every transaction's observed reads and the appropriate final writes even where the logical ordering of conflicting write requests cannot be rearranged by conflict-equivalent swaps. View serializability preserves those observations and final writers, whereas conflict serializability imposes the stronger pairwise-operation ordering condition. Thus Thomas's rule can admit view-serializable schedules beyond conflict serializability, making II true.

Result: C, both statements. Recoverability and serializability are distinct properties; the first follows here from strict locking, not merely from conflict serializability alone.

Original paper, page 6 · Answer key

1 mark · MCQ
Report issue

Hamiltonian cycles in an undirected complete graph

Graph Theory

Question 12, GATE 2019: For an undirected complete graph on n vertices with n>2, count distinct Hamiltonian cycles. Choices: A n!; B (n−1)!; C 1; D (n−1)!/2. Rotations and reversal describe the same undirected cycle.
Tap to enlarge
Your answer
Answer & solution

Official answer: C OR D

Our answer: D generally; official accepts C OR D

Method: count vertex orders while removing the two sources of duplicate descriptions.

1. A Hamiltonian cycle visits every vertex once and returns to its start. Because the graph is complete, any ordering of the vertices produces the required edges.
2. Fix one named vertex as the start. The other n − 1 vertices can be arranged in (n−1)! orders. Fixing the start removes the n equivalent rotations that would appear in an unrestricted n! count.
3. Every undirected cycle is still counted twice: once for each traversal direction. For example, v1,v2,…,vn,v1 and v1,vn,…,v2,v1 use exactly the same undirected edges. Since n>2, these are two distinct orders, so divide by 2.
4. Hence the general count is (n−1)!/2. For n=3 this gives 1; for n=4 it gives 3, showing why the constant answer 1 does not hold for every allowed n.

Result: D is the general formula. The official key also accepts C, the value 1; that is true only for n=3, not for general n>2. Preserve both official scoring alternatives without presenting C as the general formula.

Original paper, page 6 · Answer key

1 mark · MCQ
Report issue

Removing a common zero before taking a limit

Calculus

Question 13, GATE 2019: Evaluate lim as x approaches 3 of (x^4−81)/(2x²−5x−3). Choices: A 1; B 53/12; C 108/7; D the limit does not exist.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Method: resolve the 0/0 form by factoring; a limit depends on nearby values, so cancellation away from x=3 is legitimate.

1. Direct substitution gives numerator 34 − 81 = 0 and denominator 18 − 15 − 3 = 0. This indeterminate form does not itself mean the limit fails to exist.
2. Factor the numerator twice: x4 − 81 = (x²−9)(x²+9) = (x−3)(x+3)(x²+9).
3. Factor the denominator: 2x² − 5x − 3 = (x−3)(2x+1).
4. For x≠3, cancel x−3. The quotient becomes (x+3)(x²+9)/(2x+1), whose denominator at 3 is 7, not zero.
5. Substitute into this continuous simplified expression: (3+3)(9+9)/(6+1) = 6×18/7 = 108/7.

Result: C. As an independent check, differentiating numerator and denominator in this 0/0 case gives 4·3³/(4·3−5) = 108/7 by l'Hôpital's rule; factoring is sufficient and requires less machinery.

Original paper, page 6 · Answer key

1 mark · MCQ
Report issue

Internal and leaf nodes of a B+ tree

Indexing, Storage & Query Processing

Question 14, GATE 2019: Which statement about a B+ tree index is incorrect? A it is height-balanced; B non-leaf nodes have pointers to data records; C each node's keys are sorted; D each leaf has a pointer to the next leaf.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Method: distinguish routing information in internal nodes from data entries at leaves.

1. A B+ tree keeps all leaves at the same depth, giving a balanced search height. Thus A describes the standard structure correctly.
2. An internal node contains separator keys and child-node pointers. Comparing a search key against the separators chooses the child subtree that may contain the record. Those pointers lead to more index nodes, not directly to the table's data records.
3. Data entries or record references occur at the leaves. Therefore B assigns a leaf responsibility to non-leaf nodes and is the incorrect statement.
4. Sorted keys let a node determine the correct child or locate the leaf entry, so C is correct. Linking leaves supports ordered scans and range queries without repeatedly returning to the root, so D is the usual leaf-link property; the last leaf's next pointer is null.

Result: B. This leaf-focused record organization is a key distinction between a B+ tree and a B-tree variant that may keep records in internal nodes.

Original paper, page 6 · Answer key

1 mark · MCQ
Report issue

A valid pumping length for a union of residue classes

Regular Expressions & Languages

Question 15, GATE 2019: Over {a,b}, L = {a^(2+3k) : k≥0} ∪ {b^(10+12k) : k≥0}. Which offered value can be a pumping length? Choices: A 3; B 5; C 9; D 24. The question asks for a valid length, not necessarily the smallest one.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Method: use the actual pumping-lemma conditions. For every word s with |s|≥p, find s=xyz with |xy|≤p, |y|≥1, and xyiz∈L for every integer i≥0.

1. Reject p=3, 5, or 9 using s=b10, which has length at least each candidate. Any nonempty y in such a decomposition consists only of b's and has length r with 1≤r≤p≤9.
2. Pumping up once more, i=2, produces length 10+r. For this all-b word to remain in L, r would have to be a multiple of 12. No r from 1 through 9 qualifies. Thus each of those three candidates fails.
3. Now take p=24. If s=am∈L and m≥24, set x=ε and y=a³. Pumping changes m by a multiple of 3, preserving m≡2 mod 3. Even at i=0, m−3≥21, and the permitted residue makes the remaining exponent an admitted nonnegative case.
4. If s=bm∈L and m≥24, set x=ε and y=b12. The first eligible such m is 34. Pumping changes m by multiples of 12; removing one block leaves at least 22, still an admitted length 10+12k.
5. Both constructions have nonempty y and |xy| equal to 3 or 12, at most 24. They therefore satisfy all requirements for every sufficiently long word in either branch.

Result: D, 24. A pumping length is an upper threshold at which suitable repetition is guaranteed; it does not have to equal a shortest accepted word or the least possible threshold.

Original paper, page 6 · Answer key

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Protocols for sending and retrieving email

Application Protocols

Question 16, GATE 2019: Choose the protocol pair for sending and then retrieving email, in that order: A IMAP and POP3; B SMTP and POP3; C SMTP and MIME; D IMAP and SMTP.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Method: assign each named standard its actual role, keeping the requested order.

1. SMTP, Simple Mail Transfer Protocol, handles mail submission and transfer between mail servers. It supplies the sending role.
2. POP3, Post Office Protocol version 3, lets a client retrieve messages from a mailbox server. It supplies the retrieval role, so SMTP followed by POP3 works.
3. IMAP also supports mailbox access and retrieval, but is not the sending protocol in A or D. MIME describes message content formats, encodings, and attachments; it is not a mailbox-retrieval protocol, so C fails in its second position.

Result: B, SMTP and POP3. This does not mean POP3 is the only way to read email; an SMTP/IMAP pair would also be valid if it were offered in the correct order.

Original paper, page 6 · Answer key

1 mark · NAT
Report issue

Counting child processes across repeated forks

Processes, Threads & System Calls

Question 17, GATE 2019: A Unix/Linux program runs for(i=0; i<10; i++), calling fork() whenever i%2==0, then returns. Assuming all forks succeed, find the total number of newly created child processes, excluding the original process.
Tap to enlarge
Answer & solution

Official answer: 31

Step through it (33 steps)

Method: count the branching rounds; every process alive at a fork round executes that fork and then continues the same loop.

1. The loop values are 0 through 9. The even values 0,2,4,6,8 cause five fork rounds; odd iterations create no processes.
2. A successful fork creates one new child from each currently executing process. Both parent and child continue from immediately after the fork with their own copy of i, so both participate in later rounds.
3. Starting from one process, the total after successive rounds is 2,4,8,16,32. The numbers of new children produced at those rounds are respectively 1,2,4,8,16.
4. Adding the created children gives 1+2+4+8+16 = 31. Equivalently, subtract the original from the final total: 25−1 = 31.

Result: 31 child processes in total, including descendants created by children. Counting only the five calls made by the original parent would omit later generations. The result assumes no fork failure or external process termination.

Original paper, page 7 · Answer key

1 mark · NAT
Report issue

Tracing value parameters and successive assignments

Functions & Parameter Passing

Question 18, GATE 2019: Function jumble(int x,int y) assigns x=2*x+y and returns x. Main initializes x=2,y=5, then executes y=jumble(y,x), then x=jumble(y,x), and finally prints main's x. Find the printed integer.
Tap to enlarge
Answer & solution

Official answer: 26 to26

Our answer: 26

Method: keep the function's local parameter names separate from the caller's variables, and evaluate statements in sequence.

1. Initially main has (x,y)=(2,5). In y=jumble(y,x), the first argument is main's y=5 and the second is main's x=2. Inside the function, local (x,y) therefore starts as (5,2).
2. The function computes local x=2×5+2=12 and returns 12. C passes these integers by value, so changing the local x does not alter main's x. The assignment updates only main's y, leaving main at (2,12).
3. The second call, x=jumble(y,x), now passes (12,2). The returned value is 2×12+2=26, and the enclosing assignment stores it in main's x.
4. Main is now (26,12), so printing x displays 26. Reusing the function's parameter name x does not make it an alias of the caller's x.

Result: 26. The official range 26 to 26 accepts this exact value.

Original paper, page 7 · Answer key

1 mark · NAT
Report issue

FOLLOW(B) with a nullable suffix

Parsing & Syntax Analysis

Question 19, GATE 2019: The grammar is S→Aa, A→BD, B→b|ε, D→d|ε. Symbols a,b,d,$ have indices 3,2,1,0 respectively. Find FOLLOW(B), then concatenate its symbol indices in descending order.
Tap to enlarge
Answer & solution

Official answer: 31

Step through it (13 steps)

Method: use the rule for a nonterminal followed by a possibly nullable suffix.

1. FOLLOW(B) contains terminals that can appear immediately after B in a sentential form, not the terminals that B itself derives. In A→BD, the suffix following B is D.
2. FIRST(D)={d,ε}. Add its non-epsilon terminal d to FOLLOW(B), because D may produce d immediately after B.
3. D can also disappear via D→ε. In that case whatever follows A also follows B. From S→Aa, the terminal a follows A, so FOLLOW(A)={a}; add a to FOLLOW(B).
4. There are no other occurrences contributing more symbols. In particular, $ follows the start symbol S, but the required terminal a after A prevents $ from propagating to A or B. The symbol b is in FIRST(B), not FOLLOW(B), and ε is never a FOLLOW-set member.
5. Thus FOLLOW(B)={a,d}. Their indices are 3 and 1, already in descending order, so concatenate them as 31.

Result: 31. The language generated from S is {a,ba,da,bda}, which also illustrates that a B occurrence is followed by d or a.

Original paper, page 7 · Answer key

1 mark · NAT
Report issue

Probability of the worst first quicksort split

Searching, Sorting & Selection

Question 20, GATE 2019: Quicksort is applied to 25 distinct elements, choosing the first pivot uniformly among them. Find the probability that the first partition puts the pivot in a worst possible position, rounded to two decimal places.
Tap to enlarge
Answer & solution

Official answer: 0.08

Method: characterize the pivot ranks that make the two recursive subproblems maximally unequal.

1. If the pivot has sorted rank r among 25 distinct elements, partitioning leaves r−1 elements smaller and 25−r larger.
2. The worst split is 0 and 24, leaving almost the entire problem for one recursive branch. This occurs when r=1 (minimum pivot) or r=25 (maximum pivot).
3. Exactly two of the 25 possible pivots have those ranks. Uniform selection makes each pivot equally likely, so the probability is 2/25=0.08.

Result: 0.08 to two decimal places. This asks only about the first split. It is not the probability that every later recursive call also takes its worst split, nor does a bad first pivot alone prove that the whole execution has the maximum possible running time.

Original paper, page 8 · Answer key

1 mark · NAT
Report issue

Reducing a large power modulo five

Proof Techniques & Number Theory

Question 21, GATE 2019: Compute 3^51 modulo 5. The exponent in the original is 51.
Tap to enlarge
Answer & solution

Official answer: 2

Method: find the repeating cycle of powers modulo 5, rather than form the large integer.

1. Compute successive residues: 3¹≡3, 3²=9≡4, 3³≡4×3=12≡2, and 3⁴≡2×3=6≡1 (mod 5).
2. Once the residue is 1, the next powers repeat this four-step pattern. Write 51=4×12+3.
3. Therefore 351=(3⁴)12·3³≡112·2≡2 (mod 5).
4. The residue 2 already lies in the standard range 0 through 4, so no further reduction is needed.

Result: 2.

Original paper, page 8 · Answer key

1 mark · NAT
Report issue

Equal most-significant bits in independent draws

Probability & Statistics

Question 22, GATE 2019: Choose two numbers independently and uniformly from {1,…,13}. Represent each as a four-bit unsigned binary number, including leading zeros. Find the probability that their most significant bits agree, rounded to three decimal places.
Tap to enlarge
Answer & solution

Official answer: 0.502 to 0.504

Our answer: 0.503

Method: partition the sample space by the value of the leftmost four-bit position.

1. In four-bit unsigned representation, the most significant bit has weight 8. Numbers 1 through 7 have MSB 0; there are seven. Numbers 8 through 13 have MSB 1; there are six. Zero is not in the sampling set.
2. The MSBs agree in two disjoint cases: both draws come from the seven-number group, or both from the six-number group.
3. Independent draws give probability (7/13)² for the first case and (6/13)² for the second. The desired sum is (49+36)/169=85/169.
4. Numerically 85/169≈0.50295858, which rounds to 0.503.

Result: 0.503. Independence permits the same number to be drawn twice. Treating the draws as without replacement would change both denominators and the probability.

Original paper, page 8 · Answer key

1 mark · NAT
Report issue

Range of outcomes under interleaved updates

Synchronization & Concurrency

Question 23, GATE 2019: Shared D starts at 100. Concurrent processes perform P1: D=D+20; P2: D=D−50; P3: D=D+10 on a time-shared uniprocessor. If X and Y are the minimum and maximum possible final values, find Y−X. Use the intended model in which each assignment's read and write can be interleaved with other processes.
Tap to enlarge
Answer & solution

Official answer: 80

Method: split each assignment into a read, local arithmetic, and write; an interrupted process may later overwrite a newer shared value using its earlier read.

1. To attain the minimum, let P2 read 100 and compute 50 but delay its write. Let P1 and P3 complete their increments, then let P2 write its stored 50 last. The final result is 50, because the earlier increments are overwritten.
2. To attain the maximum, let P1 and P2 both read 100. P2 writes 50 first; P1 then writes its stored 120, overwriting the decrement. P3 reads 120 and writes 130. The final result is 130.
3. These are also bounds. Trace the final write back through the value read by its writer, and recursively through preceding writes. This dependency chain starts at 100 and can include each process's change at most once. Its smallest possible sum includes −50 but no positive changes, giving 50; its largest includes +20 and +10 but not −50, giving 130.
4. Both bounds are attainable by steps 1 and 2, so X=50 and Y=130. Their difference is 130−50=80.

Result: 80. If whole assignments were atomic, every order would instead end at 80; the intended model permits preemption within an assignment. Under that different atomic model X=Y=80 and Y−X would be zero. A uniprocessor prevents simultaneous instruction execution but does not by itself make a multi-instruction update atomic.

Original paper, page 8 · Answer key

1 mark · NAT
Report issue

Array indexing relative to an interior pointer

Pointers & Memory

Question 24, GATE 2019: A C program initializes int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5}; and int *ip=arr+4; then prints ip[1] using the %d conversion. Find the integer displayed.
Tap to enlarge
Answer & solution

Official answer: 6

Method: identify the pointer's base element, then apply C's definition of the subscript operator.

1. C array indices start at zero. Thus arr[0]=1, arr[1]=2, arr[2]=3, arr[3]=4, arr[4]=5, and arr[5]=6. “Index 4” denotes the fifth element, not the fourth.
2. In the expression arr+4, arr converts to a pointer to its first element, &arr[0]. Adding 4 to an int pointer advances it by four int elements, not by four bytes. Therefore ip=&arr[4], pointing at the value 5.
3. For a pointer p, C defines p[k] as *(p+k). Consequently ip[1]=*(ip+1): advance one more int from arr[4], then read the value at that location.
4. Substitute the pointer value explicitly: *(ip+1)=*((arr+4)+1)=*(arr+5)=arr[5]=6.
5. The access stays within the 13-element array and does not modify either ip or arr. The %d conversion prints the selected integer, followed by the newline specified in the program.

Result: 6. ip[0] would be 5, whereas ip[1] is 6; ip[1] is not the same as arr[1] because the two indexing expressions use different base pointers. No assumption about the byte size of int is needed.

Original paper, page 8 · Answer key

1 mark · NAT
Report issue

Maximum contiguous-subarray sum

Dynamic Programming

Question 25, GATE 2019: For A=[−5,−10,6,3,−1,−2,13,4,−9,−1,4,12,−3,0], find the maximum S(i,j)=sum of A[k] for k=i through j, with 0≤i≤j<14. The chosen elements must form a contiguous segment.
Tap to enlarge
Answer & solution

Official answer: 29

Method: use Kadane's dynamic program. Let E[j] be the largest sum of any nonempty segment ending exactly at j. Such a segment either starts at j or extends the best segment ending at j−1.

1. The recurrence is E[0]=A[0]=−5 and E[j]=max(A[j],E[j−1]+A[j]). It is exhaustive because every segment ending at j has one of those two forms.
2. At indices 0 and 1, E is −5 then max(−10,−15)=−10. At index 2, starting afresh with 6 beats extending the negative prefix, so E[2]=6 and the candidate segment starts at index 2.
3. Continue through indices 3 to 7: E values are 9,8,6,19,23. Although −1 and −2 reduce the running sum, discarding the accumulated positive prefix would be worse.
4. For indices 8 to 13 the values are 14,13,17,29,26,26. The maximum across all E values is 29, achieved at j=11.
5. Recover the segment from i=2 through j=11: 6+3−1−2+13+4−9−1+4+12=29. The negative terms inside it must remain because the segment is contiguous.
6. Since every segment has some ending index j and E[j] is optimal for that ending index, taking the largest E[j] proves that no omitted segment has a greater sum.

Result: 29. The prompt permits divide and conquer but does not require it; this linear-time recurrence gives the same optimum and a direct correctness argument.

Original paper, page 9 · Answer key

2 marks · MCQ
Report issue

An unreachable recursive base case

Recursion

Question 26, GATE 2019: For positive integer n, convert(n) executes: if(n<0) printf("%d",n); else { convert(n/2); printf("%d",n%2); }. Decide whether it prints ordinary binary and terminates (A), reversed binary and terminates (B), binary without terminating (C), or nothing without terminating (D).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. The stopping branch is n<0, not n==0. Integer division of a positive integer by 2 produces another nonnegative integer, so none of the recursive calls can enter the stopping branch.
2. Repeated halving eventually reaches zero. For example, an input 5 gives calls with arguments 5, 2, 1, 0. At zero the else branch calls convert(0/2), which is convert(0) again.
3. Each printf in the else branch occurs after the recursive call. Since the innermost call never returns normally, no pending printf is reached. The negative-argument printf is also unreachable.
4. Therefore the abstract recursion neither prints nor terminates: D. A real implementation has finite resources and typically exhausts its call stack, rather than literally running forever. The familiar binary-conversion algorithm would need a reachable base case; it cannot be substituted for the code actually supplied.

Original paper, page 9 · Answer key

2 marks · MCQ
Report issue

Static state and for-loop evaluation order

Scope, Lifetime & Storage Classes

Question 27, GATE 2019: r() contains static int num=7 and returns num--. main executes for(r(); r(); r()) printf("%d",r()); then returns. Which displayed output is correct: A 41, B 52, C 63, D 630?
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (29 steps)

1. A static local variable is initialized once and keeps its value between calls. Post-decrement returns the old num and then reduces the stored value by one.
2. A for loop evaluates its initializer once, then repeatedly evaluates condition, body, and increment in that order. Calls in the initializer and increment still change num even though their returned values are discarded.
3. The initializer returns 7 and leaves num=6. The first condition returns 6, which is true, and leaves num=5. The body returns and prints 5, leaving num=4. The increment returns 4 and leaves num=3.
4. The second condition returns 3, so the body prints 2 and leaves num=1. The increment returns 1 and leaves num=0. The next condition returns 0, which is false, so there is no third body execution.
5. Only body calls print. No space or newline separates the two digits, so the displayed output is 52, option B. In particular, the zero used to stop the loop is never printed.

Original paper, page 9 · Answer key

2 marks · MCQ
Report issue

Subnet comparison using a /30 mask

IP Addressing, Fragmentation & Address Resolution

Question 28, GATE 2019: Machines M, N, P have IPv4 addresses 100.10.5.2, 100.10.5.5, 100.10.5.6 and all use mask 255.255.255.252. Are all in one subnet (A), only M/N together (B), only N/P together (C), or all in different subnets (D)?
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (5 steps)

1. Two IPv4 interfaces are in the same subnet when bitwise AND of each address with the subnet mask yields the same network address. The first three octets are identical here, so only the last octet needs calculation.
2. The last mask octet 252 is binary 11111100. Thus the two low bits are host bits and each subnet spans four consecutive addresses, starting at multiples of four.
3. M has last octet 2=00000010; AND with 11111100 gives 0. Its network is 100.10.5.0/30, covering last octets 0 through 3.
4. N has 5=00000101 and P has 6=00000110. Masking either gives 4=00000100. Both belong to 100.10.5.4/30, covering 4 through 7.
5. Only N and P share a subnet, so C is correct. Comparing the first three octets alone would incorrectly assume a /24 mask; the supplied /30 mask is decisive.

Original paper, page 10 · Answer key

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Resolving a local IP address with ARP

IP Addressing, Fragmentation & Address Resolution

Question 29, GATE 2019: In an IP-over-Ethernet network, X needs the MAC address of Y in the same subnet. Choose between sending an ARP request to the gateway IP (A), gateway MAC (B), local broadcast MAC (C), or local broadcast IP (D).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. The task is address resolution: X knows Y's IP address but needs the link-layer destination address for an Ethernet frame on the local network.
2. ARP carries the target IP address in its request. Since X does not yet know Y's MAC address, it sends the Ethernet frame to FF:FF:FF:FF:FF:FF, the broadcast MAC address, so local hosts can inspect the request.
3. Y recognizes its own IP in the request and normally replies with its MAC address. X can then cache the mapping and send ordinary unicast Ethernet frames to Y.
4. Therefore C describes the needed technique. Neither gateway option is the ordinary same-subnet procedure: a router is used for off-subnet forwarding, not required to identify this local neighbor.
5. D confuses protocol layers. An ARP request is carried directly in an Ethernet frame; it is not an IP datagram sent to a broadcast IP destination. Its broadcast delivery is at the MAC layer.

Original paper, page 10 · Answer key

2 marks · MCQ
Report issue

Combining Boolean on-sets

Boolean Algebra & Logic Gates

Question 30, GATE 2019: The on-sets of four-variable functions are f1={0,2,5,8,14}, f2={2,3,6,8,14,15}, f3={2,7,11,14}. A circuit ANDs f1 and f2, then XORs that output with f3. Find the output minterms: A {7,8,11}; B {2,7,8,11,14}; C {2,14}; D {0,2,3,5,6,7,8,11,14,15}.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. An on-set lists the input minterms on which a Boolean function equals 1. Working with these sets avoids expanding every minterm into a product of four literals.
2. The AND output is 1 only where both f1 and f2 are 1. Their intersection is H={2,8,14}; all other minterms make the AND output zero.
3. XOR is 1 precisely when its inputs differ. Therefore the final on-set is the symmetric difference of H and the on-set of f3, not their ordinary union.
4. Minterms 2 and 14 occur in both sets, so XOR makes them zero. Minterm 8 occurs only in H, while 7 and 11 occur only in f3, so these three survive.
5. The result is f=Σ(7,8,11), option A. Option B would correspond to OR at the second stage, illustrating why the XOR symbol matters.

Original paper, page 10 · Answer key

2 marks · MCQ
Report issue

Nested versus crossing language constraints

Context-Free Grammars & Languages

Question 31, GATE 2019: Over {a,b}, choose the language that is not context-free: A {ww^R}; B {wa^n b^n w^R}; C {wa^n w^R b^n}; D {a^n b^i : i is n, 3n, or 5n}. Here w ranges over all finite binary-alphabet strings, n≥0, and w^R is reversal.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. To distinguish these languages, separate nested matching, which a stack supports, from overlapping matching constraints. A is generated by S→aSa|bSb|ε, so it is context-free.
2. B is also nested: use S→aSa|bSb|T and T→aTb|ε. The S rules build w and its reversal around the central equal-length a/b runs. D is a union of three context-free languages; for each r in {1,3,5}, Sr→aS_r br|ε generates its fixed-ratio component. CFLs are closed under finite union.
3. For C, intersect with the regular language a+ b a+ b a+ b+. CFLs are closed under intersection with regular languages. In this pattern the two isolated b symbols force w=ai b at, and n=k, giving precisely K={ai b aj b ai bk : i,k≥1, j≥k, j−k even}, with j=2t+k.
4. Suppose K were context-free with pumping length p. Choose s=ap b ap b ap bp. In any CFL pumping decomposition s=uvxyz, |vxy|≤p and |vy|>0. The window cannot touch both the first and third a-runs, nor both the middle a-run and final b-run.
5. If v or y contains a separator b, pumping down removes a required separator and destroys the regular pattern. Otherwise, pumping any first/third-run a changes one side of their required equality without changing the other. This also leaves K.
6. The remaining possibility pumps only middle-run a's or only final-run b's. Pumping down middle a's makes j<k; pumping up final b's makes k>j. Thus every decomposition fails for some pump count, contradicting the pumping lemma. K, and hence C, is not context-free. Answer C.

Original paper, page 10 · Answer key

2 marks · MCQ
Report issue

Testing a relational decomposition

Normalization & Decomposition

Question 32, GATE 2019: On X(P,Q,R,S), F={QR→S, R→P, S→Q}. Decompose X into Y(P,R) and Z(Q,R,S). Test I: both components are BCNF; II: the decomposition is lossless and dependency preserving. Options A both, B I only, C II only, D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (3 parts)

1. BCNF requires the determinant of every nontrivial functional dependency to be a superkey. In Y, R→P gives R+={R,P}, so R is a key and Y is in BCNF.
2. In Z, S→Q still holds. But S+ within Z is only {S,Q}; no dependency derives R. Thus S is not a superkey and this nontrivial dependency violates BCNF. Statement I is false.
3. Dependency preservation asks whether enforcing dependencies locally suffices for the original F. R→P can be checked in Y; QR→S and S→Q can both be checked in Z. All original dependencies survive, so preservation holds.
4. For a binary decomposition, losslessness follows if the intersection functionally determines either component. Y∩Z={R}, and R→PR means the intersection determines Y. Joining valid projections therefore introduces no spurious tuples.
5. Both parts of II hold, so II alone is true: C. Losslessness and dependency preservation are distinct tests; neither implies that every resulting relation must satisfy BCNF.

Original paper, page 11 · Answer key

2 marks · MCQ
Report issue

Virtual address coverage of a TLB

Virtual Memory & Paging

Question 33, GATE 2019: A word-addressable machine has 64-bit virtual addresses, 48-bit physical addresses, 8 kB pages, 4-byte words, and 128 valid TLB entries. Find the maximum distinct virtual word addresses translatable without a TLB miss: A 16×2^10, B 256×2^10, C 4×2^20, D 8×2^20.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. One TLB entry caches the translation for an entire virtual page, not just one word. Every offset within a cached page can use that same entry.
2. Using the intended binary memory units, a page contains 8×1024=8192 bytes. Since an address identifies a four-byte word, the number of addressable words per page is 8192/4=2048=211.
3. To maximize coverage, let the 128=27 valid entries represent different virtual pages. The number of distinct covered word addresses is 27×211=218=262144.
4. Rewriting 262144 as 256×210 identifies option B. The cached byte span would be 1 MiB, but reporting that number of addresses would ignore word addressability.
5. The 64-bit and 48-bit widths bound the larger virtual and physical spaces; they do not change the number of offsets covered by these 128 page translations.

Original paper, page 11 · Answer key

2 marks · MCQ
Report issue

Counting descriptions and languages

Other / Mixed Topics

Question 34, GATE 2019: Which sets are uncountable? S1: recursively enumerable languages over {0,1}; S2: syntactically valid C programs; S3: all languages over {0,1}; S4: all nonregular languages over {0,1}. Options A S1/S2, B S3/S4, C S2/S3, D S1/S4.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. A set is countable if its members can be listed using natural-number indices. Finite strings over any finite alphabet can be listed by length and then lexicographic order, so their collection is countable.
2. Each Turing machine has a finite description. There are therefore only countably many such machines and only countably many languages they recognize. Every recursively enumerable language is recognized by a machine, so S1 is countable.
3. Each C program is also a finite string. Restricting the countable set of all strings to those obeying C syntax cannot make it uncountable, so S2 is countable.
4. The set {0,1}* of words is countably infinite, but a language is an arbitrary subset of that set. Its power set is uncountable by Cantor's theorem. Hence S3 is uncountable; confusing words with sets of words is the main trap.
5. Regular languages have finite automaton descriptions, so there are only countably many of them. If S4 were countable too, all languages would be a union of two countable sets, contradicting step 4. Thus S4 is uncountable and the answer is B.

Original paper, page 11 · Answer key

2 marks · MCQ
Report issue

Divisibility under different quantifier domains

Propositional & Predicate Logic

Question 35, GATE 2019: Let P(x) mean that every domain element z dividing x satisfies z=x or z=1. The formula says ∀x[P(x)⇒∃w(w>x and P(w))]. Which domains satisfy it: S1={1,...,100}, S2=positive integers, S3=all integers? Choices A S1/S2, B S1/S3, C S2/S3, D all three. Divisibility and quantifiers must be interpreted in the stated domain.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Our answer: Only S2 under literal integer divisibility; official C

1. Read the formula as: each number whose divisors are restricted to itself and 1 has a larger number with the same property. Do not replace P(x) by an informal definition of prime before checking its domain.
2. In the positive integers, P(x) holds for 1 and all primes. For every such x there is a larger prime, since primes are unbounded. Thus S2 satisfies the formula.
3. In S1, x=97 has P(x), since its only positive divisors are 1 and 97. The larger available values 98, 99, and 100 are composite and have divisors in S1 other than themselves and 1. No valid w exists, so S1 fails.
4. In S3, the integer −1 divides every integer. If P(x) holds, taking z=−1 forces −1=x or −1=1, hence x=−1. Conversely, −1 has exactly divisors −1 and 1, so P(−1) really is true.
5. There is no larger integer w with P(w), because step 4 shows −1 is the only qualifying integer. The implication consequently fails at x=−1, and S3 fails under literal integer divisibility.
6. The literal result is only S2, which none of the choices lists. The official key selects C, S2 and S3.

Original paper, page 11 · Answer key

2 marks · MCQ
Report issue

Propagating declaration types

Semantic Analysis & Type Checking

Question 36, GATE 2019: For declarations use D→T L; T→int|float; L→L1 , id|id. T synthesizes the chosen type. Semantic actions include D→TL: X1.type=X2.type and L→L1,id: X3.type=X4.type. Find X1,X2,X3,X4: A (L,T,L1,L), B (T,L,L1,T), C (L,L,L1,T), D (T,L,T,L1).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. T reads the type keyword and synthesizes its type value: int for T→int or float for T→float. The identifier list must receive this value from its declaration context.
2. In D→T L, the value flows from sibling T to L. Therefore L.type=T.type, giving X1=L and X2=T. Reversing this assignment would try to obtain the declared type from an untyped identifier list.
3. In L→L1,id, the parent L already has an inherited type. The shorter list L1 must inherit that same type, so L1.type=L.type. Consequently X3=L1 and X4=L.
4. The last identifier also gets L.type through addType; in the base case L→id, the single identifier receives L.type. For example, int a,b passes int from T to the outer list, then to its inner list and to both identifier entries.
5. The requested tuple is (L,T,L1,L), option A. T need not appear directly in recursive list productions: its value has already been propagated into the inherited L attribute.

Original paper, page 12 · Answer key

2 marks · MCQ
Report issue

Selecting a median of medians

Searching, Sorting & Selection

Question 37, GATE 2019: There are n unsorted arrays, n odd, each containing n distinct elements; different arrays have no common elements. Find the worst-case complexity of computing the median of the n array medians. Choices A O(n), B O(n log n), C O(n²), D Ω(n² log n).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. The median of n distinct values for odd n is their order statistic of rank (n+1)/2. Finding that one rank does not require sorting every value.
2. Apply deterministic worst-case linear-time selection to each array. The median-of-medians selection algorithm, for example, finds an exact order statistic in O(n) time per array.
3. There are n arrays, so obtaining all their medians costs n×O(n)=O(n²). Store the n resulting medians in a separate array.
4. Apply linear-time selection once more to those n medians. This adds O(n), so the total remains O(n²), identifying C. The desired statistic is the median of array medians, which is not in general the median of all n² input values.
5. Sorting each original array would cost O(n² log n) and is unnecessary. Worst-case exact selection on arbitrary unsorted rows requires inspecting linearly many entries in potentially decisive rows; the general problem has quadratic worst-case scale, not O(n) or O(n log n) in the row count n. Randomized quickselect offers expected linear selection, but deterministic selection is what directly justifies the worst-case bound here.

Original paper, page 12 · Answer key

2 marks · MCQ
Report issue

Cut properties and MST uniqueness

Graph Algorithms

Question 38, GATE 2019: For a connected weighted undirected graph G, test: I distinct weights on all edges imply a unique MST; II every cut having a unique cheapest crossing edge implies a unique MST. Options A I only, B II only, C both, D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Use the cut property: if an edge is the unique lightest edge crossing some cut, every minimum spanning tree must contain it. Otherwise adding it to an MST forms a cycle containing another crossing edge, and replacing that heavier edge makes a cheaper spanning tree.
2. To prove II, choose any MST T and remove one of its edges e. The remaining components define a cut. Edge e must be a cheapest crossing edge: a strictly cheaper one could reconnect the components and improve T.
3. Under II the cheapest crossing edge is unique, so e is that unique edge. By step 1, every MST must contain e. This reasoning applies to each edge of T.
4. Any other MST must therefore contain all |V|−1 edges of T and hence equal T. This proves II.
5. If every edge weight in the graph is distinct, each nonempty cut automatically has a unique cheapest crossing edge. Thus I implies the condition of II and is also true. Answer C. These are sufficient conditions for uniqueness; the question does not require proving that all edge weights must be distinct in every graph with a unique MST.

Original paper, page 12 · Answer key

2 marks · MCQ
Report issue

Resources required before another completion

Deadlocks

Question 39, GATE 2019: All instances of resource R are allocated. Process i holds Xi and may request at most Yi additional instances. Exactly p and q have Yp=Yq=0. Which condition guarantees no other process completes? A Xp+Xq<min other Yk; B Xp+Xq<max other Yk; C min(Xp,Xq)≥min other Yk; D min(Xp,Xq)≤max other Yk.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: A under actual-remaining-demand interpretation

1. First solve the intended resource-demand model, where Yi is the amount process i still needs in order to finish. Because no resource instances are currently free, only p and q have enough resources to finish immediately.
2. Once both finish and release what they hold, the total available pool is A=Xp+Xq. No other process has released anything yet.
3. If A<min{Yk:k≠p,q}, then A is smaller than every remaining demand. There is no possible next finishing process, so the system cannot enlarge its free pool by further completions. This yields option A under that model.
4. Comparing A with the maximum demand, as in B, blocks only at least one large-demand process; a smaller-demand process may finish and release resources. C and D similarly do not establish insufficiency for every remaining process.
5. The literal wording is weaker: each Yi is an upper bound on additional requests, not a necessary demand. A process with positive Yi could actually need zero more instances and finish. For example, with Xp=Xq=1 and another process's bound Yk=3, A holds, yet that process may finish without requesting anything.
6. Thus the keyed A needs the actual-remaining-demand interpretation. Under upper bounds alone, the claimed guarantee is not justified. Preserve this model caveat rather than presenting A as unconditional.

Original paper, page 13 · Answer key

2 marks · MCQ
Report issue

Heap ordering and conversion complexity

Heaps & Priority Queues

Question 40, GATE 2019: Test max-heap statements: I the smallest element is always at a leaf; II the second largest is always a root child; III a max-heap can be built from a BST in Θ(n); IV a BST can be built from a max-heap in Θ(n). Options A I/II/III, B I/II/IV, C I/III/IV, D II/III/IV.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: A under distinct-key comparison model

1. Under the intended distinct-key model, a max-heap parent is larger than its children. If the smallest key were internal, one of its children would be smaller still, a contradiction. Hence I holds.
2. The largest key is at the root. If the second largest were below depth one, its nonroot parent would have to be larger, producing a third key above it in rank. Thus it must be one of the root's children and II holds.
3. To establish III, traverse the BST once and copy its n keys into an array, costing Θ(n). Then run bottom-up heap construction, also Θ(n), by sifting down internal nodes. Sorting first is not required.
4. IV is false in the general comparison model. If it were possible, arbitrary distinct keys could be heapified in Θ(n), converted to a BST in Θ(n), and output in sorted order by an inorder traversal in Θ(n). That would contradict the Ω(n log n) comparison-sorting lower bound.
5. Therefore the intended true statements are I, II, III: option A. The qualification about distinct keys is material. With repeated minimum values, a minimum can occur at an internal node as well as a leaf, so the literal word 'always' in I is not valid for unrestricted duplicate-key heaps. Specialized bounded-integer models also cannot be silently substituted for comparison complexity.

Original paper, page 13 · Answer key

2 marks · NAT
Report issue

Inferring a burst time under SRTF

CPU Scheduling

Question 41, GATE 2019: Four processes have (arrival, CPU burst) in ms: P1=(0,3), P2=(1,1), P3=(3,3), P4=(4,Z). Under preemptive shortest-remaining-time-first scheduling their average waiting time is 1 ms. Determine Z.
Tap to enlarge
Answer & solution

Official answer: 2

1. SRTF always runs the available process with least unfinished CPU time. P1 runs from 0 to 1, leaving 2 ms. P2 arrives at 1 with burst 1, preempts P1, and finishes at 2.
2. P1 resumes at 2. When P3 arrives at 3, P1 has only 1 ms left versus P3's 3 ms, so P1 continues to completion at 4. P1 has waited 1 ms; P2 has waited 0; P3 has already waited 1.
3. At time 4, P4 arrives. If Z<3, P4 runs first for Z ms, then P3 runs for 3 ms. The total waiting time is W1+W2+W3+W4=1+0+(1+Z)+0=2+Z.
4. Average waiting 1 over four processes requires total waiting 4. Thus 2+Z=4, giving Z=2, which satisfies the branch assumption Z<3.
5. Check the other branch: if Z≥3, running P3 first adds a wait of 3 to P4, giving total 1+0+1+3=5. For Z=3 either tie order gives the same total, so this branch cannot give average 1.
6. With Z=2, completion times are P1=4, P2=2, P4=6, P3=9. Using waiting=completion−arrival−burst gives 1,0,0,3 respectively, totaling 4. Answer 2 ms.

Original paper, page 13 · Answer key

2 marks · NAT
Report issue

Maximum inode-addressed file size

File Systems

Question 42, GATE 2019: An inode has 12 direct pointers, one single-indirect pointer, and one double-indirect pointer. Blocks are 4 kB and each disk-block address is 32 bits. Find the maximum file-data size in GB, rounded to one decimal place; retain the official key's alternative unit ranges.
Tap to enlarge
Answer & solution

Official answer: 3.7 to 3.8 OR 4.0 to 4.1

Our answer: 4.0 under consistent binary units; alternate range retained

1. A block pointer occupies 32/8=4 bytes. Under the usual binary convention, one block is B=4096 bytes, so an indirect block stores 4096/4=1024 addresses.
2. Direct pointers address 12 data blocks. The single-indirect pointer addresses one metadata block containing 1024 data-block pointers, so it contributes 1024 data blocks.
3. The double-indirect pointer reaches a first-level metadata block containing 1024 pointers to second-level indirect blocks. Each second-level block addresses another 1024 data blocks. Its contribution is 1024²=1,048,576 data blocks.
4. Total file-data capacity is (12+1024+1,048,576)×4096=4,299,210,752 bytes. Metadata blocks are not part of the file's data size and must not be added to this total.
5. In binary GiB, divide by 230 to obtain 4.003952... GiB, rounding to 4.0. This is the conventional intended calculation even though the question prints GB.
6. Units matter. Taking kB as 1000 gives (12+1000+1000²)×4000=4,004,048,000 bytes: 4.0 decimal GB, or 3.7 GiB after rounding. Taking binary blocks but decimal GB instead gives 4.3, not an accepted supplied range. Preserve the official disjoint intervals 3.7–3.8 OR 4.0–4.1 rather than concealing this unit ambiguity.

Original paper, page 13 · Answer key

2 marks · NAT
Report issue

Closure after an LR(0) transition

Parsing & Syntax Analysis

Question 43, GATE 2019: Given augmented grammar S′→S; S→(L)|id; L→L,S|S, let I0=CLOSURE({S′→·S}). How many distinct LR(0) items are in GOTO(I0, '(')? The comma in L→L,S is a terminal.
Tap to enlarge
Answer & solution

Official answer: 5

Step through it (3 steps)

1. An LR(0) item is a production with a dot marking how much has been recognized. Closure adds productions of any nonterminal immediately after a dot, with their dots at the start.
2. I0 contains S′→·S, S→·(L), and S→·id. Only S→·(L) has an opening parenthesis immediately after its dot.
3. GOTO on '(' advances that dot, yielding the kernel item S→(·L). Its dot precedes L, so add L→·L,S and L→·S.
4. The first of these new items again has L after its dot, but adding L's productions repeats existing items. The second has S after its dot, so add S→·(L) and S→·id.
5. The last two dots precede terminals, so closure stops. The complete set is {S→(·L), L→·L,S, L→·S, S→·(L), S→·id}: exactly 5 items.
6. Do not carry S′→·S into this destination merely because it was in I0. GOTO keeps shifted matching items and then their closure, not the entire starting state.

Original paper, page 14 · Answer key

2 marks · NAT
Report issue

Eigenvalue product of a Vandermonde matrix

Linear Algebra

Question 44, GATE 2019: R has rows (1,2,4,8), (1,3,9,27), (1,4,16,64), (1,5,25,125). Find the absolute value of the product of its eigenvalues.
Tap to enlarge
Answer & solution

Official answer: 12

1. For any square matrix, the determinant equals the product of its eigenvalues, counted with algebraic multiplicity. Thus the requested value is |det R|; finding each eigenvalue individually is unnecessary.
2. Each row has the pattern (1,t,t²,t³), with t=2,3,4,5. This is a Vandermonde matrix. Its determinant is the product of (tj−ti) over every pair i<j.
3. There are six such pairs. Their differences are 3−2=1, 4−2=2, 5−2=3, 4−3=1, 5−3=2, and 5−4=1.
4. Multiply: det R=1×2×3×1×2×1=12. Because the t values appear in increasing order, the determinant is positive; the requested absolute value is therefore also 12.
5. The Vandermonde shortcut applies because columns are successive powers of the same row parameter, not merely because the entries increase. Standard elimination would give the same determinant, but numerical eigenvalue approximation introduces needless work and error.

Original paper, page 14 · Answer key

2 marks · NAT
Report issue

Bandwidth with block-transfer overhead

Cache Memory

Question 45, GATE 2019: A cache block contains 8 words of 4 bytes each. With a 60 MHz memory clock, serial miss service uses 1 cycle to accept the address, 3 cycles to fetch the block, then transmits 1 word per cycle. Find maximum bandwidth as a coefficient of 10^6 bytes/s.
Tap to enlarge
Answer & solution

Official answer: 160

1. Compute useful bytes per completed block: 8 words×4 bytes/word=32 bytes. Clock frequency is 60×106 cycles per second.
2. The description gives successive stages, so their times add. Address acceptance takes 1 cycle, block fetching takes 3, and sending eight words at one per cycle takes 8. Total service time is 1+3+8=12 cycles per block.
3. The completed-block rate is (60×106)/12=5×106 blocks/s. Multiplying by 32 bytes/block gives 160×106 bytes/s.
4. Thus the requested numeric coefficient is 160. Equivalently, one block takes 12/(60×106)=200 ns, and 32 bytes/200 ns gives the same bandwidth.
5. Counting only the eight transfer cycles would incorrectly ignore the four-cycle overhead. Conversely, interpreting the three fetch cycles as three per word would contradict the stated fetch of all eight words. This calculation assumes the sequential per-block controller service described; overlapping different block transactions would require a separate pipelining model not specified here.

Original paper, page 14 · Answer key

2 marks · NAT
Report issue

Expected distance between tree leaves

Tree Properties & Traversals

Question 46, GATE 2019: A binary tree T has 8 leaves and every level is full (a perfect tree). Two leaves a,b are selected uniformly and independently. Find the expected number of edges on their unique connecting path, to two decimal places.
Tap to enlarge
Answer & solution

Official answer: 4.25

1. A perfect binary tree with eight leaves has height 3 because 8=2³. All leaves are at depth 3, with the root at depth zero.
2. By symmetry, fix the first chosen leaf a. Independence means b remains uniformly distributed among all eight leaves, including a itself.
3. If b=a, there is one choice and distance 0. Its sibling is one choice at distance 2, via their parent. The two leaves in the other child subtree of the same depth-one ancestor have distance 4.
4. The remaining four leaves lie across the root, so the path goes up three edges and down three: distance 6. The counts 1+1+2+4=8 exhaust all equally likely outcomes.
5. Therefore E[d]=(1×0+1×2+2×4+4×6)/8=34/8=4.25.
6. The zero-distance case is required by independent sampling. Sampling two distinct leaves would instead condition on b≠a and produce 34/7, a different answer. Also, the question's parenthetical definition fixes a perfect tree; the broader textbook meaning 'every internal node has two children' alone would not determine these distances.

Original paper, page 14 · Answer key

2 marks · NAT
Report issue

Real roots under a uniform parameter

Probability & Statistics

Question 47, GATE 2019: Y is uniformly distributed on (1,6). Find the probability that 3x²+6Yx+3Y+6 has only real roots, rounded to one decimal place.
Tap to enlarge
Answer & solution

Official answer: 0.8

1. A real quadratic ax²+bx+c with a≠0 has real roots exactly when its discriminant Δ=b²−4ac is nonnegative. Here a=3, b=6Y, c=3Y+6.
2. Substitute and simplify: Δ=(6Y)²−4×3×(3Y+6)=36Y²−36Y−72=36(Y−2)(Y+1).
3. Throughout the support 1<Y<6, the factor Y+1 is positive. Thus Δ≥0 exactly when Y−2≥0, namely Y≥2. Intersecting with the support gives [2,6).
4. Uniform probability is favorable interval length divided by total interval length: (6−2)/(6−1)=4/5=0.8. This already has the requested one-decimal precision.
5. At Y=2 the quadratic has a repeated real root. Including or excluding that single boundary point does not change probability for a continuous uniform variable. The question asks for real roots, not positive roots; the negative sign of their sum is irrelevant.

Original paper, page 14 · Answer key

2 marks · NAT
Report issue

Minimal DFA for identity permutations

Finite Automata

Question 48, GATE 2019: The alphabet Σ consists of all bijections of {1,...,5} to itself. A word x=x1...xn denotes the composition π(x)=x1∘...∘xn; the empty composition is identity. L contains words whose composition is identity. Find the number of states in a smallest DFA recognizing L.
Tap to enlarge
Answer & solution

Official answer: 120

1. Each alphabet symbol is a permutation of five objects, so there are 5!=120 possible permutations. A prefix matters only through its accumulated composition, suggesting a state for each permutation.
2. Construct that DFA: start in the identity state; if the current state is g and the next symbol is σ, transition to g∘σ. Make identity the sole accepting state. Associativity ensures the stored state after x is exactly π(x), so this 120-state DFA recognizes L.
3. All 120 states are reachable: reading the single alphabet symbol g takes the identity start to g. Hence there are no unreachable states to discard.
4. To prove no states can be merged, take distinct permutations g and h. Append the one-letter suffix g^−1, which is available because inverses are also permutations in Σ. From g this produces g∘g^−1=id and accepts.
5. From h the same suffix produces h∘g^−1. It cannot equal id, since that would imply h=g after composing with g. Thus it rejects, so the two states are distinguishable.
6. Every pair is distinguishable, proving a lower bound of 120 states. Combined with the construction, the minimum is exactly 120. Merely counting symbols would not prove minimality without the reachability and distinguishing-suffix arguments.

Original paper, page 14 · Answer key

2 marks · NAT
Report issue

Switch ports consumed by uplinks

Network Layers & Devices

Question 49, GATE 2019: Connect 15 machines into one LAN using 8-port Ethernet switches with no separate uplink ports. What is the smallest number of switches required?
Tap to enlarge
Answer & solution

Official answer: 3

1. Each machine connection consumes one switch port. Connecting switches to each other also consumes a port at each end because there are no extra uplink ports.
2. A connected arrangement of k switches requires at least k−1 inter-switch links. Using a tree achieves that minimum, consuming 2(k−1) ports in total.
3. The greatest possible number of machine ports is consequently 8k−2(k−1)=6k+2. For k=2 this is 14, insufficient for 15 machines; one switch is plainly insufficient as well.
4. For k=3 the bound becomes 20. A chain of three switches uses one port on each outer switch and two on the middle switch, leaving capacities 7,6,7 for machines.
5. Allocate five machines to each switch, for example. The outer switches then use six ports each and the middle uses seven, all within their eight-port limits. Thus three switches are feasible and two are impossible: minimum 3.
6. Simply dividing 15 by 8 and rounding up misses the ports consumed by the link between the two proposed switches. Extra cycles between switches only consume more ports and cannot improve the minimum.

Original paper, page 15 · Answer key

2 marks · NAT
Report issue

Minimum NOR realization of XNOR

Boolean Algebra & Logic Gates

Question 50, GATE 2019: For variable order a,b,c,d, implement f=Σ(0,2,5,7,8,10,13,15) using the fewest two-input NOR gates. All variables and their complements are already available. Find that gate count.
Tap to enlarge
Answer & solution

Official answer: 3

1. Write minterm indices in binary abcd. The four indices 0,2,8,10 all have b=d=0; 5,7,13,15 all have b=d=1. In each group a and c take every combination. Hence f depends only on b,d and equals b XNOR d.
2. Build the two mismatch terms using NOR: u=NOR(b,¬d)=¬b·d and v=NOR(¬b,d)=b·¬d. Each is one gate because complemented inputs are available free.
3. Feed these to a third NOR: NOR(u,v)=¬(¬b·d+b·¬d)=b XNOR d=f. This proves three gates are sufficient.
4. For minimality, consider any circuit with at most two gates. If a raw input literal feeds the final NOR, setting that literal true forces the output to zero regardless of all other variables. The target XNOR has no such literal: for either setting of b or d it can still be 1, and it does not depend on a or c.
5. Without a raw literal at the final gate, both final inputs must be the output of the only earlier NOR. This merely inverts that NOR and gives the OR of its two input literals. No OR of literals realizes XNOR, whose 1-values are the two separated equal-bit cases.
6. Thus one or two gates cannot suffice, while the explicit circuit uses three. The minimum is 3. Complement availability is essential to this count; generating inversions separately would change the implementation cost.

Original paper, page 15 · Answer key

2 marks · NAT
Report issue

A Cartesian product before SQL grouping

SQL & Queries

Question 51, GATE 2019: Student rows (Roll_no,Student_name) are (1,Amit),(2,Priya),(3,Vinit),(4,Rohan),(5,Smita). Performance rows (Roll_no,Subject_code,Marks) are (1,A,86),(1,B,95),(1,C,90),(2,A,89),(2,C,92),(3,C,80). Student key is Roll_no and Performance key is (Roll_no,Subject_code). Query: SELECT S.Student_name, sum(P.Marks) FROM Student S, Performance P WHERE P.Marks>84 GROUP BY S.Student_name. How many rows result?
Tap to enlarge
Answer & solution

Official answer: 5

1. Read the actual WHERE clause before inferring the intended relationship. It contains P.Marks>84 but no condition S.Roll_no=P.Roll_no. Listing both tables in FROM therefore forms their Cartesian product, not a join on the similarly named columns.
2. Five Performance rows pass the filter: marks 86,95,90,89,92. The 80-mark row is excluded. Each of the five Student rows pairs with every one of these five surviving rows, yielding 25 intermediate rows.
3. GROUP BY S.Student_name partitions those rows by the five distinct student names. Each group has five rows and the same marks sum: 86+95+90+89+92=452.
4. The result is (Amit,452), (Priya,452), (Vinit,452), (Rohan,452), (Smita,452), in unspecified order. Hence the requested row count is 5.
5. Rohan and Smita are included even though they have no Performance records: the query never correlates a performance with its owner. Primary keys do not automatically add a join predicate. Adding that missing predicate would answer a different query and must not be silently done.

Original paper, page 15 · Answer key

2 marks · NAT
Report issue

Tracing a strict floating-point loop test

Control Flow & Loop Tracing

Question 52, GATE 2019: The C program initializes float sum=0.0,j=1.0,i=2.0 and repeats while(i/j>0.0625) { j=j+j; sum=sum+i/j; printf("%f\n",sum); }. How many times is sum printed?
Tap to enlarge
Answer & solution

Official answer: 5

Step through it (26 steps)

1. The loop test is evaluated before doubling j. Variable i remains 2 throughout, while j doubles once per successful iteration. The threshold is 0.0625=1/16.
2. At successive tests, j is 1,2,4,8,16,32, giving i/j equal to 2,1,1/2,1/4,1/8,1/16. The first five values are strictly larger than 1/16; the sixth is equal and fails the > comparison.
3. Each of those five successful tests enters the body exactly once, executes one printf, and changes j to the next power of two. Therefore there are 5 prints.
4. As a check on operation order, the terms added inside the body use the already doubled j: 1,1/2,1/4,1/8,1/16. The printed sums are 1,1.5,1.75,1.875,1.9375, normally shown with six digits after the decimal by %f.
5. The test that stops execution produces no print. These powers of two and binary fractions are exactly representable in ordinary binary floating point, so rounding does not alter this stopping point.

Original paper, page 15 · Answer key

2 marks · NAT
Report issue

Value subtraction versus pointer subtraction

Pointers & Memory

Question 53, GATE 2019: In C, a={2,4,6,8,10}, sum=0, and int *b=a+4. For i=0 through 4, execute sum=sum+(*b-i)-*(b-i); then print sum as an integer. What is printed?
Tap to enlarge
Answer & solution

Official answer: 10

Step through it (24 steps)

1. Pointer b is initialized to the final array element a[4]. No statement changes b, so *b remains 10 throughout the loop.
2. Distinguish the two expressions carefully. (*b-i) subtracts i from the value 10. By contrast, *(b-i) first moves the pointer i array positions backward and then reads a[4-i]. Pointer arithmetic counts int elements, not bytes.
3. For i=0,1,2,3,4, the first expression takes values 10,9,8,7,6. The second reads 10,8,6,4,2. Their differences are therefore 0,1,2,3,4.
4. Starting from zero, sum accumulates 0+1+2+3+4=10. Equivalently, a[4-i]=10−2i, so each summand is (10−i)−(10−2i)=i.
5. The output is 10 followed by a newline. All dereferences stay within a[0] through a[4]. The minus sign is subtraction, not a decrement of b, and confusing these operations would produce a different trace.

Original paper, page 16 · Answer key

2 marks · NAT
Not in GATE 2027 syllabusReport issue

Factoring an RSA modulus from its totient

Network Security

Question 54, GATE 2019: For a two-prime RSA modulus n=3007, Euler's totient φ(n)=2880. Find the prime factor of n that exceeds 50.
Tap to enlarge
Answer & solution

Official answer: 97

1. In the standard RSA construction n=pq for distinct primes p,q, and φ(n)=(p−1)(q−1). Expanding gives φ(n)=pq−p−q+1=n−(p+q)+1.
2. Rearrange to recover the prime sum: p+q=n+1−φ(n)=3007+1−2880=128. Their product is already known: pq=3007.
3. Numbers with this sum and product are roots of t²−128t+3007=0. Its discriminant is 128²−4×3007=16384−12028=4356=66².
4. The roots are (128+66)/2=97 and (128−66)/2=31. Both are prime, and their product 97×31=3007 verifies the factorization.
5. Also (97−1)(31−1)=96×30=2880, verifying the given totient. Only 97 is greater than 50, so the required answer is 97.
6. The useful method is recovering p+q from the totient; trial-dividing n is unnecessary. The formula used here relies on the stated RSA two-distinct-prime setting.

Original paper, page 16 · Answer key

2 marks · NAT
Report issue

Projecting and subtracting joined relations

Relational Algebra & Calculus

Question 55, GATE 2019: Relations: P(X,Y,Z)={(X1,Y1,Z1),(X1,Y1,Z2),(X2,Y2,Z2),(X2,Y4,Z4)}; Q(X,Y,T)={(X2,Y1,2),(X1,Y2,5),(X1,Y1,6),(X3,Y3,1)}; R(Y,V)={(Y1,V1),(Y3,V2),(Y2,V3),(Y2,V2)}. Count tuples in π_X(σ_{P.Y=R.Y and R.V=V2}(P×R)) − π_X(σ_{Q.Y=R.Y and Q.T>2}(Q×R)).
Tap to enlarge
Answer & solution

Official answer: 1

1. Evaluate the two projected sets separately before subtracting them. The left selection is an equality join on Y with the additional restriction R.V=V2.
2. Restricting R to V2 leaves (Y3,V2) and (Y2,V2). P has no Y3 tuple and has exactly one Y2 tuple, (X2,Y2,Z2). Thus the left join contributes X2 and its projection is {X2}. P's Y1 and Y4 rows fail the selection.
3. On the right, first keep Q rows with T>2: (X1,Y2,5) and (X1,Y1,6). The rows with T=2 and T=1 are excluded by the strict inequality.
4. The surviving Y2 row matches two R rows, with V3 and V2; the Y1 row matches (Y1,V1). These three join tuples all carry X1. Relational-algebra projection removes duplicates, so the right projected set is {X1}, not three copies of X1.
5. Set difference keeps left-side tuples absent from the right side: {X2}−{X1}={X2}. The result contains exactly 1 tuple.
6. Difference is directional and is not subtraction of the two row counts. Also, relational algebra uses set projection here; SQL without DISTINCT would require separate attention to bag semantics.

Original paper, page 16 · Answer key