GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 2026 · Set 1

65 questions

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

03:00:00
1 mark · MCQ
Report issue

Finding the opposite narrative role

Vocabulary & Verbal Analogies

Question 1, GATE 2026: Choose the antonym of protagonist from: A agnostic, B antagonist, C arsonist, D anarchist.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Givens and goal

Choose the antonym of protagonist from: A agnostic, B antagonist, C arsonist, D anarchist.

Approach

Compare the meanings in the context of characters in a narrative, rather than choosing a word with a similar sound.

Step-by-step solution

1. A protagonist is the main character around whom a story is organized. The word describes a role, not necessarily a morally good person.
2. An antagonist is the character or force opposing that protagonist. It is the contrasting narrative role and therefore the intended antonym.
3. An agnostic does not claim knowledge about the existence of a deity; an arsonist deliberately sets fires; an anarchist advocates or favors the absence of imposed government. None names the opposing role in a story.
4. Therefore select B, antagonist. A villain can be the protagonist of a story, so equating protagonist with “good person” would be an unreliable way to solve the question.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Area invariant in a tiling problem

Geometry & Spatial Aptitude

Question 2, GATE 2026: The permitted tiles are a 2-by-2 square and a 1-by-4 bar, each made of four unit squares. Either may be reused and rotated, with no overlaps. The candidate target rectangles are A: 2 by 4, B: 3 by 4, C: 3 by 5, D: 4 by 5. Identify the one that cannot be tiled.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Givens and goal

The permitted tiles are a 2-by-2 square and a 1-by-4 bar, each made of four unit squares. Either may be reused and rotated, with no overlaps. The candidate target rectangles are A: 2 by 4, B: 3 by 4, C: 3 by 5, D: 4 by 5. Identify the one that cannot be tiled.

Approach

First use area as a necessary condition, then construct explicit tilings for the remaining options.

Step-by-step solution

1. If a target uses r square tiles and s bar tiles, its area is 4r+4s=4(r+s). Therefore its number of unit cells must be divisible by 4. Rotation does not change this invariant.
2. The four target areas are 8, 12, 15 and 20. Since 15 is not divisible by 4, option C cannot be formed from whole permitted tiles without overlaps or gaps.
3. Divisibility alone is not sufficient for every tiling problem, so check the other shapes constructively. A can be covered by two horizontal 1-by-4 bars, one per row. B can be covered by three such bars. D can be covered by five vertical 4-by-1 bars, one per column.
4. These constructions prove that A, B and D are possible, leaving only C impossible. The 2-by-2 piece need not be used because the wording permits either piece alone.

Text diagram of the successful constructions: A has row labels AAAA / BBBB; B has AAAA / BBBB / CCCC; D has ABCDE repeated in four rows. Each letter denotes one bar, not an individual square tile. The unit-cell counts and both allowed pieces were checked in the source figure.

Original paper, page 2 · Answer key

1 mark · MCQ
Report issue

Counting games by eliminations

Counting, Probability & Sets

Question 3, GATE 2026: A knockout singles tournament begins with 64 players. Every game has one loser, who leaves the tournament; play ends with one unbeaten winner. Find the total number of games. Choices: 127, 64, 63, 32.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Givens and goal

A knockout singles tournament begins with 64 players. Every game has one loser, who leaves the tournament; play ends with one unbeaten winner. Find the total number of games. Choices: 127, 64, 63, 32.

Approach

Count how many eliminations are required instead of trying to enumerate all possible bracket arrangements.

Step-by-step solution

1. Exactly one of the 64 entrants remains at the end, so 64−1=63 entrants must be eliminated.
2. A game eliminates exactly one entrant because there are no ties and the loser leaves immediately. It cannot eliminate two, and the eventual winner is never eliminated.
3. Thus 63 eliminations require exactly 63 games, giving option C.
4. As a check, a balanced bracket has 32 first-round games, then 16, 8, 4, 2 and 1. Their sum is 63. The elimination argument remains valid even if the schedule is not balanced; 32 counts only the first round, while 64 incorrectly counts a loss for the champion.

Original paper, page 3 · Answer key

1 mark · MCQ
Report issue

Maximizing elective credits

Algebra, Equations & Number Patterns

Question 4, GATE 2026: A student must take between 60 and 70 credits in total, including exactly 15 core credits, exactly 20 project credits, and at least 10 specialization credits. Find the maximum elective credits; the choices are 10, 15, 20 and 25.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Givens and goal

A student must take between 60 and 70 credits in total, including exactly 15 core credits, exactly 20 project credits, and at least 10 specialization credits. Find the maximum elective credits; the choices are 10, 15, 20 and 25.

Approach

Write the total-credit inequality and minimize the compulsory non-elective allocation.

Step-by-step solution

1. Let s be specialization credits and e elective credits. The total is 15+20+s+e=35+s+e, with s≥10 and 60≤35+s+e≤70.
2. The upper constraint gives e≤35−s. Since s≥10, it follows that e≤25. Increasing specialization above its minimum only reduces the capacity available for electives.
3. To show the bound is attainable, choose s=10 and e=25. The total becomes 15+20+10+25=70, which satisfies both the minimum 60 and maximum 70.
4. Therefore the maximum is 25 credits, option D. Using the minimum total 60 would give 15 elective credits at s=10, but the question asks for the largest allowed elective allocation, not the minimum needed to graduate.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Implication versus its converse

Data Interpretation & Logical Reasoning

Question 5, GATE 2026: The premise says that whenever the teacher is in the room, every student stands silently. Which claim need not follow? A: a student not standing silently implies the teacher is absent; B: teacher present implies all silent; C: all standing implies teacher present; D: teacher present implies all standing.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Givens and goal

The premise says that whenever the teacher is in the room, every student stands silently. Which claim need not follow? A: a student not standing silently implies the teacher is absent; B: teacher present implies all silent; C: all standing implies teacher present; D: teacher present implies all standing.

Approach

Translate the premise into an implication, separate its consequences, and distinguish the contrapositive from the converse.

Step-by-step solution

1. Let T mean “teacher present”, S mean “all students standing”, and Q mean “all students silent”. The premise is T⇒(S∧Q).
2. If T is true, both conjuncts must be true. This proves B, T⇒Q, and D, T⇒S.
3. The contrapositive is ¬(S∧Q)⇒¬T. If any student is not standing silently, the conjunction fails, so the teacher cannot be present. That is A.
4. The converse S⇒T is not implied. A valid counterexample has the teacher absent but all students standing, perhaps while waiting for the teacher. The premise remains true because it imposes a condition only when the teacher is present.
5. Hence C is the statement that is not necessarily true. The counterexample need not prove C always false; one permitted situation in which C fails is enough.

Original paper, page 4 · Answer key

2 marks · MCQ
Report issue

Reading limited and universal claims

Reading Comprehension & Verbal Reasoning

Question 6, GATE 2026: A passage describes combinatorial counting and says that it is sometimes used to model physical phenomena; probabilities are often assigned to the possibilities to calculate average quantities. P claims combinatorics is always used in physical modeling. Q claims some physical models assign probabilities to combinatorial possibilities to obtain averages. Classify P and Q.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Givens and goal

A passage describes combinatorial counting and says that it is sometimes used to model physical phenomena; probabilities are often assigned to the possibilities to calculate average quantities. P claims combinatorics is always used in physical modeling. Q claims some physical models assign probabilities to combinatorial possibilities to obtain averages. Classify P and Q.

Approach

Track the quantifiers “sometimes/some” and “always”, without broadening what the passage actually supports.

Step-by-step solution

1. The passage gives a particular use of combinatorics: count possible arrangements or outcomes, assign probabilities, and average a physical quantity over those outcomes.
2. This is precisely the existential, limited claim in Q. It says some models work this way, not that every model must, so Q is supported.
3. P replaces that limited claim with “always”. The passage supplies no basis for saying that every model of every physical phenomenon invokes combinatorics. The intended reading-comprehension classification rejects P and accepts Q.
4. Therefore the published answer is B: P false and Q true. A rejects the supported statement Q; C and D accept the unsupported universal assertion P.

Logical qualification: “not established by the passage” is not, in formal logic, the same as “its negation has been proved”. The passage's word “sometimes” does not itself exhibit a physical model that never uses combinatorics. Preserve the official passage-based interpretation rather than presenting this as a strict mathematical proof of ¬P.

Original paper, page 5 · Answer key

2 marks · MCQ
Report issue

Matching two orthographic projections

Geometry & Spatial Aptitude

Question 7, GATE 2026: The source supplies front and top views of a stepped solid and four candidate 3D solids, labeled (i)–(iv), corresponding to A–D. The front silhouette has left-to-right heights 3, 2, 2. The top footprint occupies a 3-by-3 grid except its front-right cell, and also shows internal step boundaries. Select the solid matching both views. The linked page contains all four perspective drawings.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Givens and goal

The source supplies front and top views of a stepped solid and four candidate 3D solids, labeled (i)–(iv), corresponding to A–D. The front silhouette has left-to-right heights 3, 2, 2. The top footprint occupies a 3-by-3 grid except its front-right cell, and also shows internal step boundaries. Select the solid matching both views. The linked page contains all four perspective drawings.

Approach

Use the footprint to eliminate candidates, then compare heights and internal visible edges; an outline match alone is not enough.

Step-by-step solution

1. Represent a solid by the stack height above each top-view cell. A zero means a missing cell. Candidate (iv) has this height grid, taking rows from back to front and columns from left to right:

    back:    3  2  2
    middle:  3  1  1
    front:   2  1  0

2. The nonzero entries form the required footprint: every cell of the 3-by-3 square is occupied except the front-right cell. Candidate (i) instead fills that corner and therefore fails the top view.
3. In the front view, depth is collapsed. The visible silhouette height of each column is its maximum height over all depth rows. For (iv), those maxima are max(3,3,2)=3, max(2,1,1)=2 and max(2,1,0)=2, exactly the required 3,2,2. Candidate (iii) raises the middle silhouette column to 3 and fails this test.
4. The top view includes more than the footprint. Adjacent columns at unequal heights create step edges, whereas adjoining top faces at the same height merge. In the displayed grid the left height-3 cells form one back-to-middle strip, the back height-2 cells form a right-hand strip, and the height-1 cells form the lower terrace. These reproduce the target internal boundaries. Candidate (ii) introduces a raised middle terrace and a different step boundary.
5. Candidate (iv) satisfies both projections, so select D. The grid is an explanatory reconstruction of the correct solid, not a replacement for all four original perspective drawings; those remain accessible at the direct source-page link.

Original paper, page 6 · Answer key

2 marks · MCQ
Report issue

Building a capped ramp from hinges

Algebra, Equations & Number Patterns

Question 8, GATE 2026: For S,K>0, define H_K(S)=max(S−K,0). The plotted N(S) is zero through S=10, rises linearly from (10,0) to (20,10), and stays at 10 afterwards. Choices: A H_10−H_20; B H_10−2H_20; C −H_10+H_20; D H_15−H_20.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Givens and goal

For S,K>0, define H_K(S)=max(S−K,0). The plotted N(S) is zero through S=10, rises linearly from (10,0) to (20,10), and stays at 10 afterwards. Choices: A H10−H20; B H10−2H_20; C −H10+H20; D H15−H20.

Approach

Transcribe the graph as a piecewise function, then activate the hinge terms one interval at a time.

Step-by-step solution

1. The middle line has slope (10−0)/(20−10)=1. Hence N(S)=0 for 0<S≤10, N(S)=S−10 for 10<S≤20, and N(S)=10 for S>20.
2. H10 starts a slope-1 ramp at 10. On its own it would continue increasing beyond 20, so subtract a second slope-1 ramp that starts at 20.
3. Evaluate A=H10−H20. Below 10 both terms vanish. Between 10 and 20 only H10 is active, giving S−10. Above 20, the result is (S−10)−(S−20)=10. It also takes the correct endpoint values at 10 and 20.
4. B instead has slope 1−2=−1 above 20 and falls after the peak. C is the negative of A. D starts rising too late, at 15, and reaches a plateau of only 5. Thus only A matches every segment of the graph.

Graph coordinates for reconstruction: (0,0) to (10,0) to (20,10), followed by a horizontal ray at height 10.

Original paper, page 7 · Answer key

2 marks · MCQ
Report issue

Locating the bronze-winning throw

Data Interpretation & Logical Reasoning

Question 9, GATE 2026: In a six-round javelin final, Chopra wins gold with his second-round throw, Vadlejch wins silver and Vesely bronze. Neither silver nor bronze athlete makes a medal-winning throw in rounds 1–2. Their sixth throws are fouls. Vesely is second after four rounds and never improves later. Vadlejch has the best throw of round 4. Determine the round of Vesely’s best throw: 3, 4, 5 or 6.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Givens and goal

In a six-round javelin final, Chopra wins gold with his second-round throw, Vadlejch wins silver and Vesely bronze. Neither silver nor bronze athlete makes a medal-winning throw in rounds 1–2. Their sixth throws are fouls. Vesely is second after four rounds and never improves later. Vadlejch has the best throw of round 4. Determine the round of Vesely’s best throw: 3, 4, 5 or 6.

Approach

Eliminate rounds inconsistent with the observations, using the ranking after round 4 to distinguish rounds 3 and 4.

Step-by-step solution

1. Vesely’s eventual best is his bronze-medal throw. The premise excludes medal-winning throws by him in rounds 1 and 2, so neither can be his best.
2. He has reached his best by the end of round 4 and does not improve in rounds 5 or 6. In particular, round 6 is a foul, so the winning distance must already occur in round 3 or 4.
3. Suppose his best occurred in round 4. Vadlejch’s throw is the best in that round, so it is farther than Vesely’s round-4 throw and hence farther than Vesely’s best through round 4.
4. Chopra is already ahead with his gold-winning round-2 throw. Vadlejch would therefore also be ahead of Vesely after round 4, putting Vesely no higher than third. This contradicts the stated second position.
5. Round 4 is impossible; the remaining round is 3, option A. This argument uses the stated strict ranking of the throws, rather than the athletes’ real-world distances.

Original paper, page 8 · Answer key

2 marks · MCQ
Report issue

Counting ordered dice multiples

Counting, Probability & Sets

Question 10, GATE 2026: A fair six-sided die labeled 1–6 is rolled twice. Find the probability that the second result is an integer multiple of the first. Options: 1/6, 5/18, 7/18, 5/6.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Givens and goal

A fair six-sided die labeled 1–6 is rolled twice. Find the probability that the second result is an integer multiple of the first. Options: 1/6, 5/18, 7/18, 5/6.

Approach

Count favorable ordered pairs by fixing the first result; multiplication by 1 is allowed.

Step-by-step solution

1. The outcomes are ordered pairs (first,second). Independence and fairness give 6×6=36 equally likely outcomes.
2. If the first result is 1, every second result qualifies: 1,2,3,4,5,6. If it is 2, the qualifying second results are 2,4,6. For 3 they are 3,6. For 4,5,6 they are respectively only 4, only 5, and only 6.
3. The favorable counts are therefore 6+3+2+1+1+1=14. Equivalently, sum floor(6/a) over a=1,…,6.
4. The probability is 14/36=7/18, so select C. Equal results must count because a=1·a. Conversely, (2,4) qualifies but (4,2) does not; treating the rolls as unordered pairs would use the wrong sample space.

Original paper, page 9 · Answer key

1 mark · MCQ
Report issue

Reinforced urn draws

Probability & Statistics

Question 11, GATE 2026: An urn starts with one red and one blue ball. Each step selects a ball uniformly, then returns it together with one additional ball of its color. Find the probability of equal red and blue counts after two steps. Options: 1/4, 1/3, 1/2, 2/3.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Our answer: 1/3

Givens and goal

An urn starts with one red and one blue ball. Each step selects a ball uniformly, then returns it together with one additional ball of its color. Find the probability of equal red and blue counts after two steps. Options: 1/4, 1/3, 1/2, 2/3.

Approach

Track the changing composition after the first draw; the two draws are not independent.

Step-by-step solution

1. Each step adds exactly one ball, so after two steps there are four balls. Equal color counts mean two red and two blue, which requires adding one ball of each color.
2. Thus the selected colors must be RB or BR. For RB, the first red has probability 1/2. The urn then contains two red and one blue, so the conditional probability of blue is 1/3. Therefore Pr(RB)=(1/2)(1/3)=1/6.
3. Symmetrically, Pr(BR)=(1/2)(1/3)=1/6. These ordered events are disjoint, giving total probability 1/6+1/6=1/3, option B.
4. As a check, RR has probability (1/2)(2/3)=1/3 and BB has the same probability. The four sequence probabilities sum to 1. The tempting result 1/2 comes from incorrectly retaining a 1/2 chance for each color on the second draw.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Counting binary parity matrices

Combinatorics & Counting

Question 12, GATE 2026: Count 4-by-4 matrices with entries 0 or 1 in which every row and every column has an even number of ones. The offered counts include 512, 1025, 1023 and 255.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: 512; option A

Givens and goal

Count 4-by-4 matrices with entries 0 or 1 in which every row and every column has an even number of ones. The offered counts include 512, 1025, 1023 and 255.

Approach

Choose an independent block freely and show that parity determines every remaining entry uniquely.

Step-by-step solution

1. Select the nine entries a_ij with 1≤i,j≤3 arbitrarily. Each is a binary choice, so there are 29 possibilities at this stage.
2. For each of the first three rows, choose ai4 as the sum of its first three entries modulo 2. If that sum is odd, append 1; if even, append 0. This forces even row parity.
3. For each of the first three columns, choose a_4j similarly from its first three entries. This forces even column parity.
4. Let p be the parity of the original 3-by-3 block. The parity of the three new bottom-row entries is p, and the parity of the three new last-column entries is also p: both count the same nine original entries. Setting a44=p therefore makes both the last row and last column even simultaneously.
5. Every initial block has exactly one completion, and different initial blocks yield different matrices. Thus the required count is 29=512, option A.

Why not 28? Although eight parity conditions are written, one is redundant: the total parity obtained by summing row parities equals that obtained by summing column parities. There are seven independent constraints on sixteen bits, leaving nine free bits.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Maximum eigenvalue multiplicity

Linear Algebra

Question 13, GATE 2026: For n>1, find the largest possible multiplicity of one eigenvalue of a real n-by-n matrix. Options: n, n−1, 1, n+1.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: n

Givens and goal

For n>1, find the largest possible multiplicity of one eigenvalue of a real n-by-n matrix. Options: n, n−1, 1, n+1.

Approach

Prove an upper bound from the characteristic polynomial, then exhibit a matrix attaining it.

Step-by-step solution

1. The characteristic polynomial det(λI−M) has degree n. Algebraic multiplicity counts how many times a root occurs in that polynomial, so no eigenvalue can have algebraic multiplicity larger than n.
2. The identity matrix In attains this bound: det(λI−In)=(λ−1)n. Its eigenvalue 1 occurs with multiplicity n.
3. Therefore n is both an upper bound and achievable, giving option A. The choices n−1 and 1 are too small for In; n+1 is impossible for a degree-n polynomial.
4. If “multiplicity” were read as geometric multiplicity, the maximum is still n: the eigenspace {v:I_nv=v} is all of Rn and has dimension n. The algebraic/geometric distinction matters for some matrices, but not for this maximum.

Original paper, page 11 · Answer key

1 mark · MCQ
Report issue

Matching addressing modes to data

Instructions & Addressing Modes

Question 14, GATE 2026: Match P immediate, Q indirect, R base with index, S base with offset to 1 array element, 2 pointer, 3 record field, 4 constant. The choices give different permutations of these matches.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Givens and goal

Match P immediate, Q indirect, R base with index, S base with offset to 1 array element, 2 pointer, 3 record field, 4 constant. The choices give different permutations of these matches.

Approach

Write the effective operand or effective address for each addressing mode and identify the high-level data access it implements.

Step-by-step solution

1. Immediate addressing puts the operand value directly in the instruction, such as an encoded literal 7. It naturally represents a constant, so P→4.
2. Indirect addressing obtains an operand’s address through another location or register. A pointer holds an address and is dereferenced to find the actual data, so Q→2.
3. Base-plus-index addressing computes an address from an array base and an index-dependent displacement, conceptually base+i·element_size. Varying i chooses an array element, so R→1.
4. Base-plus-fixed-offset addressing selects a field at a fixed byte displacement from the start of a record, such as record_base+offset_of_field. Thus S→3.
5. The complete mapping is (P,Q,R,S)→(4,2,1,3), option B. The key distinction is a varying index for array positions versus a fixed layout displacement for a named record field; both may ultimately use addition in the hardware.

Original paper, page 11 · Answer key

1 mark · MCQ
Report issue

Implementing addition on a load-store ISA

Instructions & Addressing Modes

Question 15, GATE 2026: X, Y and Z are memory locations. R0, R1 and R2 are registers. In a load-store architecture with destination-first syntax, select the instruction sequence implementing Z=X+Y. Options A–C use memory directly in an ADD; D loads X and Y, adds registers, and stores the result.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Givens and goal

X, Y and Z are memory locations. R0, R1 and R2 are registers. In a load-store architecture with destination-first syntax, select the instruction sequence implementing Z=X+Y. Options A–C use memory directly in an ADD; D loads X and Y, adds registers, and stores the result.

Approach

Separate data movement from arithmetic and trace where each value resides after every instruction.

Step-by-step solution

1. A load-store ISA permits ordinary arithmetic instructions to use registers, not arbitrary memory operands. First execute LOAD R0,X, giving R0=memory[X].
2. Execute LOAD R1,Y, giving R1=memory[Y]. Both operands of the addition are now available in registers.
3. Execute ADD R2,R0,R1. Destination-first syntax means R2 receives R0+R1; it does not mean R0 is overwritten.
4. Execute STORE Z,R2. This copies the sum from R2 to memory[Z], completing the high-level assignment. This four-instruction sequence is option D.
5. A tries ADD Z,X,Y with all three operands in memory. B loads only X and still uses memory for Y and the ADD destination. C computes ADD R0,X,Y without loading either source. These violate the stated load-store arithmetic restriction even if some other ISA might allow them.

Original paper, page 12 · Answer key

1 mark · MCQ
Report issue

Pipeline dependencies and model assumptions

Pipelining & Hazards

Question 16, GATE 2026: Which register dependence can cause a data hazard in a pipelined processor? A read-after-read, B read-after-write, C write-after-read, D write-after-write. The source does not explicitly constrain instruction issue or completion order.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Our answer: B in the classic in-order fixed-stage model; WAR/WAW can also be hazards in broader pipeline models.

Givens and goal

Which register dependence can cause a data hazard in a pipelined processor? A read-after-read, B read-after-write, C write-after-read, D write-after-write. The source does not explicitly constrain instruction issue or completion order.

Approach

Explain the true producer-consumer hazard, then state the narrower pipeline model needed to make the official MCQ selection unique.

Step-by-step solution

1. Suppose instruction I1 computes R1=R2+R3 and the following instruction I2 computes R4=R1+1. I2 must read the value produced by I1, so this is a read-after-write (RAW) dependence on R1.
2. If I2 reaches its register-read/use stage before I1’s result is available, it can read the old R1. That is a data hazard. Forwarding or a stall may be needed to preserve the intended computation. Thus B is a genuine hazard category.
3. In the conventional single-issue, in-order, fixed-stage pipeline, reads occur in an earlier fixed stage than writes. A later instruction cannot overtake an earlier read or write. Under those assumptions, WAR and WAW dependencies do not cause hazards, and B is the intended unique answer. RAR is not a hazard because neither instruction changes the shared register.
4. The unrestricted wording is broader. A write-after-read (WAR) hazard can arise if an earlier instruction is delayed before reading R1 and a later instruction overwrites R1 first. A write-after-write (WAW) hazard can arise if a slow earlier instruction and a fast later instruction both write R1, but the earlier write completes last, leaving the wrong final value.
5. Therefore preserve official B for scoring, with the qualification that C and D can also be hazard categories in pipelines permitting the relevant reordering. Register renaming and ordering mechanisms may prevent them, but are not specified.

CS-2026-S1-Q16-PIPELINE-MODEL. This is a model-dependent uniqueness issue, not an official key correction. The published single-answer selection requires the narrower pipeline convention described above.

Original paper, page 13 · Answer key

1 mark · MCQ
Report issue

Solving nested recurrences

Asymptotic Analysis & Recurrences

Question 17, GATE 2026: For n>1, T1(n)=4T1(n/2)+T2(n), and T2(n)=5T2(n/4)+Θ(log₂n). Both equal 1 for n≤1. Determine T1’s asymptotic order among n², n²log₂n, n^(log₄5), and n^(log₄5)log₂n.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: Theta(n^2)

Givens and goal

For n>1, T1(n)=4T1(n/2)+T2(n), and T2(n)=5T2(n/4)+Θ(log₂n). Both equal 1 for n≤1. Determine T1’s asymptotic order among n², n²log₂n, nlog₄5, and nlog₄5log₂n.

Approach

Solve T2 first, then use its growth rate as the nonrecursive term in the recurrence for T1.

Step-by-step solution

1. In T2, the branching parameters are a=5 and b=4. The critical power is nlog₄5. Set α=log₄5≈1.161.
2. A logarithm is polynomially smaller than n^α: for example log₂n=O(nα/2). The first case of the Master theorem therefore gives T2(n)=Θ(n^α).
3. Substitute into T1: T1(n)=4T1(n/2)+Θ(n^α). Its critical power is nlog₂4=n². Because α<2, the additive term is again polynomially smaller than the critical power.
4. Applying the same Master-theorem case yields T1(n)=Θ(n²), option A. There is no extra logarithmic factor because the additive term is not Θ(n²), which would be the balanced case.
5. A recursion-tree check explains the dominance. At depth j, the T2 work totals Θ(4j(n/2j)^α)=Θ(n^α(4/2^α)j). The ratio exceeds 1, so lower levels dominate. With depth log₂n, the leaf scale is 4log₂n=n². Standard floor/ceiling handling of non-power inputs does not change this asymptotic result.

Original paper, page 14 · Answer key

1 mark · MCQ
Report issue

TCP establishment and simultaneous close

Transport, Congestion Control & Traffic Shaping

Question 18, GATE 2026: Choose the true TCP statement: A establishment uses a two-way handshake; B only the client may initiate closing; C TCP is half-duplex; D client and server may initiate closing simultaneously.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Givens and goal

Choose the true TCP statement: A establishment uses a two-way handshake; B only the client may initiate closing; C TCP is half-duplex; D client and server may initiate closing simultaneously.

Approach

Distinguish connection establishment, directional data flow, and each endpoint’s independent ability to send FIN.

Step-by-step solution

1. Ordinary TCP establishment uses SYN, SYN+ACK and ACK, a three-way handshake. Therefore A’s two-way-handshake description is incorrect.
2. A TCP connection supports data in both directions independently. Either endpoint may transmit while receiving, so it is full-duplex rather than half-duplex; C is false.
3. Either endpoint can initiate closing its sending direction by sending FIN. The server need not wait for the client to begin, so B is false.
4. Both endpoints may independently send FIN before receiving the other endpoint’s FIN. TCP handles this simultaneous close by acknowledging each FIN and completing the state transitions. Thus D is true.
5. Closing is not a rule that only a designated “client side” may invoke: client and server describe connection establishment roles, not permanent ownership of shutdown.

Original paper, page 15 · Answer key

1 mark · MSQ
Report issue

HTTP/1.1 persistence and pipelining

Application Protocols

Question 19, GATE 2026: For ordinary direct browser-to-origin HTTP/1.1, evaluate: A several same-page objects on one server can use one TCP connection; B objects on different servers can use that same direct TCP connection; C another request may be sent before the prior object finishes downloading; D several pages on one server may share a TCP connection.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C, D

Givens and goal

For ordinary direct browser-to-origin HTTP/1.1, evaluate: A several same-page objects on one server can use one TCP connection; B objects on different servers can use that same direct TCP connection; C another request may be sent before the prior object finishes downloading; D several pages on one server may share a TCP connection.

Approach

Separate persistent connections from pipelining and from changing the remote TCP endpoint.

Step-by-step solution

1. A persistent connection can carry successive request/response exchanges with its server. Its lifetime is not limited to one embedded object, nor to one HTML page. Hence A and D are supported.
2. Pipelining permits a client to send another request before the preceding response has finished arriving. Responses still arrive in request order; pipelining is not arbitrary interleaving of response bodies. Thus C is supported.
3. A direct TCP connection has a fixed remote endpoint. It cannot become a direct connection to another server merely because the next resource belongs to the same webpage. Under the question's ordinary browser-to-origin-server interpretation, B is false.

Standards cross-check: [RFC 9112, section 9.3](https://httpwg.org/specs/rfc9112.html#persistent.connections) describes persistent connections and section 9.3.2 describes pipelining. Protocol support does not imply that every browser currently enables pipelining.

Interpretation caveat: A connection to a forward proxy can carry requests for multiple origins. Therefore the explanation rejects B for direct browser-to-server connections, not as an absolute statement about every HTTP deployment. This caveat does not change the published key.

Worked connection example: a browser can request /index.html, /style.css and /logo.png from the same origin through one persistent TCP connection. With pipelining it may send the later requests before the first response body is complete, although HTTP/1.1 preserves response order. It can later request /about.html on that still-open connection too. This explains A, C and D without assuming that pipelining provides HTTP/2-style multiplexing.

Original paper, page 15 · Answer key

1 mark · MSQ
Report issue

Consequences of a nonzero null vector

Linear Algebra

Question 20, GATE 2026: An n-by-n real matrix M, n>1, has e₂=(0,1,0,…,0) in its null space. Decide which claims must hold: A det(M)=1; B det(M)=0; C rank(M)=1; D its null space contains at least two nonzero vectors.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Our answer: Singular matrix; at least two nonzero null vectors

Givens and goal

An n-by-n real matrix M, n>1, has e₂=(0,1,0,…,0) in its null space. Decide which claims must hold: A det(M)=1; B det(M)=0; C rank(M)=1; D its null space contains at least two nonzero vectors.

Approach

Use Me₂=0 to infer singularity, then use closure of a vector space under scalar multiplication.

Step-by-step solution

1. Multiplication by e₂ selects M’s second column. Since Me₂=0, that column is the zero vector. In particular, M maps a nonzero input to zero and cannot be invertible.
2. A square matrix is singular exactly when its determinant is zero, so B is true and A is false. Equivalently, a zero column immediately forces determinant zero.
3. Null spaces are vector spaces. Since e₂ is in the null space, M(2e₂)=2Me₂=0 as well. The vectors e₂ and 2e₂ are distinct and nonzero, proving D. They need not be linearly independent; the statement asks only for two vectors.
4. Rank is not fixed by this information. The zero matrix satisfies the premise and has rank 0. The diagonal matrix diag(1,0,1,…,1) has rank n−1 and also satisfies it. Therefore C is not always true.
5. The guaranteed conclusion is rank(M)≤n−1 and nullity(M)≥1, with infinitely many nonzero null vectors over R. Select B and D.

Original paper, page 16 · Answer key

1 mark · MSQ
Report issue

Simplifying a Boolean XOR expression

Boolean Algebra & Logic Gates

Question 21, GATE 2026: Let F(P,Q)=((NOT P) OR Q) XOR ((NOT P) AND Q). Identify equivalent expressions: A NOT(P XOR Q); B P XOR Q; C (NOT P) XOR Q; D (NOT P) XOR (NOT Q).
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C

Givens and goal

Let F(P,Q)=((NOT P) OR Q) XOR ((NOT P) AND Q). Identify equivalent expressions: A NOT(P XOR Q); B P XOR Q; C (NOT P) XOR Q; D (NOT P) XOR (NOT Q).

Approach

Rename the two repeated inputs and compare OR XOR AND with the definition of exclusive OR.

Step-by-step solution

1. Let x=NOT P and y=Q. The given expression becomes (x OR y) XOR (x AND y).
2. If both x and y are zero, both inner expressions are zero and the result is zero. If exactly one is one, the OR is one and the AND zero, so the result is one. If both are one, both inner expressions are one and the result is zero. Thus the expression is x XOR y.
3. Substituting back gives (NOT P) XOR Q, exactly option C. Complementing one XOR input complements the XOR result, so this is also NOT(P XOR Q), option A.
4. B is P XOR Q, the opposite function. D complements both XOR inputs and therefore equals P XOR Q as well, so neither is equivalent to the given expression.

Truth-table check: For (P,Q)=00,01,10,11, the output is respectively 1,0,0,1. This is XNOR of P and Q.

Visual check: Option A's bar covers the whole XOR expression; C complements P only; D complements each input separately. Those distinctions were confirmed in the rendered source.

Explicit truth table

    P Q | NOT P OR Q | NOT P AND Q | F
    0 0 |      1     |       0     | 1
    0 1 |      1     |       1     | 0
    1 0 |      0     |       0     | 0
    1 1 |      1     |       0     | 1

The first two intermediate columns distinguish OR from AND; XOR of equal bits is zero and XOR of unequal bits is one. Matching the final column, rather than just manipulating complement symbols visually, verifies both selected forms.

Original paper, page 16 · Answer key

1 mark · MSQ
Report issue

Overflow in sign-magnitude arithmetic

Number Systems & Computer Arithmetic

Question 22, GATE 2026: X and Y are 8-bit sign-magnitude words 10110100 and 01001100. Which results cannot be represented as an 8-bit sign-magnitude Z: A X+Y; B X−Y; C −X+Y; D −X−Y?
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

Step through it (8 steps)

Givens and goal

X and Y are 8-bit sign-magnitude words 10110100 and 01001100. Which results cannot be represented as an 8-bit sign-magnitude Z: A X+Y; B X−Y; C −X+Y; D −X−Y?

Approach

Decode sign and magnitude separately, calculate the mathematical result of each operation, and compare with the representable interval.

Step-by-step solution

1. One bit is the sign and seven bits hold the magnitude. The largest magnitude is 27−1=127, so representable values lie from −127 to +127. There are separate encodings of zero; there is no −128 value.
2. X has sign 1 and magnitude 0110100₂=32+16+4=52, so X=−52. Y has sign 0 and magnitude 1001100₂=64+8+4=76, so Y=+76.
3. A gives X+Y=−52+76=24, which is representable. B gives X−Y=−52−76=−128, below the minimum, so it overflows.
4. C gives −X+Y=52+76=128, above the maximum, so it overflows. D gives −X−Y=52−76=−24, which is representable.
5. Select B and C. The raw bit patterns must not be interpreted as two’s-complement values: that different representation would assign a different value to X and a different representable lower bound.

Original paper, page 17 · Answer key

1 mark · MSQ
Report issue

Leaf indices in a binary heap

Heaps & Priority Queues

Question 23, GATE 2026: A binary minheap contains an odd number n>100 of entries in a 1-indexed array. Which positions are not leaves? A (n+1)/2; B (n−1)/2; C (n−3)/2; D n.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

Our answer: (n-1)/2 and (n-3)/2

Givens and goal

A binary minheap contains an odd number n>100 of entries in a 1-indexed array. Which positions are not leaves? A (n+1)/2; B (n−1)/2; C (n−3)/2; D n.

Approach

Use the array child-index formula; heap ordering by key value is irrelevant to the tree shape.

Step-by-step solution

1. For a node at position i, its left child would be at 2i and right child at 2i+1. A node is internal if at least the left child exists, which means 2i≤n.
2. Thus internal positions are 1 through floor(n/2); positions floor(n/2)+1 through n are leaves.
3. Write n=2k+1. Then floor(n/2)=k and the proposed positions become A k+1, B k, C k−1, D 2k+1.
4. Positions k and k−1 lie in the internal range. In particular k has children 2k and 2k+1. Positions k+1 and 2k+1 exceed the internal boundary and have no children.
5. Therefore B and C are not leaves. The condition n>100 ensures k−1 is positive and valid; the minheap property affects stored values, not this index boundary.

Original paper, page 18 · Answer key

1 mark · MSQ
Report issue

Linear probing with wraparound

Hashing

Question 24, GATE 2026: An initially empty table has indices 0–10, hash h(x)=(x+7) mod 11, and linear probing. Insert 1,13,22,15,11,24 in that order. Which listed positions are empty: A 0, B 10, C 2, D 1?
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C

Step through it (8 steps)

Givens and goal

An initially empty table has indices 0–10, hash h(x)=(x+7) mod 11, and linear probing. Insert 1,13,22,15,11,24 in that order. Which listed positions are empty: A 0, B 10, C 2, D 1?

Approach

Trace each home slot and each collision in insertion order, wrapping from index 10 to 0.

Step-by-step solution

1. Insert 1: h(1)=8, so place 1 at slot 8. Insert 13: h(13)=20 mod 11=9, so place 13 at 9.
2. Insert 22: h(22)=29 mod 11=7, so place 22 at 7. Insert 15: h(15)=22 mod 11=0, so place 15 at 0.
3. Insert 11: h(11)=18 mod 11=7. Slots 7,8,9 already contain 22,1,13. The first empty slot encountered is 10, so store 11 there.
4. Insert 24: h(24)=31 mod 11=9. Slots 9 and 10 are occupied; probing wraps to 0, which is also occupied. Slot 1 is empty, so place 24 at 1.
5. The final table is:

    index:  0   1   2  3  4  5  6   7   8   9   10
    value: 15  24   -  -  -  -  -  22   1  13   11

6. Of the four listed indices, only 2 is empty. Select C. The probing rule advances from the current candidate slot; it does not recompute a different hash after each collision.

Original paper, page 19 · Answer key

1 mark · MSQ
Report issue

Ambiguity and derivation uniqueness

Context-Free Grammars & Languages

Question 25, GATE 2026: For the grammar S→aSbS | bS | ε, decide: A the grammar is ambiguous; B abb has two distinct derivations; C abab has only one rightmost derivation; D the generated language is undecidable.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B, C

Givens and goal

For the grammar S→aSbS | bS | ε, decide: A the grammar is ambiguous; B abb has two distinct derivations; C abab has only one rightmost derivation; D the generated language is undecidable.

Approach

Exhibit different parse structures for the ambiguity claim, prove uniqueness for the specific other word, and use the decidability of context-free membership.

Step-by-step solution

Work with the grammar S → aSbS | bS | ε. Here ε denotes the empty string.

1. The string abb admits these two different leftmost derivations:

   - S ⇒ aSbS ⇒ abS ⇒ abbS ⇒ abb.
   - S ⇒ aSbS ⇒ abSbS ⇒ abbS ⇒ abb.
   In the first derivation, the extra b comes from the final S of the root production. In the second, it comes from the first S. Thus they represent different parse trees, not just different orders of expanding one tree. Both ambiguity (A) and the existence of two distinct derivations (B) follow.

2. For abab, the root must use aSbS because the word starts with a. Its explicit b must be the b in position 2 or position 4. Choosing position 4 would require the first S to generate ba. That is impossible: every nonempty word generated by S ends in b. To prove this invariant, bS ends in b if its child is empty or ends in b if its child does; aSbS has the same property through its explicit b and final child.
3. Consequently the explicit root b is in position 2, its first child is ε, and its final child generates ab. The latter has only the construction aSbS with both children empty. Therefore abab has exactly one parse tree and one rightmost derivation, establishing C. One rightmost derivation is S ⇒ aSbS ⇒ aSbaSbS ⇒ aSbaSb ⇒ aSbab ⇒ abab.
4. This is a context-free grammar. Membership in a context-free language is decidable, for example by converting to a suitable normal form and applying a finite parsing algorithm. Therefore the undecidability claim D is false.

Common error: Two unrestricted derivations can differ solely in expansion order. Ambiguity requires different parse trees, equivalently different leftmost derivations or different rightmost derivations; the witness above meets that stronger test.

Parse-tree distinction for abb can be made explicit by writing the root’s first and last S expansions as a pair. One tree has root a S b S with child words (ε,b); the other has child words (b,ε). Both concatenate to abb, but they attach the additional b to different children. This makes the ambiguity evidence structural, not just a consequence of expanding independent children in different orders.

Original paper, page 20 · Answer key

1 mark · MSQ
Report issue

Possible DFA sizes for a six-state NFA

Finite Automata

Question 26, GATE 2026: An NFA has six states over a finite alphabet. Which values cannot be the number of states of its minimal equivalent DFA: A 32, B 65, C 1, D 128?
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Givens and goal

An NFA has six states over a finite alphabet. Which values cannot be the number of states of its minimal equivalent DFA: A 32, B 65, C 1, D 128?

Approach

Use subset construction for an upper bound and explicit languages to verify the offered feasible values.

Step-by-step solution

1. Subset construction represents each DFA state by a subset of the six NFA states. There are at most 26 = 64 such subsets, including the empty subset. Epsilon closures, if applicable, do not increase this bound.
2. Removing unreachable states and minimizing can only reduce that number. A minimal equivalent DFA therefore cannot require 65 or 128 states, establishing B and D.
3. One state is possible: a six-state NFA can accept every string. For an example with all six states reachable, use a cycle of six accepting states over a one-letter alphabet. Its language is universal and its minimal DFA has one accepting state.
4. To check that 32 is genuinely possible, use the binary language whose fifth symbol from the end is 1. A six-state NFA has one start state that loops on 0 and 1, can nondeterministically guess a 1 as that fifth-from-last symbol, and then traverses four more symbol transitions to an accepting state. A 32-state DFA stores the last five symbols, initially padded with zeros. Any distinct five-bit histories differ in some position j; appending j−1 zeros makes that position the fifth symbol from the end. The two resulting strings have different acceptance outcomes. Thus all 32 histories are distinguishable and the minimal DFA has exactly 32 states.

Common error: An upper bound alone rules out the oversized choices; an explicit witness is useful to verify that the smaller offered values really are possible.

Subset-construction interpretation: after reading a prefix, an NFA may be in several states at once. A deterministic simulator records exactly that reachable subset. With six possible states, each independently present or absent, there are 64 possible records; different prefixes need not reach all of them. This is why 64 is an upper bound, not a claim that every six-state NFA requires 64 DFA states.

Original paper, page 20 · Answer key

1 mark · MSQ
Report issue

Lexical and semantic errors in C

Lexical Analysis

Question 27, GATE 2026: Three declarations are considered: S1 begins char *str1 = "Hello; without a closing double quote; S2 is char *str2 = "Hello;"; and S3 is int *str3 = "Hello";. The options classify S1/S2 as lexical or syntactic errors and S3 as syntactic or semantic.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C

Givens and goal

Three declarations are considered: S1 begins char *str1 = "Hello; without a closing double quote; S2 is char *str2 = "Hello;"; and S3 is int *str3 = "Hello";. The options classify S1/S2 as lexical or syntactic errors and S3 as syntactic or semantic.

Approach

Check whether valid tokens can be formed first, then whether the token sequence is grammatical, then whether the types are compatible.

Step-by-step solution

1. S1 opens a string literal but does not close it before the end of the line. Tokenization cannot form a valid string-literal token. In the compiler-phase classification used by the question, this is a lexical error.
2. S2 contains a properly closed string. Its semicolon inside the quotation marks is part of the string data, while the semicolon outside terminates the declaration. There is no lexical or syntactic error merely because both semicolons appear.
3. S3 has the shape of a grammatical declaration, but initializes an int pointer with a string literal, whose ordinary expression conversion produces a char pointer. The incompatible pointer types violate the C initialization constraints. This is a type/semantic error in the question's classification.
4. Therefore C correctly pairs the lexical error in S1 with the semantic error in S3. A and B misclassify S2, and D assigns the wrong compiler phase to S1.

Precision caveat: Real compilers may emit several cascading diagnostics after the malformed string. This solution classifies the primary defect, rather than treating every emitted diagnostic as a separate intended answer. In C, accepting a program after a warning or as an extension does not make a constraint violation valid standard C.

Phase distinction: lexical analysis groups characters into tokens, syntax checks token arrangements against the grammar, and semantic analysis checks constraints such as types. A semicolon character inside a valid string token has no role as a declaration terminator. That is why S2’s internal semicolon cannot by itself create a syntax error.

Original paper, page 21 · Answer key

1 mark · MSQ
Report issue

LL(1) grammar properties

Parsing & Syntax Analysis

Question 28, GATE 2026: Assess four claims: A LL(1) parsers backtrack; B an LL(1) grammar must be left-recursive; C an LL(1) grammar must be left-factored; D LL(1) parsers are more powerful than SLR parsers. The official choice is C, with a retained qualification about literal syntactic left factoring.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C

Our answer: Official scoring answer C; literal necessity claim is overbroad (see discrepancy).

Givens and goal

Assess four claims: A LL(1) parsers backtrack; B an LL(1) grammar must be left-recursive; C an LL(1) grammar must be left-factored; D LL(1) parsers are more powerful than SLR parsers. The official choice is C, with a retained qualification about literal syntactic left factoring.

Approach

Apply predictive-table conditions rather than treating grammar-transformation advice as an unrestricted necessity theorem.

Step-by-step solution

1. LL(1) selects a production from the next input token using a predictive parsing table. It does not use trial-and-error backtracking, so A is false.
2. Left recursion prevents ordinary predictive top-down parsing; it is something to remove, not a requirement for LL(1). Hence B is false.
3. Left factoring is a standard transformation for removing shared prefixes that obstruct predictive selection. This explains the intended textbook answer C, but syntactic left factoring is not literally necessary for every LL(1) grammar. Left factoring is also not sufficient: FIRST/FIRST or FIRST/FOLLOW conflicts can remain.
4. LL(1) does not have greater grammar-recognition power than SLR parsing. Thus D is false.

Discrepancy / interpretation issue: A reduced, productive counterexample is S → A a | A b, A → ε. The two S alternatives share the syntactic prefix A, so the grammar is not literally left-factored. Nevertheless FIRST(Aa)={a} and FIRST(Ab)={b}; the predictive table selects the two S productions in different columns. For A, its sole epsilon production is selected on FOLLOW(A)={a,b}. There are no conflicts, so the grammar is LL(1). Thus the exact general necessity claim in C is false under the standard syntactic definition of left-factored form. C remains the official scoring answer, but its literal necessity claim requires the qualification above. The issue is not restricted to unreachable or unproductive grammar alternatives.

Review: This counterexample was supplied during independent peer review and checked against FIRST/FOLLOW construction.

Predictive-table check for the counterexample

    Nonterminal   lookahead a      lookahead b
    S             S→Aa             S→Ab
    A             A→ε              A→ε

Each table cell contains at most one production, despite the common written prefix A. For the “more powerful” claim, note also that SLR parsing can handle standard left-recursive grammars such as E→E+a | a, which this predictive LL(1) form cannot parse without transformation. Do not replace the LL(1) table condition with either “left-recursive” or “left-factored” as a complete characterization.

Original paper, page 21 · Answer key

1 mark · MSQ
Report issue

Distinguishing deadlock avoidance from prevention

Deadlocks

Question 29, GATE 2026: Select the false statements: A Banker’s algorithm is deadlock prevention; B disallowing hold-and-wait prevents deadlock; C an assignment edge in a resource-allocation graph goes from process to resource; D a safe state permits every process to finish without deadlock.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C

Givens and goal

Select the false statements: A Banker’s algorithm is deadlock prevention; B disallowing hold-and-wait prevents deadlock; C an assignment edge in a resource-allocation graph goes from process to resource; D a safe state permits every process to finish without deadlock.

Approach

Distinguish the standard algorithm categories, recall graph edge direction, and interpret safety as existence of a safe completion sequence.

Step-by-step solution

1. Deadlock prevention structurally rules out at least one necessary condition, such as hold-and-wait. Avoidance instead examines potential grants and declines those that would leave the system unsafe.
2. Banker’s algorithm is an avoidance algorithm: it checks whether a safe completion sequence remains after a proposed allocation. Calling it prevention in the standard technical taxonomy is false, so select A.
3. If no process may hold resources while waiting for more, the hold-and-wait condition cannot hold. Since that condition is necessary for resource deadlock, B is true and must not be selected.
4. A request edge goes process→resource; an assignment edge goes resource-instance→process to indicate ownership. C reverses assignment direction, so select C.
5. A safe state means there is an order in which each process can obtain its remaining declared maximum need, finish, and release resources for later processes. That establishes D in the conventional safe-allocation sense.
6. Therefore the false statements are A and C. “Safe” asserts a feasible completion sequence under controlled allocation, not that arbitrary future grants can never make the system unsafe.

Original paper, page 22 · Answer key

1 mark · MSQ
Report issue

Functional dependencies and counterexamples

Functional Dependencies & Keys

Question 30, GATE 2026: For attributes P,Q,R,S, assess: A PQ→R and P→R imply Q→R; B PQ→R implies P→R or Q→R; C P→R and Q→S imply PQ→RS; D P→R implies PQ→R.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C, D

Step through it (4 parts)

Givens and goal

For attributes P,Q,R,S, assess: A PQ→R and P→R imply Q→R; B PQ→R implies P→R or Q→R; C P→R and Q→S imply PQ→RS; D P→R implies PQ→R.

Approach

Prove valid implications with agreement of tuples or Armstrong’s axioms, and refute invalid ones with small relations.

Step-by-step solution

1. To prove D, take two tuples agreeing on both P and Q. They agree on P, so P→R forces agreement on R. Adding an attribute to the determinant cannot invalidate a dependency. Thus D is true.
2. To prove C, two tuples agreeing on PQ agree on P and therefore R; they also agree on Q and therefore S. Hence they agree on RS, establishing PQ→RS. This is augmentation followed by union.
3. A is false. Consider the rows (P,Q,R,S)=(0,0,0,0) and (1,0,1,0). P uniquely determines R, and PQ also determines R. However the same Q=0 occurs with both R=0 and R=1, so Q→R fails. There is no “cancellation” rule for determinant attributes.
4. B is false. Use four rows with S fixed at 0 and R=P XOR Q:

    P Q R S
    0 0 0 0
    0 1 1 0
    1 0 1 0
    1 1 0 0

Every PQ pair has one R, so PQ→R holds. Holding only P fixed allows two R values, and holding only Q fixed does likewise. Neither individual dependency holds.
5. Therefore only C and D are always true. One relation satisfying the premises and violating the conclusion is sufficient to disprove each proposed universal inference.

Original paper, page 22 · Answer key

1 mark · MSQ
Report issue

Dependency preservation across normal forms

Normalization & Decomposition

Question 31, GATE 2026: Choose the true normalization claims: A dependency-preserving 3NF decomposition is always possible; B dependency-preserving 1NF decomposition is always possible; C dependency-preserving BCNF decomposition is not always possible; D dependency-preserving 2NF decomposition is not always possible.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B, C

Givens and goal

Choose the true normalization claims: A dependency-preserving 3NF decomposition is always possible; B dependency-preserving 1NF decomposition is always possible; C dependency-preserving BCNF decomposition is not always possible; D dependency-preserving 2NF decomposition is not always possible.

Approach

Use the constructive 3NF existence result for weaker forms, and a specific dependency set to demonstrate the BCNF limitation.

Step-by-step solution

1. The 3NF synthesis construction can always produce a dependency-preserving 3NF decomposition for a relation and its functional dependencies. It starts from a minimal cover, groups appropriate determinants with their dependents, and includes a candidate-key relation if needed for losslessness. Thus A is true.
2. Since a relation in 3NF also satisfies 2NF and 1NF, the same dependency-preserving decomposition supplies existence witnesses for both lower normal forms. Hence B is true and the assertion of possible failure at 2NF in D is false.
3. BCNF does not always permit dependency preservation. For an explicit witness, consider R(A,B,C) with AB → C and C → B. Its candidate keys are AB and AC. The dependency C → B violates BCNF because C does not determine A.
4. Any BCNF decomposition must use proper subrelations rather than retaining all of ABC. Among proper subrelations, the only essential nontrivial projected dependency is C → B on BC; the projections on AB and AC contain no nontrivial dependencies. Thus the union of all available proper projections cannot imply AB → C: under that union, the closure of AB never acquires C. No collection of those BCNF components can preserve the original dependencies. This proves C.

Common error: A lossless BCNF decomposition does not automatically preserve every dependency. Losslessness and dependency preservation are separate requirements.

In the BCNF witness, AB is a key by AB→C, and AC is a key because C→B. Neither A alone nor B alone nor C alone determines all three attributes. A lossless split into BC and AC can preserve C→B, but the dependency AB→C cannot then be checked from the projected dependencies without reconstructing the join. This illustrates the difference between lossless data reconstruction and local enforcement of dependencies.

Original paper, page 23 · Answer key

1 mark · NAT
Report issue

Continuity with an unbounded logarithm

Calculus

Question 32, GATE 2026: For x>0, f(x)=c₁e^x−c₂ln(1/x); for x≤0, f(x)=3. The constants are real. Continuity at zero is required. Find c₁+c₂ as an integer.
Tap to enlarge
Answer & solution

Official answer: 3

Givens and goal

For x>0, f(x)=c₁ex−c₂ln(1/x); for x≤0, f(x)=3. The constants are real. Continuity at zero is required. Find c₁+c₂ as an integer.

Approach

Compare the right-hand limit with f(0), first eliminating any divergent contribution.

Step-by-step solution

1. Since f(0)=3 and f is constant 3 on the negative half-line, the value and left-hand limit already agree. Only the limit as x→0+ needs to be imposed.
2. Use ln(1/x)=−ln x to rewrite the positive branch as c₁ex+c₂ln x. As x→0+, ex→1 while ln x→−∞.
3. If c₂>0, the logarithmic term tends to −∞; if c₂<0, it tends to +∞. The exponential term has finite limit c₁ and cannot cancel either divergence. A finite right-hand limit therefore requires c₂=0.
4. With c₂=0, the right-hand limit is c₁. Continuity requires c₁=3, so c₁+c₂=3.
5. Checking the resulting function confirms it: its right branch is 3ex and tends to 3 at zero. There is no need for the derivatives on the two sides to agree because the question asks only for continuity.

Original paper, page 23 · Answer key

1 mark · NAT
Report issue

Maximum height of a full binary tree

Tree Properties & Traversals

Question 33, GATE 2026: A full binary tree has 23 nodes. Height is the number of edges on its longest root-to-leaf path. Find the largest possible height.
Tap to enlarge
Answer & solution

Official answer: 11

Givens and goal

A full binary tree has 23 nodes. Height is the number of edges on its longest root-to-leaf path. Find the largest possible height.

Approach

Count internal nodes using the full-tree property, then arrange them along one deepest branch.

Step-by-step solution

1. “Full” means every node has either zero children or exactly two children; it does not mean balanced or complete. Let I be the number of internal nodes and L the number of leaves.
2. Every internal node contributes two child edges, so the total edge count is 2I. Any tree with I+L nodes has I+L−1 edges. Equating these gives L=I+1 and total nodes 2I+1.
3. With 23=2I+1, there are I=11 internal nodes and L=12 leaves.
4. A root-to-leaf path of h edges has h nonleaf nodes before the final leaf. All h are internal, so h≤I=11.
5. This bound is achievable by a comb: each of the first ten internal nodes has one leaf child and one internal child continuing the path; the eleventh has two leaf children. There are 11 internal nodes, 12 leaves and a deepest path of 11 edges. Therefore the maximum height is 11, not the roughly logarithmic height of a balanced tree.

Original paper, page 23 · Answer key

1 mark · NAT
Report issue

C block scope and shadowing

Scope, Lifetime & Storage Classes

Question 34, GATE 2026: Function func(i,j) is called with i=9,j=10. If i<j, an inner block declares a new int i=0 and loops while that inner i<10, adding 2 to j and incrementing the inner i. After the block, printf("%d",i) executes. Determine the printed integer.
Tap to enlarge
Answer & solution

Official answer: 9

Step through it (42 steps)

Givens and goal

Function func(i,j) is called with i=9,j=10. If i<j, an inner block declares a new int i=0 and loops while that inner i<10, adding 2 to j and incrementing the inner i. After the block, printf("%d",i) executes. Determine the printed integer.

Approach

Track each distinct variable object and which declaration each occurrence of i refers to.

Step-by-step solution

1. The function receives its own parameter i with value 9 and parameter j with value 10. The initial comparison succeeds.
2. Inside the conditional block, a new local i is declared. It shadows the parameter i only within that block. The loop increments this inner variable from 0 to 10; it does not alter the parameter i.
3. The loop also increases the function-local j, which has no effect on the printed expression. When execution leaves the block, the inner i goes out of scope.
4. The print statement is outside the block. Its identifier i therefore refers to the parameter, still equal to 9. The output is 9, with no newline implied by the shown format string.

Common error: Shadowing creates a different object; it is not assignment to the outer object.

Scope trace

    Point                         Parameter i   Inner i   Parameter j
    Function entry                    9          absent        10
    Inner declaration                 9             0          10
    After ten loop iterations         9            10          30
    At printf                         9          absent        30

The table makes clear that reaching inner i=10 does not imply that printf prints 10. The condition uses the parameter before the inner declaration is reached, whereas the loop uses the inner object.

Original paper, page 24 · Answer key

1 mark · NAT
Report issue

Resources needed to rule out deadlock

Deadlocks

Question 35, GATE 2026: Five processes share k identical resource instances. Each process needs at most two, requests or releases only one at a time, and can request its second only after receiving its first. Find the smallest k guaranteeing freedom from resource deadlock.
Tap to enlarge
Answer & solution

Official answer: 6

Givens and goal

Five processes share k identical resource instances. Each process needs at most two, requests or releases only one at a time, and can request its second only after receiving its first. Find the smallest k guaranteeing freedom from resource deadlock.

Approach

Show an unsafe allocation for too few resources and prove that one additional resource always lets some process finish.

Step-by-step solution

1. With k=5, allocate one instance to each process. If all five then request a second, all five available instances are held and every process is waiting. No process can reach its maximum claim and finish: this is a possible deadlock.
2. Smaller positive capacities also fail to give a universal guarantee: the available instances can each be held by a different process waiting for its second, while the others wait for their first. Thus merely showing failure at five is consistent with the lower-capacity cases.
3. Now let k=6. If some process holds two instances, it has its complete maximum resource requirement and can finish without waiting for another instance, then release what it holds.
4. Otherwise each of the at most five processes holds at most one instance, so at most five are allocated. At least one of the six remains free. It can be granted as a second instance to a waiting holder, enabling that process to finish and release two.
5. Repeating the reasoning gives a safe sequence of completions, so a resource deadlock cannot arise. The smallest required capacity is 6.

This is the standard resource-deadlock model, assuming a process eventually completes when its maximum resource need is satisfied. It does not guarantee fair scheduling or rule out starvation caused by a scheduler.

Original paper, page 24 · Answer key

2 marks · MCQ
Report issue

Adding two IEEE 754 binary32 values

Data Representation & Arithmetic

Question 36, GATE 2026: X and Y are IEEE 754 single-precision values with hexadecimal bit patterns 35C00000 and 34A00000. Find the bit pattern for Z=X+Y among A 35C80000, B 35CC0000, C 35E80000, D 35EC0000.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (9 steps)

Givens and goal

X and Y are IEEE 754 single-precision values with hexadecimal bit patterns 35C00000 and 34A00000. Find the bit pattern for Z=X+Y among A 35C80000, B 35CC0000, C 35E80000, D 35EC0000.

Approach

Decode sign, biased exponent and fraction; align exponents, add significands, and re-encode the exact sum.

Step-by-step solution

1. Both operands are positive normal IEEE 754 binary32 numbers. The exponent field of 35C00000 is 107, so its unbiased exponent is −20. Its fraction field is 400000, giving significand 1.5. Thus X = 1.5 × 2−20.
2. For 34A00000 the exponent field is 105, giving unbiased exponent −22; fraction 200000 gives significand 1.25. Thus Y = 1.25 × 2−22 = 0.3125 × 2−20.
3. Their sum is 1.8125 × 2−20. Since 1 ≤ 1.8125 < 2, no exponent renormalization is required. The fraction is 0.8125 = 13/16, which has an exact terminating binary expansion.
4. The exponent bits remain 107, contributing 35800000. The stored fraction is (13/16) × 223 = 680000 in hexadecimal. Combining the fields yields 35E80000. No rounding error occurs here.

Computational check: Python struct unpacked both binary32 operands and repacked their sum, obtaining 0x35e80000. This complements the exact field-level derivation; it is not the sole justification.

Binary significand check: X=1.1₂×2−20 and Y=1.01₂×2−22=0.0101₂×2−20. Their sum is 1.1101₂×2−20. Dropping the implicit leading 1 leaves fraction bits 1101 followed by nineteen zeros, exactly the hexadecimal fraction 680000. Since all significant bits fit within binary32 precision, the rounding mode does not alter the answer here.

Original paper, page 25 · Answer key

2 marks · MCQ
Report issue

Deriving saturating-counter D inputs

Counters & Timing

Question 37, GATE 2026: A synchronous 2-bit counter uses D flip-flops. With P=0 it increments, saturating at 11; with P=1 it decrements, saturating at 00. Find formulas for D₁,D₀ from the displayed next-state table. For current states 00,01,10,11, the next states are 01,10,11,11 when P=0 and 00,00,01,10 when P=1.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Givens and goal

A synchronous 2-bit counter uses D flip-flops. With P=0 it increments, saturating at 11; with P=1 it decrements, saturating at 00. Find formulas for D₁,D₀ from the displayed next-state table. For current states 00,01,10,11, the next states are 01,10,11,11 when P=0 and 00,00,01,10 when P=1.

Approach

Use D=next-state for each flip-flop, enumerate the minterms, and combine adjacent rows that differ in one Boolean variable.

Step-by-step solution

1. A D flip-flop takes its next state from its D input. Thus D1 and D0 must equal the corresponding next-state bits in all eight input/current-state rows.
2. Use variable order (P,Q1,Q0). The rows where D1=1 have binary indices 1,2,3,7. Adjacent pairs (1,3), (2,3) and (3,7) yield the implicants (NOT P)Q0, (NOT P)Q1 and Q1Q0. Therefore D1=(NOT P)Q1 OR (NOT P)Q0 OR Q1Q0.
3. The rows where D0=1 have indices 0,2,3,6. Adjacent pairs (0,2), (2,3) and (2,6) yield (NOT P)(NOT Q0), (NOT P)Q1 and Q1(NOT Q0). Therefore D0=(NOT P)(NOT Q0) OR (NOT P)Q1 OR Q1(NOT Q0).
4. These two expressions are the pair in B. Each of the other offered pairs fails at least one row: A gives the wrong D0 at 000; C gives the wrong D1 at 000; D gives the wrong D1 at 100.

Computational check: Evaluated B on all eight assignments and compared the resulting two-bit value with min(3,current+1) for P=0 and max(0,current−1) for P=1. All eight matched.

Visual check: Inspected both the full next-state table and each complement bar in the four expression pairs.

Complete transition check, written as P: current→next:

    0: 00→01, 01→10, 10→11, 11→11
    1: 00→00, 01→00, 10→01, 11→10

The last increment case and first decrement case are saturation cases: they hold at the boundary rather than wrapping to 00 or 11. Ignoring those two rows would derive an ordinary modulo-4 counter instead of the required saturating one.

Original paper, page 26 · Answer key

2 marks · MCQ
Report issue

How associativity changes cache tag length

Cache Memory

Question 38, GATE 2026: A byte-addressed processor has a 2^32-byte physical address space. The cache holds 2^23 bytes in 128-byte blocks. Compare direct-mapped tag length M with K-way set-associative tag length N, where K=2^L and L∈{1,2,3}. Choices are N=M+L, M−L, M+K, M−K.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Givens and goal

A byte-addressed processor has a 232-byte physical address space. The cache holds 223 bytes in 128-byte blocks. Compare direct-mapped tag length M with K-way set-associative tag length N, where K=2L and L∈{1,2,3}. Choices are N=M+L, M−L, M+K, M−K.

Approach

Partition the same physical address into tag, set index, and block offset for the two organizations.

Step-by-step solution

1. Byte addresses contain 32 bits. A 128-byte block needs log2(128)=7 offset bits.
2. The cache contains 223 / 27 = 216 blocks. In a direct-mapped organization, there are 216 sets, requiring 16 index bits. Hence its tag length is M=32−16−7=9.
3. K=2L ways reduce the set count to 216−L. The set index therefore uses 16−L bits while the block offset remains 7 bits.
4. The set-associative tag length is N=32−(16−L)−7=9+L=M+L.

Common error: Associativity changes the number of sets, not the number of bytes per block. Offset bits do not grow with the number of ways.

Concrete check: for L=2, the cache is four-way. It has 214 sets, so its address fields are 11 tag bits, 14 set-index bits and 7 offset bits, totaling 32. Direct mapping used 9+16+7=32. The increase is log₂4=2 bits, not four bits; this distinguishes M+L from M+K. Subtracting L or K would move the tag in the wrong direction.

Original paper, page 27 · Answer key

2 marks · MCQ
Report issue

A terminating recursive list-size function

Recursion

Question 39, GATE 2026: For a nonempty singly linked list, getListSize(head) returns 1 if E1 is true and otherwise returns E2. Choose between base tests head==NULL or head->next==NULL, and recursive expressions 1+getListSize(head) or 1+getListSize(head->next).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Givens and goal

For a nonempty singly linked list, getListSize(head) returns 1 if E1 is true and otherwise returns E2. Choose between base tests head==NULL or head->next==NULL, and recursive expressions 1+getListSize(head) or 1+getListSize(head->next).

Approach

Match the base return value 1 to a one-node list and ensure recursion moves to a strictly shorter suffix.

Step-by-step solution

1. The input list is nonempty, so the current head points to a node. A one-node list is recognized by a null next pointer, and its length is 1.
2. If a next node exists, the tail beginning there is also nonempty. The total length is one for the current node plus the recursively computed tail length. This supplies the base condition and recursive expression in B.
3. Induction proves correctness: length 1 returns 1; assuming the routine counts a tail of length n−1, the recursive case returns 1+(n−1)=n.
4. Passing the unchanged head recursively never decreases the problem size and does not terminate on longer lists. Using head==NULL as the base test while returning 1 gives an extra count for the empty suffix. These defects eliminate the other choices.

Assumption: As usual for a finite singly linked list, the chain is acyclic. The question's recursion would not terminate on a cyclic structure.

Trace for three nodes A→B→C→NULL: the call at C detects next==NULL and returns 1; the call at B returns 1+1=2; the call at A returns 1+2=3. With a head==NULL base returning 1, even a one-node input would instead return 1+1=2. With an unchanged-head recursive call, any list longer than one node recurses forever rather than reaching the last node.

Original paper, page 28 · Answer key

2 marks · MCQ
Report issue

Third insertion into a complete BST

Binary Search & Balanced Trees

Question 40, GATE 2026: The keys 1 through 15 are inserted in some order into an ordinary binary search tree, producing a complete binary tree. Which key can never be the third insertion: A 4, B 2, C 10, D 5?
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Givens and goal

The keys 1 through 15 are inserted in some order into an ordinary binary search tree, producing a complete binary tree. Which key can never be the third insertion: A 4, B 2, C 10, D 5?

Approach

Determine the forced final balanced shape and use the rule that each ancestor must be inserted before its descendants.

Step-by-step solution

1. A complete binary tree with 15 nodes has all four levels full. For the ordered keys 1 through 15, the BST invariant therefore fixes root 8, its children 4 and 12, and their children 2, 6, 10 and 14. The leaves are 1, 3, 5, 7, 9, 11, 13 and 15.
2. Ordinary BST insertion without rotations requires every ancestor of a node to have been inserted earlier. Otherwise an earlier inserted descendant would occupy an ancestor position and could not later move below it.
3. The ancestors of 5 are 8, 4 and 6. All three must already exist before 5 is inserted, so 5 cannot be inserted third.
4. Each other offered value can occur third: prefixes (8,12,4), (8,4,2) and (8,12,10) place 4, 2 and 10 third respectively. Each prefix respects the fixed tree's ancestor order, so it can be extended by inserting the remaining keys in an ancestor-before-descendant order to produce the required complete tree.

Common error: A completed tree need not stay complete at every intermediate insertion. Only the final shape is constrained here.

Forced final levels

    depth 0:                8
    depth 1:           4         12
    depth 2:         2   6     10   14
    depth 3:        1 3 5 7   9 11 13 15

Because 15=1+2+4+8 exactly fills four levels, the final complete tree is perfect. Ordinary unbalanced insertion does not move an existing node later, so the ancestor-before-descendant restriction applies to this fixed final shape. Rotations or a self-balancing insertion algorithm are not part of the question.

Original paper, page 29 · Answer key

2 marks · MCQ
Report issue

Shortest paths with a bounded edge budget

Graph Algorithms

Question 41, GATE 2026: In an undirected integer-weighted graph, d_k(u) is the minimum weight of an s-to-u path with at most k edges, or infinity if none exists. S1 says d_(k+1)(u)≤d_k(u). S2 says that if edge (u,v) lies on a shortest s-to-v path, then d_k(u)≤d_k(v) for every k. Classify S1 and S2.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Givens and goal

In an undirected integer-weighted graph, dk(u) is the minimum weight of an s-to-u path with at most k edges, or infinity if none exists. S1 says dk+1(u)≤dk(u). S2 says that if edge (u,v) lies on a shortest s-to-v path, then dk(u)≤dk(v) for every k. Classify S1 and S2.

Approach

Compare nested feasible path sets for S1 and use an explicit small edge-budget counterexample for S2.

Step-by-step solution

1. Every path using at most k edges also uses at most k+1 edges. The feasible set for dk(u) is therefore contained in the feasible set for dk+1(u).
2. Minimizing over a larger set cannot increase the minimum. Hence dk+1(u)≤dk(u), including the situation where an unavailable path of value infinity becomes available. S1 is true without assuming positive weights.
3. For S2, consider four vertices s,a,u,v with edges s—a of weight 1, a—u of weight 1, u—v of weight 1, and s—v of weight 10. The shortest s-to-v path is s—a—u—v, of total weight 3, and it includes (u,v).
4. Impose budget k=1. There is no one-edge s-to-u path, so d₁(u)=∞. But the direct edge s—v is permitted, giving d₁(v)=10. The asserted inequality ∞≤10 is false.
5. Thus only S1 holds, option A. Being a prefix of an unrestricted shortest path does not imply being reachable under the same smaller edge budget. The counterexample uses strictly positive integer weights, so the failure does not depend on negative cycles or an ambiguity about repeated vertices.

Original paper, page 30 · Answer key

2 marks · MCQ
Report issue

Available expressions at a control-flow merge

Code Optimization & Data-Flow Analysis

Question 42, GATE 2026: The flow is Entry→B1→either B2 or B3→B4→B5→Exit. B1: a=b+i. B2: a=g*k; f=d−f; a=c*4. B3: t=g*k; b=c+m. B4: x=g*k; y=b+i. B5: z=c+m. All variables are integers. Find the redundant expression sets in B4 and B5.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Givens and goal

The flow is Entry→B1→either B2 or B3→B4→B5→Exit. B1: a=b+i. B2: a=g*k; f=d−f; a=c*4. B3: t=g*k; b=c+m. B4: x=g*k; y=b+i. B5: z=c+m. All variables are integers. Find the redundant expression sets in B4 and B5.

Approach

An expression is available only if it has already been computed on every incoming path and neither operand has been reassigned since.

Step-by-step solution

1. The control-flow shape is a diamond followed by a tail:

    B1 ──→ B2 ──┐
      └──→ B3 ──┴──→ B4 ──→ B5

At the B4 merge, availability uses the intersection of the incoming expression sets, not their union.
2. B1 computes b+i. Along B2 neither b nor i is assigned, so this expression remains available there. Along B3, however, b is overwritten by c+m. That kills the old b+i value. Hence b+i is not available on every path to B4 and y=b+i is not globally redundant.
3. Both B2 and B3 compute g*k, and neither subsequently changes g or k. Thus g*k is available along both incoming paths. Its evaluation in x=g*k is redundant. B2 later overwrites a, but that changes the destination holding a previous result, not the operands g and k; a transformation may preserve the value in a temporary.
4. B3 computes c+m, but B2 does not. B4 computes neither c+m nor anything proving its value was previously computed on the B2 path. Therefore z=c+m in B5 is not redundant on all paths.
5. The required sets are B4:{g*k}, B5:empty, option D. Option A wrongly keeps b+i; B wrongly treats a computation on only one branch as universally available; C also incorrectly keeps b+i.

In particular a=c*4 assigns a, not c; the target variable matters when deciding whether an expression is killed.

Original paper, page 31 · Answer key

2 marks · MCQ
Report issue

Translating existential joins into relational algebra

Relational Algebra & Calculus

Question 43, GATE 2026: Relations are R(P,Q) and S(X,Y). The query returns u whenever there exist v,w with (u,v) in R and (v,w) in S. Select the equivalent projection/join expression. The alternatives join P to X, Q to X, P to Y, or Q to Y, and all project P.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Givens and goal

Relations are R(P,Q) and S(X,Y). The query returns u whenever there exist v,w with (u,v) in R and (v,w) in S. Select the equivalent projection/join expression. The alternatives join P to X, Q to X, P to Y, or Q to Y, and all project P.

Approach

Map each quantified variable to its relation attribute, use the repeated variable as the join equality, and project the requested output coordinate.

Step-by-step solution

1. Membership (u,v)∈R means u=R.P and v=R.Q. Membership (v,w)∈S means v=S.X and w=S.Y.
2. The same variable v occurs in both tuples, so qualifying tuple pairs must satisfy R.Q=S.X. This is the equijoin condition; neither R.P nor S.Y is the repeated coordinate.
3. After joining, the query asks only for u. Since u is R.P, project attribute P from the join. Thus the expression is π_P(R ⋈_(R.Q=S.X) S).
4. Option B writes the operands in the reverse order, π_P(S ⋈_(S.X=R.Q) R), which is equivalent for this inner equijoin and projection. Therefore select B.
5. For example, R containing (a,7) and S containing (7,b) must produce a. The two 7 values are the ones that need to match. Joins equating P with X, P with Y, or Q with Y would impose a different condition. The existential variables v and w disappear from the output through projection; ordinary relational algebra uses set semantics here.

Original paper, page 32 · Answer key

2 marks · MCQ
Report issue

TCP slow start and an omitted initial window

Transport, Congestion Control & Traffic Shaping

Question 44, GATE 2026: A TCP connection has slow-start threshold 10000 segments, fixed RTT 1 ms, unlimited queued data, no losses, and segment numbering from 1. Find the interval when segment 2000 begins: A [9,10), B [10,11), C [11,12), D [12,13) ms. The initial congestion window and precise time origin are not explicitly stated.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Our answer: B under the implicit initial-window=1 convention; otherwise under-specified.

Givens and goal

A TCP connection has slow-start threshold 10000 segments, fixed RTT 1 ms, unlimited queued data, no losses, and segment numbering from 1. Find the interval when segment 2000 begins: A [9,10), B [10,11), C [11,12), D [12,13) ms. The initial congestion window and precise time origin are not explicitly stated.

Approach

Derive the official result under the usual one-segment, idealized-round convention, then identify which missing assumptions it uses.

Step-by-step solution

1. Assume the first segment starts at time 0, the initial congestion window is one segment, and each RTT doubles the allowed batch during slow start. The sending windows are 1,2,4,8,… .
2. Number rounds from r=0. Round r starts at r milliseconds and sends 2r segments. Through the end of round r the cumulative number is 1+2+…+2r=2r+1−1.
3. Through round 9 the cumulative count is 210−1=1023. Round 10 has window 1024 and covers segment numbers 1024 through 2047. Therefore segment 2000 belongs to the sending interval [10,11) ms, giving official option B.
4. The slow-start threshold does not change this calculation because the relevant window, 1024, is well below 10000.
5. The initial window is material. If it were ten segments, cumulative counts would be 10(2r+1−1). Through round 6 this is 1270; round 7 reaches 2550. The same segment would then begin in [7,8) under the same idealized batch convention.

CS-2026-S1-Q44-IW. Official B depends on initial window 1, the chosen post-establishment time origin, and the textbook round model. The stated parameters alone do not uniquely determine the interval. This is not a claim that a revised official key exists.

Original paper, page 33 · Answer key

2 marks · MCQ
Report issue

Window size for full link utilization

Data Link, Framing, Error Control & ARQ

Question 45, GATE 2026: A lossless sliding-window link sends 1000-bit frames at 100 kbps (100000 bits/s). One-way propagation is 100 ms; processing and ACK transmission times are zero. Find the smallest window W for 100% utilization among 10,21,20,11 frames.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (5 steps)

Givens and goal

A lossless sliding-window link sends 1000-bit frames at 100 kbps (100000 bits/s). One-way propagation is 100 ms; processing and ACK transmission times are zero. Find the smallest window W for 100% utilization among 10,21,20,11 frames.

Approach

Find when the first frame’s acknowledgement returns, then require the initial window to keep the transmitter busy until that instant.

Step-by-step solution

1. Frame transmission time is T_tx=1000/100000 s=0.01 s=10 ms. Propagation time is T_prop=100 ms in each direction.
2. Start frame 1 at time 0. Its last bit leaves the sender at 10 ms and reaches the receiver at 110 ms. With zero processing and ACK transmission time, its ACK is sent then and reaches the sender at 210 ms.
3. Sending W frames back-to-back occupies the sender for W·10 ms. If this duration is less than 210 ms, the sender exhausts its window before the first ACK returns and must sit idle.
4. Full utilization requires 10W≥210, giving W≥21. With W=21, the first ACK arrives exactly when frame 21 finishes, allowing frame 22 to start without a gap. Later acknowledgements then arrive at the same spacing as new frames are sent.
5. Therefore the minimum is 21 frames, option B. W=20 covers only the 200-ms propagation round trip and overlooks the first frame’s own 10-ms transmission. W=10 or 11 is also too small.

The equivalent formula is W≥1+2T_prop/T_tx=1+20=21. It assumes acknowledgements are issued after full frame reception as in the stated textbook link model.

Original paper, page 34 · Answer key

2 marks · MSQ
Report issue

A piecewise quadratic and its derivatives

Calculus

Question 46, GATE 2026: For real x, f(x)=(|x|/2−x)(x−|x|/2). Determine which are true: A f has a local maximum; B f has a local minimum; C f′ is continuous on R; D f′ is not differentiable everywhere on R.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C, D

Givens and goal

For real x, f(x)=(|x|/2−x)(x−|x|/2). Determine which are true: A f has a local maximum; B f has a local minimum; C f′ is continuous on R; D f′ is not differentiable everywhere on R.

Approach

Remove the absolute value separately on each side of zero, then inspect the function, its derivative, and the derivative’s one-sided slopes at zero.

Step-by-step solution

1. The two factors are negatives, so f(x)=−(x−|x|/2)2. If x≥0, |x|=x and f(x)=−x²/4. If x<0, |x|=−x and f(x)=−9x²/4.
2. Both branches are negative away from zero and f(0)=0. Thus zero is a strict local and global maximum, making A true. The negative branch is strictly increasing toward zero, and the positive branch strictly decreases away from zero. No point is a local minimum, so B is false.
3. For x<0, f′(x)=−9x/2; for x>0, f′(x)=−x/2. At zero compute the difference quotient: f(h)/h equals −9h/4 from the left and −h/4 from the right. Both tend to 0, so f′(0)=0.
4. The one-sided limits of f′ at zero are also 0, and each branch is continuous elsewhere. Therefore f′ is continuous over all R, proving C.
5. To differentiate f′ at zero, divide f′(h)−f′(0) by h. The left limit is −9/2 and the right limit is −1/2. These differ, so f′ is not differentiable at zero. D is true.
6. Select A, C and D. Continuity of a derivative does not imply that derivative is itself differentiable. Here f is continuously differentiable but not twice differentiable at the joining point.

Original paper, page 35 · Answer key

2 marks · MSQ
Report issue

Forcing a vertex into every minimum cover

Graph Theory

Question 47, GATE 2026: In a simple undirected graph, the minimum vertex-cover size is k and S is any minimum cover. Which condition always forces a given vertex v into S? A deg(v)≥k+1; B v lies on a path of length k+1; C v lies on a cycle of length k+1; D v belongs to a clique of size k.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A

Givens and goal

In a simple undirected graph, the minimum vertex-cover size is k and S is any minimum cover. Which condition always forces a given vertex v into S? A deg(v)≥k+1; B v lies on a path of length k+1; C v lies on a cycle of length k+1; D v belongs to a clique of size k.

Approach

Use the cost of excluding v to prove A; for each weaker structural condition construct a minimum cover that omits v.

Step-by-step solution

1. Suppose v is excluded from a vertex cover. Every edge incident to v must then be covered by its other endpoint, so all distinct neighbors of v must be included.
2. The graph is simple, so deg(v) counts those distinct neighbors. If deg(v)≥k+1, excluding v forces at least k+1 vertices into the cover, contradicting |S|=k. Hence A forces v into every minimum cover.
3. B fails on the path a—b—c—d. Its minimum cover size is k=2: the disjoint edges ab and cd require at least two vertices, and {b,c} is a cover of size two. Vertex a lies on a length-3 path, which is k+1, yet that minimum cover omits a.
4. C fails on a triangle. Here k=2 because one vertex cannot cover the opposite edge, while any two cover everything. Every vertex lies on the length-3=k+1 cycle but can be excluded by choosing the other two.
5. The same triangle refutes D: each vertex lies in a clique of size k=2 (any incident edge), but is still absent from some minimum cover.
6. Only A always suffices. Being part of a path, cycle, or clique can create a lower bound on the total cover size, but does not by itself specify which particular vertices every optimum must contain.

Original paper, page 35 · Answer key

2 marks · MSQ
Report issue

Minimum sum-of-products covers

Logic Minimization & Karnaugh Maps

Question 48, GATE 2026: For variable order (P,Q,R,S), F is 1 on minterms {1,2,3,4,5,7,10,12,13,14}. All options include (NOT P)S+Q(NOT R). Their remaining two terms are A: (NOT P)(NOT Q)R and (NOT Q)R(NOT S); B: (NOT P)(NOT Q)R and PR(NOT S); C: PQ(NOT S) and PR(NOT S); D: PQ(NOT S) and (NOT Q)R(NOT S). Find the minimal SOP options.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Step through it (18 steps)

Givens and goal

For variable order (P,Q,R,S), F is 1 on minterms {1,2,3,4,5,7,10,12,13,14}. All options include (NOT P)S+Q(NOT R). Their remaining two terms are A: (NOT P)(NOT Q)R and (NOT Q)R(NOT S); B: (NOT P)(NOT Q)R and PR(NOT S); C: PQ(NOT S) and PR(NOT S); D: PQ(NOT S) and (NOT Q)R(NOT S). Find the minimal SOP options.

Approach

List maximal valid implicants, identify essential terms, and check coverage of the residual minterms.

Step-by-step solution

1. There are exactly six prime implicants. In bit-pattern notation using variable order (P,Q,R,S), where a dash is a don't-care coordinate, they are:

   - 0--1: (NOT P)S, covering minterms 1,3,5,7.
   - -10-: Q(NOT R), covering 4,5,12,13.
   - 001-: (NOT P)(NOT Q)R, covering 2,3.
   - -010: (NOT Q)R(NOT S), covering 2,10.
   - 1-10: PR(NOT S), covering 10,14.
   - 11-0: PQ(NOT S), covering 12,14.

2. The first two prime implicants are essential: minterm 1 can only be covered by 0--1, and minterm 4 only by -10-. Together they leave 2,10,14 uncovered.
3. No single remaining prime implicant covers all three residual minterms. Therefore at least two further terms are required, for a minimum of four product terms overall. Each additional prime has three literals, so the minimum covers have ten literals in total.
4. Option B adds 001- and 1-10: these cover 2,3 and 10,14, completing the function. Option D adds 11-0 and -010: these cover 12,14 and 2,10, also completing it. Both achieve the four-term, ten-literal minimum.
5. Option A leaves minterm 14 uncovered. Option C leaves minterm 2 uncovered. Hence neither even represents the target function.

Completeness check: Exhaustively enumerated all 81 four-variable cubes, retained cubes containing no zero minterm, and extracted the six maximal cubes above. Enumerating prime-implicant covers found minimum size four. There is a third minimum cover using the two essential implicants plus -010 and 1-10; it is not one of the offered choices. The answer does not claim that B and D are the only possible minimal expressions.

Visual check: Confirmed the minterm list and all complement bars in options A–D directly from rendered page 36.

Residual coverage table after choosing the essential terms:

    Additional prime term          Covers residual minterms
    (NOT P)(NOT Q)R                         2
    (NOT Q)R(NOT S)                         2,10
    PR(NOT S)                              10,14
    PQ(NOT S)                              14

The table explains both validity and minimality: one extra term cannot cover all three residual minterms, while either option B’s pair or option D’s pair can. Expanding a non-prime term to a prime can only improve coverage without covering a zero, so restricting this minimum-cover analysis to prime implicants is sufficient.

Original paper, page 36 · Answer key

2 marks · MSQ
Report issue

Strict cut and cycle properties of MSTs

Graph Algorithms

Question 49, GATE 2026: A simple undirected edge-weighted graph has distinct edge weights. Assess: A each cycle’s largest edge belongs to no MST; B each cycle’s smallest edge belongs to every MST; C each vertex’s largest incident edge belongs to no MST; D each vertex’s smallest incident edge belongs to every MST.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, D

Givens and goal

A simple undirected edge-weighted graph has distinct edge weights. Assess: A each cycle’s largest edge belongs to no MST; B each cycle’s smallest edge belongs to every MST; C each vertex’s largest incident edge belongs to no MST; D each vertex’s smallest incident edge belongs to every MST.

Approach

Use exchange arguments for the valid cycle/cut statements and connected counterexamples for the invalid ones.

Step-by-step solution

1. For A, suppose an MST T contains the uniquely heaviest edge e of some cycle. Removing e splits T into two components. The rest of the cycle still connects e’s endpoints, so at least one other cycle edge f crosses that cut. Distinctness makes weight(f)<weight(e). Replacing e with f produces a lighter spanning tree, a contradiction. Thus A is true.
2. For D, take the cut {v} versus all other vertices. Let e be v’s unique lightest incident edge. If an MST omitted e, adding e creates a cycle. On that cycle another edge incident to v crosses the same cut and is heavier. Removing it would reduce the tree weight. Thus e must belong to every MST and D is true.
3. B is not a valid cycle rule. Consider edges ad=1, bd=2, ab=3, bc=4, ac=5. In the cycle a—b—c—a the smallest edge is ab=3. But Kruskal’s algorithm selects ad,bd,bc, forming an MST of weight 7 and excluding ab because a and b already have the cheaper connecting path a—d—b.
4. C fails even for a graph that is itself a tree. It has only one spanning tree, so every edge must be present, including a vertex’s heaviest incident edge. A two-vertex graph with one edge is the simplest witness.
5. Select A and D. Distinct weights make these strict exchange comparisons immediate. The ordinary MST question assumes connectivity; for a disconnected graph the corresponding statements apply componentwise to a minimum spanning forest, with no incident-edge claim needed for an isolated vertex.

Original paper, page 37 · Answer key

2 marks · MSQ
Report issue

DFS time intervals on a DAG

Graph Algorithms

Question 50, GATE 2026: DFS assigns each vertex discovery time d and finish time f. The directed input graph is acyclic. For an edge u→v, which time orders are impossible? A d[u]<d[v]<f[v]<f[u]; B d[v]<d[u]<f[u]<f[v]; C d[v]<f[v]<d[u]<f[u]; D d[u]<d[v]<f[u]<f[v].
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Givens and goal

DFS assigns each vertex discovery time d and finish time f. The directed input graph is acyclic. For an edge u→v, which time orders are impossible? A d[u]<d[v]<f[v]<f[u]; B d[v]<d[u]<f[u]<f[v]; C d[v]<f[v]<d[u]<f[u]; D d[u]<d[v]<f[u]<f[v].

Approach

Use the parenthesis theorem for recursive DFS intervals, then use acyclicity to exclude ancestor-directed back edges.

Step-by-step solution

1. A DFS call remains active while all recursive descendants are explored. Therefore two vertices’ discovery-to-finish intervals are either nested, for an ancestor and descendant, or disjoint. Partial overlap is impossible.
2. D has d[u]<d[v]<f[u]<f[v], a partial overlap. Once v is discovered while u’s call is active, v must finish before that call can finish. Thus D is impossible in every DFS, regardless of whether the graph is acyclic.
3. In B, v’s interval strictly contains u’s, so v is a DFS ancestor of u. The DFS-tree edges give a directed path v→…→u. Together with the given edge u→v, this creates a directed cycle, forbidden in a DAG. Hence B is also impossible.
4. A is possible: take the graph with only edge u→v and begin at u. The times can be d[u]=1,d[v]=2,f[v]=3,f[u]=4, a tree-edge interval.
5. C is possible if v is explored first and finishes before u is discovered. With the same single edge u→v, choose v as the first DFS root: times can be d[v]=1,f[v]=2,d[u]=3,f[u]=4. The later edge goes to an already finished vertex and creates no cycle.
6. Select B and D. The DAG restriction is needed for excluding B; the nesting rule alone already excludes D.

Original paper, page 38 · Answer key

2 marks · MSQ
Report issue

What a regular intersection does not imply

Closure Properties & Language Hierarchy

Question 51, GATE 2026: Languages L₁ and L₂ share a finite alphabet. Both L₂ and L₁∩L₂ are regular. Which conclusions always hold: A L₁ regular; B L₁∪L₂ regular; C complement of L₂ context-free; D L₁ context-free?
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C

Givens and goal

Languages L₁ and L₂ share a finite alphabet. Both L₂ and L₁∩L₂ are regular. Which conclusions always hold: A L₁ regular; B L₁∪L₂ regular; C complement of L₂ context-free; D L₁ context-free?

Approach

Use closure of regular languages under complement and their inclusion in context-free languages, then choose a regular L₂ that hides all complexity in L₁.

Step-by-step solution

1. Since L₂ is regular, its complement (relative to the shared alphabet’s full set of finite strings) is regular by closure under complement. Every regular language is context-free: for example, a finite automaton can be converted into a right-linear grammar, which is a context-free grammar. Therefore the complement of L₂ is context-free, so C must hold.
2. To test the other claims, let L₂=∅ and L₁={an bn cn:n≥0}. The alphabet {a,b,c} is finite as required.
3. The empty language is regular, and L₁∩L₂=∅ is also regular. Thus this choice satisfies both hypotheses no matter how complicated L₁ is.
4. The equal-three-block language L₁ is not context-free, hence is not regular either. The usual context-free pumping argument takes ap bp cp: a pumpable region of length at most p cannot span all three blocks, so pumping changes at most two counts or destroys the block order while at least one count remains p.
5. Therefore A and D fail. Also L₁∪L₂=L₁, so B fails for the same example.
6. Only C is guaranteed. Regularity of an intersection controls the part of L₁ inside L₂, not the potentially non-context-free part outside L₂.

Original paper, page 39 · Answer key

2 marks · MSQ
Report issue

Counting terminal-symbol invariants

Context-Free Grammars & Languages

Question 52, GATE 2026: The grammar is S→abaABA bba (spaces only separate symbols), A→aaBBA b | bB abaa, and B→aBb | ab. For a generated string s let n₁ count a’s and n₂ count b’s. Assess A: some n₁<n₂; B: always n₁≥n₂; C: some n₁>2n₂; D: always n₁≤2n₂.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Givens and goal

The grammar is S→abaABA bba (spaces only separate symbols), A→aaBBA b | bB abaa, and B→aBb | ab. For a generated string s let n₁ count a’s and n₂ count b’s. Assess A: some n₁<n₂; B: always n₁≥n₂; C: some n₁>2n₂; D: always n₁≤2n₂.

Approach

Track the pair of terminal counts through productions and prove invariant inequalities by induction rather than enumerate all words.

Step-by-step solution

Write a(w) and b(w) for the numbers of the two terminals in a generated word w.

1. Every expansion of B produces ak bk for some k≥1. Hence its two counts are equal.
2. For A's terminating alternative, a B expansion with k of each terminal gives counts a=k+3 and b=k+2. Thus b≤a≤2b.
3. Suppose a word derived from the recursive A child has counts x,y satisfying y≤x≤2y. The surrounding recursive production contributes two a terminals and one b terminal, plus two B words. If those B words together contribute K of each terminal, the new counts are x+K+2 and y+K+1. Their difference is (x−y)+1≥0. Also twice the new b count minus the new a count is (2y−x)+K≥0. Thus both inequalities are invariant under recursion.
4. The start production combines two A words, one B word and an outer string with three a terminals and three b terminals. Adding the counts preserves b≤a≤2b. Consequently every complete word satisfies the two bounds in B and D. The existential violations in A and C are impossible.

Common error: Counting only the explicitly written terminals of a production omits arbitrarily long balanced B expansions. The invariant accounts for them without enumerating strings.

Terminal-count bookkeeping

    Production component             Added a's   Added b's
    A→bB abaa, excluding B                 3           2
    A→aaBBA b, excluding B,B,A             2           1
    S→aba A B A bba, excluding A,B,A       3           3

For example, choosing B→ab and the terminating A alternative gives each A counts (4,3). The shortest choices in S therefore yield totals (3,3)+(4,3)+(1,1)+(4,3)=(12,10), consistent with both bounds. This example illustrates the invariant but the induction, not the example alone, proves it for arbitrarily deep recursion.

Original paper, page 40 · Answer key

2 marks · MSQ
Report issue

Two syntax-directed type declarations

Semantic Analysis & Type Checking

Question 53, GATE 2026: G1 has D→TV, T→int|float, V→V₁ id|id; G2 has D→D₁ id|T id, T→int|float. In SDD1, T.type is set by its keyword, D.type=T.type, V.type=T.type, V₁.type=V.type, and each id is entered with V.type. In SDD2, D.type comes from D₁.type or T.type and each id is entered with that child’s type. Decide A same language, B SDD2 S-attributed, C SDD1 L-attributed with only inherited attributes, D same symbol-table entries.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B, D

Givens and goal

G1 has D→TV, T→int|float, V→V₁ id|id; G2 has D→D₁ id|T id, T→int|float. In SDD1, T.type is set by its keyword, D.type=T.type, V.type=T.type, V₁.type=V.type, and each id is entered with V.type. In SDD2, D.type comes from D₁.type or T.type and each id is entered with that child’s type. Decide A same language, B SDD2 S-attributed, C SDD1 L-attributed with only inherited attributes, D same symbol-table entries.

Approach

Compare generated token sequences separately from how attribute values flow through each parse tree.

Step-by-step solution

1. Both grammars generate a type keyword, either int or float, followed by one or more identifier tokens. G1 builds an identifier list through V; G2 builds the same sequence by extending D. Therefore their languages are identical, establishing A.
2. In SDD2, T.type comes from a type keyword and D.type comes from a child T or D. Every attribute value flows upward from children to the left-hand-side symbol, or is a constant. All attributes are synthesized, so SDD2 is S-attributed and B is true.
3. SDD1 passes the type inherited by V down through the identifier list. But it also contains synthesized attributes, including T.type and D.type. Its inherited dependencies are L-attributed, yet the stronger wording that it contains only inherited attributes is false. Thus C is false.
4. In either definition, every identifier receives the same type supplied by the leading keyword. Thus the same identifier/type entries are recorded, establishing D. The ways in which the values flow through the parse tree differ; the resulting entries do not.

Common error: L-attributed does not mean exclusively inherited. An L-attributed definition can contain synthesized attributes as well.

Example: for the token sequence int id₁ id₂, SDD1 obtains int from T and passes it down through V to both identifiers. SDD2 first constructs the declaration for int id₁, synthesizes its type upward, and uses that type when extending the declaration with id₂. Both call put with (id₁,int) and (id₂,int). In SDD1, the existence of the inherited V.type does not erase the synthesized T.type and D.type; that is the exact overstatement in C.

Original paper, page 41 · Answer key

2 marks · MSQ
Report issue

TLB, page-table and physical-cache outcomes

Virtual Memory & Paging

Question 54, GATE 2026: A cache is physically addressed. An MMU has a TLB, and eviction of a page invalidates that page’s cache blocks. Which sequences cannot occur for a reference: A TLB miss/page-table hit/cache hit; B TLB hit/page-table miss/cache hit; C TLB miss/page-table miss/cache hit; D TLB miss/page-table miss/cache miss?
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

Givens and goal

A cache is physically addressed. An MMU has a TLB, and eviction of a page invalidates that page’s cache blocks. Which sequences cannot occur for a reference: A TLB miss/page-table hit/cache hit; B TLB hit/page-table miss/cache hit; C TLB miss/page-table miss/cache hit; D TLB miss/page-table miss/cache miss?

Approach

Distinguish a missing cached translation from a nonresident page, and apply the cache invalidation condition.

Step-by-step solution

1. Interpret a page-table miss here as a nonresident page (a page fault), not as a cache miss while fetching the page-table entry. The cache is physically addressed, so the ordinary sequence first resolves virtual-to-physical translation and then accesses the referenced cache block.
2. A TLB miss can occur even when the page is resident: the translation may simply not be cached in the TLB. After a successful page-table lookup the data block may still be present in the cache. Therefore A is possible.
3. In a correctly maintained translation system, a TLB hit supplies a valid resident-page translation, and a page-table walk is not needed for that reference. It cannot simultaneously be the page-table-fault sequence described in B. Thus B is impossible.
4. If the referenced page is absent from memory, the stated invalidation rule prevents its data blocks from remaining valid in the cache. Therefore the page-fault-plus-cache-hit sequence C is impossible. A TLB miss, page fault and absence of the data block from cache, as in D, is possible.

Interpretation note: These are hit/miss conditions for the original reference before fault recovery. Fault servicing can populate memory or cache and then retry the instruction; hits on that later retry are not the same event sequence. Correct TLB invalidation is implicit in a functioning virtual-memory system.

Possible-state examples help separate the two misses. A resident page whose translation has been displaced from the small TLB, but whose recently used data still sits in cache, gives A. A never-loaded virtual page gives a TLB miss and page fault; since it has no valid physical cached block, its initial data access is also a cache miss, matching D. “Page-table miss” is not being used to mean that the page-table entry itself missed in a processor cache.

Original paper, page 42 · Answer key

2 marks · MSQ
Report issue

Two-colorability and traversal cost

Graph Theory

Question 55, GATE 2026: An undirected simple graph is 2-colorable if adjacent vertices always receive different values in {0,1}. Assess A it may contain odd cycles; B it may contain even cycles; C the standard optimal adjacency-list test is Θ(|V|+|E|); D that bound is Θ(|E|log|V|).
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

Givens and goal

An undirected simple graph is 2-colorable if adjacent vertices always receive different values in {0,1}. Assess A it may contain odd cycles; B it may contain even cycles; C the standard optimal adjacency-list test is Θ(|V|+|E|); D that bound is Θ(|E|log|V|).

Approach

Alternate colors around a cycle and describe a full BFS/DFS coloring test across all components.

Step-by-step solution

1. Along a cycle, a proper two-colouring alternates colours on each successive edge. An odd number of alternations would require the starting vertex to have both colours. Odd cycles are therefore forbidden, making A false.
2. An even cycle can alternate colours consistently. A four-cycle is a direct example, so B is true.
3. Use BFS or DFS from every not-yet-coloured vertex, assign opposite colours across each explored edge, and reject if an edge has equally coloured endpoints. If no conflict occurs, the assignment is a valid two-colouring. Processing all components is essential for disconnected graphs.
4. With adjacency lists, each vertex is visited once and each undirected edge is examined at most twice. This is the standard worst-case Θ(|V|+|E|) traversal bound used by the question, yielding C. No sorting or priority queue is required; the claimed optimal logarithmic-factor bound in D is not the standard bound.

Complexity scope: The stated bound is the conventional full-graph adjacency-list algorithm bound. Particular inputs may be rejected earlier, for example when a conflict is found before traversal finishes.

Algorithm outline: for each uncolored vertex, assign color 0 and start a queue or stack. When traversing u—v, assign an uncolored v the opposite color to u; if v is already colored the same as u, reject. Accept only after every component has been processed. The algorithm need not enumerate cycles explicitly: an inconsistent edge supplies the contradiction automatically. Even-cycle example: vertices around a square can be colored 0,1,0,1 in order.

Original paper, page 43 · Answer key

2 marks · MSQ
Report issue

CIDR capacity and network alignment

IP Addressing, Fragmentation & Address Resolution

Question 56, GATE 2026: An ISP controls 202.16.0.0/15 and must allocate a single CIDR block able to hold 6000 addresses. Which proposed allocations are valid: A 202.16.0.0/19; B 202.17.64.0/19; C 202.16.32.0/19; D 202.17.24.0/19?
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B, C

Step through it (6 steps)

Givens and goal

An ISP controls 202.16.0.0/15 and must allocate a single CIDR block able to hold 6000 addresses. Which proposed allocations are valid: A 202.16.0.0/19; B 202.17.64.0/19; C 202.16.32.0/19; D 202.17.24.0/19?

Approach

Round the requested count up to a power of two, then check both containment in the parent network and alignment of the network address.

Step-by-step solution

1. A single CIDR allocation must have a power-of-two address count. Since 212=4096<6000≤8192=213, the smallest fitting block is /19, containing 8192 addresses.
2. A /19 boundary leaves thirteen host bits. Its mask is 255.255.224.0, so the fourth octet must be zero and the third octet must be a multiple of 32.
3. The ISP's /15 block spans second-octet values 16 and 17 with first octet 202. The candidates in A, B and C are all within that range and use aligned third octets 0, 64 and 32 respectively.
4. D uses third octet 24, which is not a multiple of 32. It is a host address inside the /19 network starting at third octet 0, not the canonical start of a distinct /19 allocation. Therefore exclude D.

Interpretation note: A request for 6000 addresses is rounded up to a CIDR block that can hold at least that many; a single /19 does not contain exactly 6000. The eligibility result is unchanged if a conventional subnet reserves two addresses, since 8190 remains sufficient.

Network-range check: A spans 202.16.0.0 through 202.16.31.255; C spans 202.16.32.0 through 202.16.63.255; B spans 202.17.64.0 through 202.17.95.255. All lie inside the parent range 202.16.0.0 through 202.17.255.255. For D, masking third octet 24 by 224 gives 0, demonstrating that 202.17.24.0/19 normalizes to 202.17.0.0/19 rather than naming an aligned block beginning at 24.

Original paper, page 43 · Answer key

2 marks · NAT
Report issue

All matchings in an eight-vertex path

Graph Theory

Question 57, GATE 2026: Let G be a path on eight vertices. Count all matchings, including the empty matching, as an integer.
Tap to enlarge
Answer & solution

Official answer: 34

Givens and goal

Let G be a path on eight vertices. Count all matchings, including the empty matching, as an integer.

Approach

Split matchings according to whether the first edge is selected, obtaining a Fibonacci recurrence.

Step-by-step solution

1. Let Mn count matchings of an n-vertex path, including the empty matching. If the first vertex is unmatched, the remaining choices are any matching of the last n−1 vertices, giving Mn−1.
2. If the first vertex is matched, it must use the edge to the second vertex. No other chosen edge may touch either of those vertices, leaving a path on n−2 vertices and Mn−2 choices.
3. These cases are disjoint and exhaustive, so Mn=Mn−1+Mn−2, with M0=M1=1. The values through n=8 are 1,1,2,3,5,8,13,21,34.
4. A separate count by matching size agrees: choosing k nonadjacent edges among the seven edges gives binomial(8−k,k). Summing for k=0,1,2,3,4 yields 1+7+15+10+1=34.

Common error: The empty set is a matching and contributes one. Omitting it gives an off-by-one result.

Recurrence table

    Number of vertices n:   0  1  2  3  4  5   6   7   8
    Number of matchings:    1  1  2  3  5  8  13  21  34

For the separate binomial count, label the seven edges 1,…,7. A matching of size k selects indices i₁<…<ik with ij+1≥ij+2. Compress the mandatory gaps by setting jr=ir−(r−1). This becomes an ordinary k-subset of {1,…,8−k}, explaining binomial(8−k,k), rather than merely quoting that count.

Original paper, page 44 · Answer key

2 marks · NAT
Report issue

Expectation with two probability groups

Probability & Statistics

Question 58, GATE 2026: X takes values 1,…,8. Values 1,2,5,7 each have probability 1/6; values 3,4,6,8 each have probability 1/12. Find E[X] rounded to two decimals.
Tap to enlarge
Answer & solution

Official answer: 4.24 to 4.26

Our answer: 4.25

Givens and goal

X takes values 1,…,8. Values 1,2,5,7 each have probability 1/6; values 3,4,6,8 each have probability 1/12. Find E[X] rounded to two decimals.

Approach

Check normalization and evaluate the probability-weighted sum, grouping equal-probability outcomes.

Step-by-step solution

1. There are four values in each probability group. Their total mass is 4(1/6)+4(1/12)=2/3+1/3=1, so the stated distribution is normalized.
2. By definition E[X]=Σ_x x·Pr(X=x). The first group contributes (1+2+5+7)/6=15/6=2.5.
3. The second group contributes (3+4+6+8)/12=21/12=1.75.
4. Summing gives E[X]=2.5+1.75=4.25. This is already exact to two decimal places.
5. The unweighted average of 1 through 8 is 4.5, but that would assume equal probabilities of 1/8. Here the lower-sum first group carries twice the probability per value, so 4.25 is consistent with the extra weight on that group.

Result: 4.25. The published accepted numerical interval is 4.24 to 4.26, which is broader than the exact computed central value.

Original paper, page 44 · Answer key

2 marks · NAT
Not in GATE 2027 syllabusReport issue

Expected disk seek, rotation and transfer time

Secondary Storage

Question 59, GATE 2026: A disk rotates at 15000 rpm, has 400 sectors per track and 1024 bytes per sector, and takes 1 ms per adjacent-track move. Starting at track 0, read ten randomly located sectors on each of tracks 5,12,7 in that order. Find the total time to one decimal place, under the published key’s expected-latency convention.
Tap to enlarge
Answer & solution

Official answer: 77.3

Givens and goal

A disk rotates at 15000 rpm, has 400 sectors per track and 1024 bytes per sector, and takes 1 ms per adjacent-track move. Starting at track 0, read ten randomly located sectors on each of tracks 5,12,7 in that order. Find the total time to one decimal place, under the published key’s expected-latency convention.

Approach

Calculate seek time, expected rotational waiting, and actual sector transfer time separately, then add them without double counting.

Step-by-step solution

1. Convert rotation speed to period. A minute is 60000 ms, so one revolution takes 60000/15000=4 ms.
2. The required track movements are |5−0|=5, |12−5|=7 and |7−12|=5. At 1 ms per adjacent move, total seek time is (5+7+5)·1=17 ms. There is no additional seek between sectors on the same track.
3. Under independent uniform rotational positions for successive accesses, average wait to the requested sector is half a revolution, 4/2=2 ms. There are 3·10=30 sector accesses, so the expected rotational wait is 30·2=60 ms.
4. One sector occupies 1/400 of a revolution and takes 4/400=0.01 ms to transfer. Thirty sectors take 0.30 ms. Equivalently, the transfer rate is (400·1024)/4=102400 bytes/ms and the total data is 30·1024=30720 bytes, giving the same 0.30 ms.
5. Add the components: 17+60+0.30=77.30 ms. Rounded to one decimal, the official result is 77.3 ms.

CS-2026-S1-Q59-EXPECTED. This is an expected time under the independent random-angle access model, not an exact elapsed duration fixed by unspecified sector locations. Reordering reads by rotational position or batching nearby sectors would require a different model. The source says “total time” without explicitly saying expected, so the published interval 77.3 to 77.3 is preserved with this qualification.

Original paper, page 44 · Answer key

2 marks · NAT
Report issue

Structural stalls from a multicycle EX stage

Pipelining & Hazards

Question 60, GATE 2026: A pipeline clock is 1 ns, with negligible latch overhead. The shared EX stage performs both arithmetic and LOAD memory reads. A 100-instruction sequence contains (EX time in ns, count): LOAD (1.8,15), IMUL (1.5,10), IDIV (2.5,5), FADD (1.7,10), FSUB (1.7,5), FMUL (2.8,15), FDIV (3.2,5), and other instructions (<1.0,35). Count EX structural-stall cycles.
Tap to enlarge
Answer & solution

Official answer: 95

Givens and goal

A pipeline clock is 1 ns, with negligible latch overhead. The shared EX stage performs both arithmetic and LOAD memory reads. A 100-instruction sequence contains (EX time in ns, count): LOAD (1.8,15), IMUL (1.5,10), IDIV (2.5,5), FADD (1.7,10), FSUB (1.7,5), FMUL (2.8,15), FDIV (3.2,5), and other instructions (<1.0,35). Count EX structural-stall cycles.

Approach

Round each EX occupancy up to whole clock cycles, subtract the one cycle already included in normal pipeline operation, and multiply by instruction counts.

Step-by-step solution

1. Clock boundaries occur every 1 ns. An operation taking t_EX ns occupies the exercise’s single EX resource for ceil(t_EX/1 ns) cycles. A normal instruction already has one EX cycle, so additional blocked cycles per instruction are ceil(t_EX)−1.
2. The instruction-by-instruction contributions are:

    Type    Time   Occupied cycles   Extra cycles   Count   Stalls
    LOAD    1.8          2                1           15      15
    IMUL    1.5          2                1           10      10
    IDIV    2.5          3                2            5      10
    FADD    1.7          2                1           10      10
    FSUB    1.7          2                1            5       5
    FMUL    2.8          3                2           15      30
    FDIV    3.2          4                3            5      15
    Other   <1.0         1                0           35       0

3. Sum the final column: 15+10+10+10+5+30+15=95 stalled cycles.
4. This is a stall count, not total program execution time. Do not add the 100 baseline instruction slots or pipeline fill/drain cycles, which are not requested.

The calculation uses the stated exercise’s shared, non-overlapped EX-stage occupancy model: while a multicycle operation holds EX, a subsequent instruction cannot enter it. A separately pipelined or replicated functional unit could have a different initiation interval; its behavior cannot be inferred solely from these operation latencies.

Original paper, page 44 · Answer key

2 marks · NAT
Report issue

Thresholds of nested integer logarithms

Recursion

Question 61, GATE 2026: The recursive functions are bar(1)=0 and bar(n)=1+bar(n/2) otherwise, using C integer division; foo(1)=1 and foo(n)=1+foo(bar(n)) otherwise. Find the smallest positive integer n for which foo(n)=5.
Tap to enlarge
Answer & solution

Official answer: 65536

Step through it (2 calls)

Givens and goal

The recursive functions are bar(1)=0 and bar(n)=1+bar(n/2) otherwise, using C integer division; foo(1)=1 and foo(n)=1+foo(bar(n)) otherwise. Find the smallest positive integer n for which foo(n)=5.

Approach

First identify bar as a floor logarithm, then work backwards through the thresholds for successive foo return values.

Step-by-step solution

1. For positive n, integer division by 2 repeatedly halves n with truncation. If 2^m≤n<2^(m+1), exactly m divisions are needed to reach 1. Hence bar(n)=floor(log₂n).
2. Therefore foo(n)=1+foo(floor(log₂n)) for n>1, with foo(1)=1. A foo call counts one level and continues with its much smaller floor-logarithm argument.
3. Let a_j be the smallest input with return value j. The base is a₁=1. To obtain one extra level, floor(log₂n) must reach at least the smallest input a_j needed for the previous level. The least n with floor(log₂n)=a_j is n=2^(a_j).
4. Thus the successive thresholds are a₁=1, a₂=2, a₃=4, a₄=16, a₅=2^16=65536. Monotonicity of floor(log₂n) and of these level thresholds shows no smaller input can skip ahead to five levels.
5. Verify directly: bar(65536)=16, bar(16)=4, bar(4)=2, bar(2)=1. The foo chain is 65536→16→4→2→1, giving return values 5→4→3→2→1 when read from the outer call inward.
6. The requested integer is 65536. The division is integer division; treating bar as an unrounded real logarithm would not model the code.

Original paper, page 45 · Answer key

2 marks · NAT
Report issue

Reconstructing a BST from preorder

Binary Search & Balanced Trees

Question 62, GATE 2026: A binary search tree has preorder sequence 50,25,13,40,30,47,75,60,70,80,77. Find the 1-based position of 60 in its postorder traversal.
Tap to enlarge
Answer & solution

Official answer: 7

Step through it (25 steps)

Givens and goal

A binary search tree has preorder sequence 50,25,13,40,30,47,75,60,70,80,77. Find the 1-based position of 60 in its postorder traversal.

Approach

Recursively split the preorder at each root according to BST value bounds, then traverse left, right, root.

Step-by-step solution

1. The first preorder entry is root 50. The following values below 50 form its left subtree: 25,13,40,30,47. The rest form its right subtree: 75,60,70,80,77.
2. In the left subtree, 25 has left child 13 and right subtree rooted at 40, whose children are 30 and 47. Its postorder is therefore 13,30,47,40,25.
3. In the right subtree, root 75 has a left subtree rooted at 60, containing 70 as 60’s right child. Its right subtree is rooted at 80, with left child 77. Thus that subtree’s postorder is 70,60,77,80,75.
4. The reconstructed tree is:

              50
          /        \
        25          75
       /  \        /  \
     13   40      60   80
         /  \      \  /
        30  47     70 77

5. Concatenate left-subtree postorder, right-subtree postorder and root: 13,30,47,40,25,70,60,77,80,75,50. The first five positions belong to the left subtree, position 6 is 70 and position 7 is 60.
6. Therefore the answer is 7. Preorder visits root first, while postorder visits root last; simply looking up 60’s original preorder position would answer the wrong traversal question.

Original paper, page 45 · Answer key

2 marks · NAT
Report issue

A fork loop with one continuing child

Processes, Threads & System Calls

Question 63, GATE 2026: In main, for i=0; i<3; i++, the program calls fork(). The child (fork()==0) executes continue; the parent executes break. After the loop each process executes printf("Hello!"). All forks succeed. Count executions of printf.
Tap to enlarge
Answer & solution

Official answer: 4

Step through it (9 steps)

Givens and goal

In main, for i=0; i<3; i++, the program calls fork(). The child (fork()==0) executes continue; the parent executes break. After the loop each process executes printf("Hello!"). All forks succeed. Count executions of printf.

Approach

Trace which process continues the loop after each fork rather than assuming every process performs all three iterations.

Step-by-step solution

1. Begin with process P0 at i=0. It forks child P1. P0 receives a nonzero return value, skips the child branch, executes break, and prints once.
2. P1 receives zero and executes continue. In a for loop, continue proceeds to the increment i++, then tests the condition. Thus P1 reaches i=1 and forks P2. P1 then breaks and prints once; P2 continues.
3. P2 reaches i=2 and forks P3. P2 breaks and prints once. P3 continues to the increment, giving i=3, where i<3 is false. P3 exits the loop normally and prints once.
4. The process structure is a chain P0→P1→P2→P3, with exactly three successful forks and four processes. Every one reaches the single printf once, so the answer is 4.
5. The execution order of the four prints is scheduling-dependent, but the count is not. The usual 2^3=8 doubling applies only when both parent and child continue forking on later iterations; here each parent immediately leaves the loop. There is also no pre-fork buffered print in the snippet whose output could be duplicated.

Original paper, page 46 · Answer key

2 marks · NAT
Report issue

FCFS waiting times in arrival order

CPU Scheduling

Question 64, GATE 2026: Actuator processes A require 6 CPU seconds and arrive at times 10,20,30,40,50. Controller processes C require 8 seconds and arrive at 11,22,33,44,55. FCFS scheduling is nonpreemptive and the first A starts at 10. Find the average waiting time of all ten processes to one decimal place.
Tap to enlarge
Answer & solution

Official answer: 9.5

Step through it (19 steps)

Givens and goal

Actuator processes A require 6 CPU seconds and arrive at times 10,20,30,40,50. Controller processes C require 8 seconds and arrive at 11,22,33,44,55. FCFS scheduling is nonpreemptive and the first A starts at 10. Find the average waiting time of all ten processes to one decimal place.

Approach

Merge arrivals chronologically and use start=max(arrival, previous finish), wait=start−arrival for each row.

Step-by-step solution

1. The chronological order is A1,C1,A2,C2,A3,C3,A4,C4,A5,C5. FCFS serves them in exactly this order, without preempting a current process when a new one arrives.
2. Compute starts and finishes sequentially. For A1, start=10, finish=16 and wait=0. C1 arrived at 11 but must wait until 16, so its wait is 5 and finish is 24. Continue the same recurrence:

    Process   Arrival   Burst   Start   Finish   Wait
    A1           10       6       10      16       0
    C1           11       8       16      24       5
    A2           20       6       24      30       4
    C2           22       8       30      38       8
    A3           30       6       38      44       8
    C3           33       8       44      52      11
    A4           40       6       52      58      12
    C4           44       8       58      66      14
    A5           50       6       66      72      16
    C5           55       8       72      80      17

3. Total waiting time is 0+5+4+8+8+11+12+14+16+17=95 seconds. Divide by ten processes to get 95/10=9.5 seconds.
4. Waiting time excludes the process’s own CPU burst. Using finish−arrival would give turnaround time instead. There is no idle gap after the first process starts: at each completion, the next process in the table has already arrived.

Original paper, page 46 · Answer key

2 marks · NAT
Report issue

Counting superkeys by inclusion-exclusion

Functional Dependencies & Keys

Question 65, GATE 2026: R has four attributes A,B,C,D. Its only candidate keys are {A,B} and {A,C}. Count all superkeys.
Tap to enlarge
Answer & solution

Official answer: 6

Givens and goal

R has four attributes A,B,C,D. Its only candidate keys are {A,B} and {A,C}. Count all superkeys.

Approach

Every superset of a candidate key is a superkey; count both superset families and subtract their overlap.

Step-by-step solution

1. A candidate key is a minimal superkey. Adding attributes preserves the ability to identify a tuple, so every set containing AB or AC is a superkey.
2. For AB, the remaining attributes C and D may each be included or omitted independently, giving 2²=4 supersets: AB,ABC,ABD,ABCD.
3. For AC, optional attributes B and D similarly give AC,ABC,ACD,ABCD, again four.
4. A set counted in both families must contain AB∪AC=ABC. Its only optional attribute is D, so the overlap is {ABC,ABCD}, of size 2.
5. Inclusion-exclusion gives 4+4−2=6. The six distinct superkeys are AB,AC,ABC,ABD,ACD,ABCD.
6. There are no others: from any superkey one can repeatedly remove unnecessary attributes until a minimal superkey, hence a candidate key, remains. The premise says the only such minima are AB and AC, so every superkey must contain at least one of them. D need not belong to a candidate key to occur in larger superkeys.

Original paper, page 46 · Answer key