GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 2024 · Set 2

65 questions

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

03:00:00
1 mark · MCQ
Report issue

An increasing-intensity word analogy

Vocabulary & Verbal Analogies

Question 1, GATE 2024: An arrow denotes increasing intensity: walk → jog → sprint. Complete bothered → ___ → daunted. A phased; B phrased; C fazed; D fused.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Approach: Match the meaning and direction of the analogy, not merely the pronunciation of the alternatives.

1. Derivation. Fazed means disturbed or disconcerted, fitting the intended increasing progression bothered, fazed, daunted. Phased concerns stages, phrased concerns wording, and fused concerns joining, so C.

2. Explanation and checks. “Bothered” indicates annoyance or concern; “fazed” describes being disconcerted; “daunted” indicates being intimidated or discouraged by difficulty. The intended middle word must remain on that emotional scale. “Phased” and “fazed” sound alike, but only the latter has the required meaning. This is a contextual vocabulary judgment, not a claim that these emotions admit an exact numerical ordering.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Order four distinct spell ingredients

Counting, Probability & Sets

Question 2, GATE 2024: Two wizards independently test every possible order of mixing water, air, fire and earth, using each element exactly once per attempt. How many attempts does EACH wizard make? A 24; B 48; C 16; D 12.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Use permutations because changing the order produces a different attempt.

1. Derivation. Each wizard independently tries every ordering of four distinct elements. There are 4!=4×3×2×1=24 such permutations. The question asks per wizard, so do not double the count. Answer A.

2. Explanation and checks. There are four choices for the first ingredient. Once chosen, only three remain for the second, then two for the third, and one for the fourth. Multiplication counts all complete sequences exactly once. The two wizards do not divide the work: each independently covers the same 24 orders. The value 48 would be their combined number of attempts, which is a different quantity.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Recover an overlapping student count

Counting, Probability & Sets

Question 3, GATE 2024: Of 10000 students, 1500 like neither their core branch nor other branches; 500 like both. The number liking their core branch is one quarter of the number liking other branches. Find the core-branch count. A 1800; B 3500; C 1600; D 1500.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Draw two overlapping sets and apply inclusion-exclusion before using the ratio.

1. Derivation. Let c like their core branch and o like other branches. Their union has 10000−1500=8500 students. Inclusion-exclusion gives c+o−500=8500, so c+o=9000. With o=4c, this gives 5c=9000 and c=1800, option A.

2. Explanation and checks. The 500 students in the intersection belong to both counts, so adding the two set sizes counts them twice. This is why the union subtracts 500 rather than adding it. As a check, the solution gives 7200 liking other branches, 1300 liking only their core branch, and 6700 liking only other branches. The four disjoint groups total 1300+6700+500+1500=10000.

Original paper, page 2 · Answer key

1 mark · MCQ
Report issue

Equality of arithmetic and geometric means

Algebra, Equations & Number Patterns

Question 4, GATE 2024: Positive real x,y satisfy ln((x+y)/2)=(ln x+ln y)/2. Find x/y+y/x. A 1; B 1/2; C 2; D 4.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Approach: Combine the logarithms and use the injectivity of the exponential function.

1. Derivation. Exponentiating yields(x+y)/2=√(xy), equality in the arithmetic-geometric mean inequality. Equivalently(x−y)²=0, so x=y>0. Hence x/y+y/x=1+1=2, option C.

2. Explanation and checks. In detail, (ln x+ln y)/2=ln(sqrt(xy)), so the two positive arguments must agree. Squaring x+y=2sqrt(xy) gives x²+2xy+y²=4xy, hence (x−y)²=0. Positivity licenses the logarithms, square root and later divisions. The equality condition matters: without the given equation, x/y+y/x is merely at least 2, not necessarily equal to 2. Another useful check is x/y+y/x−2=(x−y)²/(xy). The numerator vanishes for the forced equality x=y, so the excess above two is exactly zero.

Original paper, page 2 · Answer key

1 mark · MCQ
Report issue

Successive odd differences

Algebra, Equations & Number Patterns

Question 5, GATE 2024: A sequence begins 6, 9, 14, x, 30, 41. Which is a possible x? A 25; B 21; C 18; D 20.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Inspect consecutive differences rather than looking for a constant ratio.

1. Derivation. The simple pattern of successive odd increments is+3,+5,+7,+9,+11. It produces 6, 9, 14, 21, 30, 41, so 21 is a possible missing value, option B. Finite sequences do not mathematically determine a unique continuation without a rule; the question appropriately asks for a possible value.

2. Explanation and checks. The known first differences are 3 and 5, and the final difference is 11. Completing them as consecutive odd numbers gives 3,5,7,9,11; checking both gaps around x verifies 21−14=7 and 30−21=9. Equivalently the terms follow n²+5 for n=1 through 6. This supplies a consistent simple rule; it does not prove that an arbitrary finite sequence has only one possible generating rule.

Original paper, page 3 · Answer key

2 marks · MCQ
Report issue

Order a passage by its references

Reading Comprehension & Verbal Reasoning

Question 6, GATE 2024: Order these ideas into a coherent passage. P: This geological event raised rocks to about 4 km through heat and energy. Q: Thus geophysicists regard the Himalayas as an active event rather than a static feature. R: Cooling of this massive edifice absorbed atmospheric carbon dioxide and altered the atmosphere. S: A breakaway Antarctic bedrock mass collided with the Eurasian Plate long ago. A QPSR; B QSPR; C SPRQ; D SRPQ.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Approach: Follow the antecedents of “this geological event”, “this massive edifice” and “Thus”.

1. Derivation. S introduces the collision. P refers back to it as this geological event and describes the raised rocks. R refers to this massive edifice and describes its subsequent cooling. Q begins Thus and supplies the concluding interpretation. The coherent order is SPRQ, option C. This is a textual-coherence answer, not independent validation of all geological claims in the supplied passage.

2. Explanation and checks. S must introduce the collision before P can refer back to it. P must describe the raised edifice before R can refer to that edifice cooling. Q summarizes the preceding account and therefore belongs last. These dependencies form S before P before R before Q, rather than merely a plausible opening sentence. In SRPQ, R mentions an edifice before P has introduced its formation.

Original paper, page 4 · Answer key

2 marks · MCQ
Report issue

Equal sale prices with opposite percentages

Arithmetic, Ratios & Percentages

Question 7, GATE 2024: Two items sell for the same price. One sale earns 10% profit and the other incurs 10% loss. What is the combined result? A 1% profit; B 2% profit; C 1% loss; D 2% loss.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Approach: Express both original costs in terms of their common selling price; profit percentages use cost as the denominator.

1. Derivation. If each selling price is s, the costs are s/1.1 and s/0.9. Their total is(10/11+10/9)s=200s/99, versus proceeds 2s=198s/99. The loss is 2s/99, or(2/200)×100=1 percent of cost. Answer C.

2. Explanation and checks. For a numerical check choose each selling price as 99 units. The profitable item cost 90 and the loss-making item cost 110. Total cost is 200 and total revenue is 198, so the loss percentage is 2/200×100=1%. The two 10% changes do not cancel because they are taken on different cost prices. Equal cost prices, unlike equal selling prices, would have made equal percentage profit and loss cancel.

Original paper, page 5 · Answer key

2 marks · MCQ
Report issue

Relative increase in renewable generation share

Data Interpretation & Logical Reasoning

Question 8, GATE 2024: Electricity shares in 2007 are coal 35%, gas 25%, hydro 30%, wind 5%, solar 5%; in 2023 they are coal 20%, gas 15%, hydro 35%, wind 10%, solar 20%. Hydro, wind and solar are renewable. Total generation is unchanged. Find the percentage increase in the renewable share. A 25%; B 50%; C 77.5%; D 62.5%.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Approach: Add the renewable categories in each chart, then divide the change by the old share.

1. Derivation. The relative increase is(65−40)/40×100=62.5 percent, option D. The increase in percentage points is 25, which is not the percentage increase requested.

2. Explanation and checks. Take the unchanged total generation as 100 units: renewable production rises from 40 to 65 units. Its gain is 25 units, measured against its original 40 units, so 25/40=0.625. Dividing instead by the new value 65 would answer a different question. Since total generation is fixed, the relative growth in share also equals the relative growth in renewable electricity generated.

Original paper, page 6 · Answer key

2 marks · MCQ
Report issue

Three cuts of a cube

Geometry & Spatial Aptitude

Question 9, GATE 2024: A cube must be cut into eight pieces of identical size and shape. Every straight cut goes through the cube completely. What is the minimum number of cuts? A 3; B 4; C 7; D 8.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Prove both a construction and a lower bound.

1. Derivation. Three mutually perpendicular central plane cuts divide the cube into eight congruent smaller cubes. Two plane cuts produce at most four pieces, so fewer than three cannot suffice. The minimum is 3, option A.

2. Explanation and checks. For a cube of side a, cut at the midpoint along each of the three coordinate directions. The result has two intervals in every direction, hence 2×2×2 cubes, each of side a/2. For the lower bound, one plane creates at most two pieces; a second plane can split each existing piece at most once, producing at most four. Thus two cuts cannot reach eight, and the three-cut construction is optimal.

Original paper, page 7 · Answer key

2 marks · MCQ
Report issue

Count non-cross neighbors along a boundary

Data Interpretation & Logical Reasoning

Question 10, GATE 2024: A 4×4 grid has rows [1,X,4,3], [X,5,5,4], [3,X,6,X], and four empty non-X cells. Each number counts adjacent non-X cells horizontally, vertically and diagonally, excluding itself. Find the sum to enter in the bottom row. A 11; B 10; C 12; D 9.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: For each bottom cell count its horizontal neighbors and the eligible cells in the row directly above.

1. Derivation. Counting neighboring noncross cells in the last row from left to right gives 2, 4, 3, 2: each includes its existing horizontal neighbors plus the noncross cells directly or diagonally above. The sum is 11, option A. A cell does not count itself.

2. Explanation and checks. The horizontal contributions are 1,2,2,1. The row above has non-cross cells only in columns 1 and 3, so its contributions to the four bottom cells are 1,2,1,1. Adding componentwise gives 2,4,3,2. An independent total is 6 horizontal contributions plus 5 upward contributions =11. Cells two rows away cannot contribute, and the numbers already printed are not weights: each non-cross neighbor contributes just one.

Original paper, page 8 · Answer key

1 mark · MCQ
Report issue

Convert DMA stolen cycles to bit rate

Input/Output, DMA & Interrupts

Question 11, GATE 2024: A 4 MHz processor gives 1% of its cycles to a cycle-stealing DMA controller. Each stolen cycle transfers 8 bytes to memory. Find the rate in bits/s. A 256000; B 3200; C 2560000; D 32000.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Approach: Keep the units in each multiplication: cycles/second × stolen fraction × bytes/cycle × bits/byte.

1. Derivation. DMA receives 0.01×4×10⁶=40000 processor cycles per second. Each transfers 8 bytes=64 bits, so the rate is 40000×64=2560000 bits/s, option C. The percentage applies to cycles, and the requested unit is bits rather than bytes.

2. Explanation and checks. One MHz means one million cycles per second, so the available total is 4000000 cycles/s. One percent is 0.01, not 0.1. The DMA transfers 320000 bytes/s; multiplying this intermediate result by eight gives the requested 2560000 bits/s. No additional device or memory bottleneck is specified, so the stipulated eight-byte-per-cycle transfer is used directly rather than introducing an extra latency.

Original paper, page 9 · Answer key

1 mark · MCQ
Report issue

Translate “when” into an implication

Propositional & Predicate Logic

Question 12, GATE 2024: Let p mean “a fail grade can be given” and q mean “the student scores more than 50%”. Represent “a fail grade cannot be given when the student scores more than 50%”. A q→¬p; B q→p; C p→q; D ¬p→q.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Identify the condition and then negate the correct proposition.

1. Derivation. The phrase when q makes q the sufficient condition. Its consequence is that fail grade cannot be given, namely NOT p. Therefore the statement is q→NOT p, option A; the converse is not asserted.

2. Explanation and checks. The only prohibited case is q true together with p true: a student exceeds the threshold yet a fail grade can be given. The implication q→¬p excludes exactly that case. When q is false, the sentence says nothing about whether a fail grade can be given. Option D incorrectly turns sufficient marks into a necessary condition for not giving a fail grade; it asserts the converse.

Original paper, page 9 · Answer key

1 mark · MCQ
Report issue

Trace argument evaluation separately from function execution

Functions & Parameter Passing

Question 13, GATE 2024: Functions g(p) and h(q) each print their integer argument with no separator and return it. Function f(x,y) calls g(x), then h(y). main calls f(g(10),h(20)). Assume argument expressions are evaluated right to left. Output choices: A 20101020; B 10202010; C 20102010; D 10201020.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (13 steps)

Approach: Separate the calls that evaluate arguments from the calls inside f.

1. Derivation. Using the stipulated right-to-left argument evaluation, h(20) prints 20, then g(10) prints 10. Their return values bind x=10, y=20 in f. Its sequential statements then print10 and 20. With no separators the output is 20101020, option A. Right-to-left evaluation is an explicit premise here, not a portable C-language guarantee.

2. Explanation and checks. The event trace is h(20): print 20, return 20; g(10): print 10, return 10; enter f with x=10,y=20; g(x): print 10; h(y): print 20. Reversing evaluation order does not swap the formal parameters: the first argument still supplies x. The explicit right-to-left assumption applies to evaluating the argument expressions, not to reversing the two statements in the body of f.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Recognize the reserved IEEE exponent pattern

Data Representation & Arithmetic

Question 14, GATE 2024: Choose the largest numeric IEEE 754 binary32 value among these sign/exponent/fraction fields. All signs are 0. A exponent 01111111, 23 fraction bits all 1; B exponent 11111110, fraction all 1; C exponent 11111111, fraction all 1; D exponent 01111111, fraction all 0.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (6 steps)

Approach: Classify special encodings before comparing the ordinary positive values.

1. Derivation. For a normal binary32 value the magnitude is(1+fraction)×2E−127. B has the largest finite exponent 254 and an all-one fraction, giving(2−2⁻²³)×2¹²⁷, the largest finite positive binary32 value. A is just below 2; D is 1. C has exponent 255 and a nonzero fraction, so it is NaN, not a larger number. Answer B.

2. Explanation and checks. An all-ones exponent is reserved: a zero fraction would encode positive infinity, but the nonzero fraction in C encodes NaN. NaN is unordered and is not a numeric maximum. For B the biased exponent 254 becomes 127, and the fraction sum is 1−2−23, giving significand 2−2−23. A instead has actual exponent zero, and D has both exponent zero and fraction zero, so both are much smaller.

Original paper, page 11 · Answer key

1 mark · MCQ
Report issue

A recurrence whose larger-root coefficient vanishes

Asymptotic Analysis & Recurrences

Question 15, GATE 2024: T(0)=1, T(1)=2, and T(n)=5T(n−1)−6T(n−2) for n≥2. Choose its tight asymptotic class. A Θ(2^n); B Θ(n2^n); C Θ(3^n); D Θ(n3^n).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Solve the characteristic equation and then enforce both initial conditions.

1. Derivation. The characteristic polynomial r²−5r+6=(r−2)(r−3) gives T(n)=a 2ⁿ+b3ⁿ. T(0)=1 gives a+b=1, while T(1)=2 gives 2a+3b=2. Subtracting twice the first equation yields b=0, so a=1 and T(n)=2ⁿ exactly. Therefore A; the larger characteristic root does not contribute for these initial values.

2. Explanation and checks. A direct induction independently verifies the result: assuming T(n−1)=2n−1 and T(n−2)=2n−2, the recurrence becomes (10−6)2n−2=2n. Both base cases agree. The characteristic roots are distinct, so no factor n is introduced by repeated roots. More importantly, choosing the largest root without solving for its coefficient would give the wrong growth class here because that coefficient is zero.

Original paper, page 12 · Answer key

1 mark · MCQ
Report issue

Integrate a reflected function identity

Calculus

Question 16, GATE 2024: A continuous real function satisfies f(x)=1−f(2−x) for every real x. Find the integral of f(x) from 0 to 2. A 0; B 1; C 2; D −1.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Pair each point x with its reflection 2−x across the midpoint 1.

1. Derivation. Let I=∫₀²f(x)dx. Substitution u=2−x gives∫₀²f(2−x)dx=I. Integrating f(x)+f(2−x)=1 therefore gives 2I=2, hence I=1, option B. Continuity ensures the integrals exist.

2. Explanation and checks. For the reflected integral let u=2−x, so dx=−du. The limits x=0 and x=2 become u=2 and u=0; reversing them cancels the minus sign. Thus both integrals have the same value although f itself need not be constant. The relation fixes f(1)=1/2 and fixes the interval average at 1/2, yielding area 2×1/2=1. Solving for a particular function is unnecessary. For example, f(x)=x/2 satisfies the identity and integrates to one, illustrating that the required value does not depend on f being constant.

Original paper, page 12 · Answer key

1 mark · MCQ
Report issue

Interpret the diagonal of the squared adjacency matrix

Graph Theory

Question 17, GATE 2024: A is the adjacency matrix of a simple undirected graph and A=A^−1. What must the graph be? A a cycle; B a perfect matching; C a complete graph; D no such graph exists.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Convert the inverse equation to A²=I and count length-two walks.

1. Derivation. A=A⁻¹ implies A²=I. For a simple undirected graph, diagonal entry(A²)ᵥᵥ counts the neighbors of v, so every vertex has degree 1. Thus the graph is a disjoint union of edges covering all vertices, a perfect matching. Conversely each two-vertex edge adjacency block squares to identity. Answer B.

2. Explanation and checks. Because A is symmetric with entries 0 or 1, (A²)vv=sum_u A_vu A_uv=sum_u A_vu=degree(v). The identity matrix has diagonal 1, forcing every degree to be exactly one. Following the sole edge from any vertex reaches a partner whose sole edge comes back, so components are isolated two-vertex edges. Such graphs exist whenever the number of vertices is even; they need not form one cycle or a complete graph.

Original paper, page 13 · Answer key

1 mark · MCQ
Report issue

All six faces on six fair dice

Probability & Statistics

Question 18, GATE 2024: Six independent unbiased dice are rolled. What is the probability all six face values are different? A 1/324; B 5/324; C 7/324; D 11/324.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Count outcomes for distinguishable dice, or expose the dice one at a time.

1. Derivation. There are 6⁶ equally likely outcomes for six labelled fair dice. All six faces are distinct exactly when the outcome is a permutation of 1 through 6, giving 6! possibilities. Probability=720/46656=5/324, option B.

2. Explanation and checks. The sequential calculation is (6/6)(5/6)(4/6)(3/6)(2/6)(1/6), because every new die must avoid all previously observed faces. This equals 6!/66. The dice may be rolled simultaneously, but labeling them for counting does not change their probabilities. There is only one unordered multiset containing all six faces, yet it corresponds to 720 ordered outcomes, so using 1/66 would undercount favorable outcomes.

Original paper, page 13 · Answer key

1 mark · MCQ
Report issue

Persistence after a transaction commits

Transactions & Concurrency Control

Question 19, GATE 2024: A DBMS has told the user a transaction succeeded. Its effect must survive a crash even if all changed data pages have not reached disk. Which ACID property is this? A durability; B atomicity; C consistency; D isolation.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Identify which guarantee applies after successful commit.

1. Derivation. Durability guarantees that the effect of an acknowledged committed transaction survives a crash, typically through durable logging and recovery even if data pages have not yet been flushed. Atomicity is all-or-nothing execution, consistency concerns integrity constraints, and isolation concerns interference. Answer A.

2. Explanation and checks. Durability need not mean that every modified database page is already stored in its final disk location. A sufficiently durable commit record and log can permit recovery to redo committed changes after restart. Atomicity instead prevents partial effects of an unsuccessful transaction; isolation controls interactions among simultaneous transactions. Consistency concerns preservation of the database constraints when transactions execute correctly. The decisive words here are successful completion and persistence after a crash.

Original paper, page 14 · Answer key

1 mark · MCQ
Report issue

Mandatory participation of a weak entity

Database Models, Architecture & ER Diagrams

Question 20, GATE 2024: In an ER model, what participation in an identifying relationship is mandatory? A total participation of the weak entity set; B total participation of the owner entity set; C both sets must participate totally; D neither must.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Distinguish the dependent entity from the entity that supplies its identity.

1. Derivation. A weak entity needs its identifying owner relationship to determine its identity; every weak entity therefore participates. An owner may exist with no dependent weak entity unless a separate application constraint requires one. Thus total participation is mandatory for the weak entity set only, option A.

2. Explanation and checks. For example, a dependent identified by an employee identifier together with a dependent-name discriminator cannot exist in this model without an employee owner. However an employee can have no dependents and still have its own identity. “Total participation” means every entity in that set appears in the relationship; it does not mean every possible owner–dependent pair is related. Thus mandatory dependence flows from weak entity to owner, not in both directions.

Original paper, page 14 · Answer key

1 mark · MCQ
Report issue

Match compiler phases to their products

Compiler Phases, Linking & Loading

Question 21, GATE 2024: Match P lexical analyzer, Q syntax analyzer, R intermediate code generator, S code optimizer to 1 abstract syntax tree, 2 token, 3 parse tree, 4 constant folding. A 4,1,3,2; B 2,3,1,4; C 2,1,3,4; D 4,3,2,1 (listed in P,Q,R,S order).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Follow the conventional progression from source characters to structure to intermediate form to optimization.

1. Derivation. Lexical analysis produces tokens(P–2). Syntax analysis constructs a parse tree(Q–3). An abstract syntax tree is a common intermediate representation associated with intermediate-code generation(R–1). Constant folding is a code optimization(S–4). This gives B. Practical compilers can construct ASTs during parsing too; these are the conventional matches among the listed choices, not exclusive ownership of representations.

2. Explanation and checks. A lexer recognizes lexemes such as identifiers and produces tokens; a parser groups tokens according to grammar productions and yields a parse tree. An AST removes grammar-only detail to represent the essential operators and operands, so among these choices it is the intermediate representation. Constant folding replaces an expression such as 3×4 with 12. Real implementations may combine phase boundaries, but B is the intended one-to-one conceptual match.

Original paper, page 15 · Answer key

1 mark · MCQ
Report issue

A two-state parity automaton

Finite Automata

Question 22, GATE 2024: A DFA has start state E (nonaccepting) and state O (accepting). Input 0 loops at either state; input 1 switches E↔O. Which regex represents it? A 0*1(0+10*1)*; B 0*(10*11)*0*; C 0*1(010*1)*0*; D 0(1+0*10*1)*0*. Here + is union.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Assign a parity invariant to each state, then check the loop structure in the regex.

1. Derivation. It accepts exactly strings with an odd number of 1s. The initial 0*1 enters the accepting state; each following 0 stays there and each 10*1 makes a round trip through the other state. Therefore0*1(0+10*1)*, option A. B accepts epsilon, C cannot generate 111, and D requires an initial 0, so each differs.

2. Explanation and checks. After any prefix, E means an even number of ones and O means an odd number. In A, the leading 0*1 contributes the first one; each subsequent block contributes either zero ones or exactly two, preserving odd parity. Conversely, after the first one, any remaining ones can be paired, with intervening zeros accommodated by the blocks. The short strings ε, 111 and 1 distinguish B, C and D respectively from the required language.

Original paper, page 16 · Answer key

1 mark · MSQ
Report issue

Separate the IP destination from the Ethernet next hop

Network Layers & Devices

Question 23, GATE 2024: X sends a TCP packet to Y through router R; Ethernet switch S is the first switch between X and R. At departure from X, which statements hold? A destination IP is R; B destination IP is Y; C destination MAC is S; D destination MAC is Y.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B

Approach: Use end-to-end addressing for the IP packet and local-link addressing for its enclosing frame.

1. Derivation. The network-layer destination remains final host Y. Because R is the next IP hop beyond the local Ethernet, the frame’s destination MAC is the local interface of R, not the switch S or remote host Y. A switch forwards that frame without being its destination. Thus only B is true, under ordinary routing without destination NAT.

2. Explanation and checks. X chooses R as the next-hop router and obtains the MAC address of R’s local interface, normally through ARP. S reads that destination MAC to forward the frame, but is not itself the frame recipient. R later removes the incoming link header and constructs a new one for the next link. This changes link addresses without replacing the final IP destination Y under ordinary routing. TCP does not make a distant host directly reachable on the local Ethernet.

Original paper, page 17 · Answer key

1 mark · MSQ
Report issue

Hardware translation versus OS allocation

Virtual Memory & Paging

Question 24, GATE 2024: Which are MMU responsibilities in a paging system? A allocate a new process’s page table; B translate virtual to physical addresses with the page table; C trap on a missing/invalid page-table mapping; D trap on a write to a read-only page.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C, D

Approach: Separate fast hardware checks from policy and resource management performed by the operating system.

1. Derivation. The OS allocates a new process’s page-table structures, so A is not an MMU duty. The MMU uses the mappings to translate addresses, detects absent/invalid mappings and raises page-fault exceptions, and checks permissions such as write protection. Thus B, C, D. A TLB miss alone is not the same as a page being absent from the page table.

2. Explanation and checks. The MMU interprets the mapping and protection information supplied by the OS. For a valid writable mapping it can complete a write translation; for a nonpresent page or forbidden write it transfers control through an exception so the OS can decide what to do. Creating the table and allocating its memory belong to OS management. A TLB cache miss may be resolved by a page-table walk without any missing mapping or page-in operation.

Original paper, page 17 · Answer key

1 mark · MSQ
Report issue

A trap is not automatically a process switch

Processes, Threads & System Calls

Question 25, GATE 2024: Running process P encounters one of these events. Which always move P to a non-running state in the intended model? A an actually blocking disk-read system call; B a page fault for a page in swap; C a disk interrupt delivering another process’s data; D a timer interrupt.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B

Approach: Ask whether P must wait for something unavailable, rather than merely whether control enters the kernel.

1. Derivation. A genuinely blocking disk read puts P into a waiting state while I/O completes. A fault on a page currently in swap also requires storage I/O, so P is blocked pending page-in. An interrupt for another process need not deschedule P, and a timer interrupt may return to P if no switch is needed. Thus A, B. A mere user-to-kernel mode switch is not necessarily a switch to a different process; blocking in A is taken as actual blocking, as stipulated.

2. Explanation and checks. For A, the CPU cannot complete P’s read until the requested I/O finishes; for B, execution cannot retry the memory access until the swapped page is brought into memory. Both create a reason to block P and run another process or idle. In C, handling an interrupt can make a different process ready without forcing immediate preemption. In D, the scheduler may choose P again. Kernel entry and saving a trap frame alone are not the requested process context switch.

Original paper, page 18 · Answer key

1 mark · MSQ
Report issue

Choose file organizations for a full scan

Indexing, Storage & Query Processing

Question 26, GATE 2024: Which file organizations are I/O-efficient for scanning all records? A sorted file; B heap file; C unclustered tree index; D unclustered hash index.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B

Approach: Optimize for reading the entire data set, not for retrieving a few qualifying records.

1. Derivation. A full scan of a sorted file or a heap file reads the data pages sequentially, usually once each. Scanning through an unclustered index can chase record pointers to many scattered data pages, causing repeated/random I/O. Thus the I/O-efficient file organizations for the full scan are A, B; a selective index lookup is a different workload.

2. Explanation and checks. For a data file occupying B pages, scanning the file in its physical order takes about B page reads whether the records have a sorted order or an arbitrary heap order. An unclustered index does not group the data records in index traversal order, so neighboring index entries may point to different pages and cause random accesses or rereads. The index also has its own pages to read. Selectivity can make an index attractive for lookup, but that is absent in a full scan.

Original paper, page 18 · Answer key

1 mark · MSQ
Report issue

Growing and shrinking phases in 2PL

Transactions & Concurrency Control

Question 27, GATE 2024: Which statements about two-phase locking are true? A it permits only serializable schedules; B every operation locks just before and releases immediately after; C after the first lock release a transaction can acquire no new lock; D deadlock can occur.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C, D

Approach: Apply the no-new-locks-after-release rule and distinguish serializability from progress.

1. Derivation. Two-phase locking first acquires locks and then, after the first release, only releases locks. The no-new-locks shrinking-phase rule proves C. Ordering transactions by their lock points proves conflict serializability, hence A. It does not release every lock immediately after each operation, and deadlock is possible: T1 holds X and waits for Y while T2 holds Y and waits for X. Thus A, C, D.

2. Explanation and checks. The growing phase permits acquisition but no release; the shrinking phase permits release but no acquisition. The instant at which a transaction acquires its final lock is its lock point; ordering transactions by such points is consistent with every conflicting dependency, giving a serial order. Holding X while waiting for Y and holding Y while waiting for X obey the growing-phase rule, so 2PL can still deadlock. Releasing each lock immediately, as B claims, would prevent later acquisitions and is not the general protocol.

Original paper, page 19 · Answer key

1 mark · MSQ
Report issue

IPv4 fragmentation and the DF bit

IP Addressing, Fragmentation & Address Resolution

Question 28, GATE 2024: Which IPv4 statements are intended to be true? A only the source fragments; B any router fragments a datagram exceeding its outgoing MTU; C reassembly occurs only at the destination; D every intermediate router reassembles. The printed B does not mention the Don’t Fragment bit.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

Our answer: B;C when DF=0; C without that qualification

Approach: State the fragmentation-permitted model separately from the literal unrestricted assertion.

1. Derivation. In ordinary IPv4 with fragmentation permitted, an intermediate router can fragment a datagram larger than its outgoing MTU, and reassembly occurs only at the final IP destination. This gives the official B, C. However B is overbroad without the DF-bit condition: when Don’t Fragment is set, the router drops an oversized datagram and normally sends an ICMP fragmentation-needed message instead of fragmenting it. Thus B is not an unconditional statement about every IPv4 datagram. A and D are false; C remains true. Preserve official B, C, and distinguish the intended DF=0 model from the literal unrestricted claim.

2. Explanation and checks. A fragment is itself an IP packet and can follow routing decisions independently, so intermediate reassembly would both require storage and assume all fragments meet at the same router. Destination-only reassembly avoids that assumption. When DF=0 an oversized fragment or datagram may be fragmented further. When DF=1, B’s asserted behavior cannot occur: the router must not fragment.

Original paper, page 19 · Answer key

1 mark · MSQ
Report issue

Recognize the false attribute-evaluation claims

Semantic Analysis & Type Checking

Question 29, GATE 2024: Select FALSE statements. A an attribute grammar is an SDD whose semantic functions have no side effects; B L-attributed definitions cannot always be evaluated depth first; C synthesized attributes can be evaluated during bottom-up parsing; D every L-attributed definition on an LR(1) grammar can be evaluated by bottom-up parsing.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Approach: Check the allowed dependency direction and distinguish a completed-tree traversal from evaluation during parsing.

1. Derivation. The question asks for false statements. A is the usual side-effect-free definition of an attribute grammar. L-attributed definitions admit a left-to-right depth-first evaluation, assigning inherited attributes on entry and synthesized ones on return, so B is false. Synthesized attributes can be computed at reductions, making C true. Arbitrary inherited dependencies in an L-attributed definition need not be available at the relevant point in an LR parse, so D’s universal claim about evaluation during bottom-up parsing is false. Thus B, D. Constructing a full parse tree and doing a separate attribute-evaluation traversal is distinct from the intended parsing-time claim.

2. Explanation and checks. An L-attributed production restricts an inherited attribute of a child to information available from the parent and earlier siblings. A left-to-right depth-first traversal can therefore compute it before entering that child and compute synthesized values after returning. A bottom-up reduction naturally has child synthesized values available, but arbitrary inherited context may be required earlier than that reduction. Hence an LR(1) grammar alone does not ensure the claimed parsing-time attribute evaluation. The question asks for the false choices, not the true ones.

Original paper, page 20 · Answer key

1 mark · MSQ
Report issue

Test Boolean identities with the two possible values

Boolean Algebra & Logic Gates

Question 30, GATE 2024: For Boolean x select the FALSE identities. A x·1=x; B x+1=x; C x·x=0; D x+¬x=1. Here · means AND and + means OR.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

Approach: Use Boolean truth tables, not ordinary arithmetic addition.

1. Derivation. Boolean identities give x·1=x and x+NOT x=1, so A, D are true. In contrast x+1=1, not x when x=0; and x·x=x, not 0 when x=1. The false identities are B, C.

2. Explanation and checks. For x=0 the left sides of A,B,C,D are 0,1,0,1, while the asserted right sides are 0,0,0,1; B already fails. For x=1 the left sides are 1,1,1,1 and the right sides are 1,1,0,1; C fails. Thus an identity must hold for both input values to be true. A is the AND identity law, C misstates idempotence, and D is the complement law.

Original paper, page 20 · Answer key

1 mark · MSQ
Report issue

Classify register dependencies by read and write sets

Pipelining & Hazards

Question 31, GATE 2024: Instructions have destination first: I1 DIV R3,R1,R2; I2 SUB R5,R3,R4; I3 ADD R3,R5,R6; I4 MUL R7,R3,R8. Which are true? A I1→I2 RAW on R3; B I1→I3 WAR on R3; C I2→I3 RAW on R3; D I3→I4 WAW on R3.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A

Approach: Write down which instruction produces a register and which consumes it; retain the stated register name.

1. Derivation. I1 writes R3 and I2 reads R3, a read-after-write dependency, so A is true. I1 and I3 both write R3, making their relation WAW rather than WAR. I2 reads R3 and I3 writes it, giving WAR on R3 (they also have RAW on R5). I3 writes R3 and I4 reads it, giving RAW rather than WAW. Only A.

2. Explanation and checks. On R3 the four operations are write, read, write, read. A later read after an earlier write is RAW, two writes give WAW, and a write after an earlier read gives WAR. This sequence directly classifies each proposed pair. Although I2→I3 does have a RAW dependency on R5, option C explicitly says R3 and is therefore false. A dependency is a program-order relationship; whether it produces an actual stall depends on the implementation.

Original paper, page 21 · Answer key

1 mark · MSQ
Report issue

IPv4 fields updated on forwarding

IP Addressing, Fragmentation & Address Resolution

Question 32, GATE 2024: Which IP-header fields are always updated by an ordinary forwarding router in the IPv4 model? A source IP; B protocol; C TTL; D header checksum.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C, D

Approach: Find the field representing the remaining hop lifetime, then account for header integrity.

1. Derivation. An IPv4 router decrements TTL before forwarding. TTL is covered by the IPv4 header checksum, which must therefore be updated. Ordinary routing need not alter the source IP address or the upper-layer protocol field. Thus C, D. The header-checksum option makes the IPv4 model implicit.

2. Explanation and checks. TTL decreases as a packet is forwarded; if it expires the packet is discarded rather than forwarded. Changing TTL changes the header over which the IPv4 checksum is defined, so the checksum must be recomputed or incrementally adjusted. The protocol value still indicates the same encapsulated transport protocol. Source address changes can occur under NAT, but NAT is not a necessary operation of every router. IPv6 is a different header format and has no IPv4-style header checksum.

Original paper, page 22 · Answer key

1 mark · MSQ
Report issue

A read-only string-length loop

Arrays & Strings

Question 33, GATE 2024: In C, fX(char *a) sets char *b=a, executes while(*b) b++, then returns b−a as int. Which claims are true? A fX("abcd") returns; B with char c[]="abcd", fX(c) returns; C the function does not compile; D with char *c="abcd", fX(c) returns.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B, D

Approach: Trace the pointer until the null terminator and distinguish reading a literal from modifying it.

1. Derivation. The pointer b advances until it reaches the terminating null byte and returns the element difference b−a, the string length. Each stated argument is a valid null-terminated four-character string, so each call returns 4. The function only reads characters; it does not modify string literals. Therefore A, B, D are true and the code is valid C. Pointer subtraction here is within the same array and the small result fits int.

2. Explanation and checks. The bytes at offsets 0,1,2,3 are a,b,c,d and are nonzero, so the loop advances four times. At offset 4 the terminating zero makes the condition false. Both pointers remain associated with the same character array, so subtraction gives four elements. The function never assigns through either pointer, and the supplied arguments are terminated, avoiding two common string errors. These are C examples; a stricter C++ string-literal type rule is not the language specified.

Options A, B and D print the string literal abcd between typographic quotation marks (”abcd”). These are read as ordinary ASCII string delimiters, and under that intended reading each call returns 4. The function definition itself contains no quotation marks and is valid C as printed; only the quote glyphs in the options, copied literally, would not form a C string literal.

Original paper, page 22 · Answer key

1 mark · NAT
Report issue

Count linear extensions of a partial order

Partial Orders & Lattices

Question 34, GATE 2024: On {1,2,3,4}, a partial order contains every reflexive pair and (1,2),(3,2),(3,4). How many total orders extend it?
Tap to enlarge
Answer & solution

Official answer: 5

Approach: Choose only minimal elements first and branch on those choices.

1. Derivation. The restrictions are 1 before 2, 3 before 2, and 3 before 4. If1 is first, 3 must be second and 2, 4 may be ordered either way, giving 1324 and 1342. If3 is first, the remaining order only requires 1 before 2, giving 3124, 3142, 3412. These exhaust the choices, so there are 5 linear extensions.

2. Explanation and checks. Initially 1 and 3 are eligible: 2 requires both to precede it, while 4 requires 3. In the branch starting with 1, only 3 is eligible next, leaving two orders of 2 and 4. In the branch starting with 3, the remaining three elements need only respect 1 before 2, which holds in half of their 3!=6 permutations. The reflexive pairs impose no extra restriction on the sequence of distinct elements.

Original paper, page 23 · Answer key

1 mark · NAT
Report issue

Minimum replacements via a longest nondecreasing subsequence

Dynamic Programming

Question 35, GATE 2024: The distance of an integer array is the least number of entries replaced by arbitrary integers to make it nondecreasing. Find the distance of [2,5,3,1,4,2,6].
Tap to enlarge
Answer & solution

Official answer: 3

Step through it (9 steps)

Approach: Any entries kept in place must already form a nondecreasing subsequence; combine that lower bound with an explicit repair.

1. Derivation. Any unchanged elements must form a nondecreasing subsequence. Longest nondecreasing subsequence lengths ending at the seven positions are 1, 2, 2, 1, 3, 2, 4, so at most 4 elements can remain unchanged and at least 7−4=3 replacements are needed. Keep the subsequence 2, 3, 4, 6 at positions 1, 3, 5, 7; replace positions 2, 4, 6 by 2, 3, 4 respectively to obtain[2, 2, 3, 3, 4, 4, 6]. Thus3 is achievable and minimal.

2. Explanation and checks. For each position i define L[i]=1+max L[j] over j<i with A[j]≤A[i], or 1 if there is no such j. This yields [1,2,2,1,3,2,4], with maximum 4. Therefore keeping five entries is impossible. The displayed repair keeps four original entries and changes exactly three, establishing the matching upper bound. It is a replacement problem, not a sorting-by-swaps problem, and equality is allowed in the final array.

Original paper, page 23 · Answer key

2 marks · MCQ
Report issue

Pointer distance versus pointed-to value difference

Pointers & Memory

Question 36, GATE 2024: C code declares double a[2]={20.0,25.0}; sets p=a and q=p+1; and prints "%d,%d" with (int)(q−p), (int)(*q−*p). Which output? A 4,8; B 1,5; C 8,5; D 1,8.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Evaluate the pointer expression and the dereferenced arithmetic expression separately.

1. Derivation. p points to a[0] and q=p+1 points to a[1]. Pointer subtraction counts array elements, not bytes, so q−p=1. The values differ by 25.0−20.0=5.0, cast to 5. The output is 1, 5, option B, independent of sizeof(double).

2. Explanation and checks. Adding one to a double pointer moves by the storage occupied by one double, but subtracting two double pointers converts the byte displacement back into an element count. Thus it is one regardless of the implementation’s double size. Dereferencing yields the numeric values 25.0 and 20.0, whose difference is exactly 5.0 here. The integer casts produce 1 and 5 for the two %d arguments; they do not turn the pointer difference into a byte distance.

The printed program uses typographic quotation marks and en dashes. Interpreting these as the intended ASCII C quotation marks and subtraction operators gives the stated answer B; copied literally, the printed characters do not form valid C tokens.

Original paper, page 24 · Answer key

2 marks · MCQ
Report issue

Compare preemptive and nonpreemptive shortest-job schedules

CPU Scheduling

Question 37, GATE 2024: Four processes have (arrival,burst): A(0,10), B(2,6), C(4,3), D(6,7). Find average waiting times for SRTF and nonpreemptive SJF. A 6,7; B 6,7.5; C 7,7.5; D 7,8.5.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (2 schedules)

Approach: Draw a separate timeline for each policy, then use waiting=completion−arrival−burst.

1. Derivation. SRTF runs A0–2, B2–4, C4–7, B7–11, D11–18, A18–26. Completion times A26, B11, C7, D18 give waiting times 16, 3, 0, 5 after subtracting arrival and burst, average 24/4=6. Nonpreemptive SJF runs A0–10, C10–13, B13–19, D19–26, giving waiting times 0, 11, 6, 13 and average 30/4=7.5. Answer B. D’s arrival at 6 does not preempt C, whose remaining time is 1.

2. Explanation and checks. For SRTF, at time 2 A has 8 left and B needs 6, so B preempts A. At time 4 B has 4 left and C needs 3, so C preempts B. At time 6 C needs only 1 more, so D does not preempt it. In nonpreemptive SJF, A cannot be displaced after starting at time 0; when it finishes at 10 all others are ready and C is shortest. These decisions explain the difference in the two timelines.

Original paper, page 25 · Answer key

2 marks · MCQ
Report issue

An exactly aligned CIDR block

IP Addressing, Fragmentation & Address Resolution

Question 38, GATE 2024: Which prefix exactly covers 10.12.2.0 through 10.12.3.255 inclusive? A 10.12.2.0/23; B 10.12.2.0/24; C 10.12.0.0/22; D 10.12.2.0/22.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (6 steps)

Approach: Find the common binary prefix and verify both size and alignment.

1. Derivation. The range contains two consecutive /24 blocks, third octets 2 and 3. Their common prefix fixes the first 7 bits of that octet, yielding 16+7=23 network bits and 9 host bits. The aligned base is 10.12.2.0, so the exact 512-address range is 10.12.2.0/23, option A.

2. Explanation and checks. The third octets are 00000010 and 00000011: their first seven bits agree and their final bit varies. Together with the entire final octet, that leaves nine variable bits and 29=512 addresses. A /24 contains only 256 addresses. A /22 leaves ten host bits and spans four third-octet values, too many; moreover 10.12.2.0 is not an aligned /22 network base. Both endpoints of A agree exactly with the requested range.

Original paper, page 25 · Answer key

2 marks · MCQ
Report issue

What a BST reveals without its insertion order

Binary Search & Balanced Trees

Question 39, GATE 2024: A BST is built by inserting distinct integers from a known set V into an empty tree, with smaller keys in each left subtree. The insertion order and tree are unknown. What can always be determined from V? A inorder traversal; B root; C preorder; D postorder.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Use the BST order invariant and test the other traversals on two possible insertion sequences.

1. Derivation. An inorder traversal of a BST with distinct keys and smaller keys to the left always visits exactly the sorted set V, regardless of insertion order. The first inserted key becomes the root, and different insertion orders can change the root, preorder, and postorder. Hence only inorder is determined in general, option A. Trivial sets can coincidentally determine more, but do not establish those claims for arbitrary V.

2. Explanation and checks. For V={1,2,3}, inserting 2,1,3 gives root 2, preorder 2,1,3 and postorder 1,3,2. Inserting 1,2,3 gives root 1, preorder 1,2,3 and postorder 3,2,1. Both have inorder 1,2,3. Recursively, inorder visits smaller values, then the node, then larger values; thus it is the sorted list for every valid shape. The examples demonstrate why knowledge of the set alone cannot recover the shape-sensitive alternatives.

Original paper, page 26 · Answer key

2 marks · MCQ
Report issue

Fill four LL(1) parsing-table cells

Parsing & Syntax Analysis

Question 40, GATE 2024: Grammar: S→AaAb | BbBa, A→cS | ε, B→dS | ε. Missing table cells are (1) M[S,c], (2) M[S,d], (3) M[A,b], (4) M[B,a]. Options: A AaAb,BbBa,ε,ε; B BbBa,AaAb,ε,ε; C AaAb,BbBa,blank,blank; D BbBa,AaAb,blank,blank (right sides for the relevant row nonterminal).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (2 parts)

Approach: Use FIRST for nonempty alternatives and FOLLOW for epsilon alternatives.

1. Derivation. FIRST(AaAb)={c, a}, while FIRST(BbBa)={d, b}. Thus the S-row c cell chooses S→AaAb and the d cell S→BbBa. A occurs before a and b in the first production, so FOLLOW(A)={a, b}; its epsilon production is entered for both lookaheads. Similarly FOLLOW(B)={b, a}, so B→epsilon goes in both a, b cells. Hence cells(1)–(4) are S→AaAb, S→BbBa, A→epsilon, B→epsilon, option A.

2. Explanation and checks. A can disappear, so AaAb can start with a; if A does not disappear it begins with c. The same reasoning yields b or d for BbBa. Each occurrence of A in the S production is followed immediately by a terminal, once a and once b, so both terminals enter FOLLOW(A). The two B occurrences similarly supply b and a. There is no need to put an epsilon production under every lookahead: only FOLLOW lookaheads receive it.

Original paper, page 27 · Answer key

2 marks · MCQ
Report issue

Split an epsilon-NFA into accepting path families

Finite Automata

Question 41, GATE 2024: NFA states are 1(start),2,3,4,5, with 2 and 5 accepting. Epsilon edges: 1→2,1→4,3→5. Edges labeled 0: 2→3 and 3→2. Edges labeled 1: 4→5 and 5→4. All other transitions absent. Choose regex: A (00)*+1(11)*; B 0*+(1+0(00)*)(11)*; C (00)*+(1+(00)*)(11)*; D 0+ +1(11)*+0(11)*. Here outer + denotes union; 0+ in D means one or more zeros.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Enumerate paths ending in each accepting state and track the parity before and after the epsilon jump.

1. Derivation. The initial epsilon choice reaches state2 or 4. State2 accepts an even number of 0s; after an odd number of 0s the machine is in 3 and can take epsilon to accepting 5, after which an even number of 1s returns to 5. The direct state4 branch accepts an odd number of 1s. Thus the language is(00)* + 0(00)*(11)* + 1(11)*. The pure even/odd zero cases together equal 0*, so it can be written 0*+(1+0(00)*)(11)*, option B.

2. Explanation and checks. Staying in the upper component accepts an even zero count; reaching 3 requires an odd zero count and jumping to 5 then permits an even one count. Starting at 4 instead requires an odd one count. A misses the accepted word 0. C wrongly accepts 11 (take ε from (00)* and one pair of ones), whereas the NFA cannot accept pure even-positive ones. D misses ε, which is accepted via 1→2. These witnesses isolate B beyond merely manipulating algebraic expressions.

Original paper, page 28 · Answer key

2 marks · MCQ
Report issue

Maintain the one-run and two-value suffix invariants

Correctness, Invariants & Design

Question 42, GATE 2024: For positive X[0..n−1], initialize first=second=len1=len2=maxlen=0. For each v=X[i]: if v==first increment both len1,len2; else if v==second increment len2, set len1=P, second=first; else set len2=Q, len1=1, second=first. Update maxlen=max(maxlen,len2), then first=v. len1 is the equal-value suffix length; len2 is the suffix length with at most two distinct values. Choose P,Q: A len1+1,len2+1; B 1,len1+1; C 1,len2+1; D len2+1,len1+1.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Interpret the saved values before the current iteration updates them.

1. Derivation. first is the previous element and len1 is its final equal-value run length. If the next item equals second but differs from first, the final equal run starts anew, so P=1, while the valid two-value suffix extends by one. If a third distinct value arrives, only the previous final run can accompany it; therefore the new two-value suffix has length len1+1, giving Q=len1+1. The assignments update second to the old first. Thus B; positive input values ensure initial zero sentinels are not actual array values.

2. Explanation and checks. For the prefix [1,2,2], len1=2 and len2=3. If the next value is 1, it is the other known value: the two-value suffix grows to 4, but the same-value suffix has length 1. If instead the next value is 3, keeping all three old elements would create three distinct values; only [2,2,3] is legal, of length old len1+1=3. Updating first last preserves the old run value while second is assigned.

Original paper, page 29 · Answer key

2 marks · MCQ
Report issue

Fill array-load, multiplication and destination triples

Intermediate Code

Question 43, GATE 2024: Expression x[i]=(p+r)*−s[i]+u/w has triples (0) + p r; (1) missing; (2) uminus (1); (3) missing; (4) / u w; (5) + (3) (4); (6) missing; (7) = (6) (5). A fills (1) =[] s i, (3) * (0) (2), (6) []= x i. B uses []= s i, subtraction, =[] x (5). C agrees with A except []= x (5). D uses []= s i, subtraction, =[] x i.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Follow the expression tree from input values to the final indexed assignment.

1. Derivation. Triple1 must read s[i], denoted =[] s i. Triple2 negates that value. Triple3 multiplies results(0) and(2), forming(p+r)×−s[i]. Triple6 identifies the destination x[i], denoted []= x i, and triple 7 stores the accumulated result(5) there. Only A has all three operations and the correct index i. In C the destination incorrectly uses the computed value(5) as its index.

2. Explanation and checks. A triple refers to the result of an earlier triple by its parenthesized index; (5), for example, denotes the computed right-hand-side value, not the source-language subscript i. Loading s[i] must precede negation. Multiplication then combines p+r with that negative value, followed by addition of u/w. The final destination must still be element i of x. Confusing an array read with a destination reference or substituting the computed value for i changes the program.

Original paper, page 30 · Answer key

2 marks · MCQ
Report issue

A pointwise bound without independence

Probability & Statistics

Question 44, GATE 2024: Random variables x,y lie in [0,1], may be dependent, and z=xy. Which always holds? A E[z]=E[x]E[y]; B E[z]≤E[x]E[y]; C E[z]≥E[x]E[y]; D E[z]≤E[x].
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Approach: Use a bound true for each outcome, which remains true after taking an expectation.

1. Derivation. Since0≤y≤1 and x≥0, pointwise xy≤x. Taking expectations preserves the inequality, giving E[xy]≤E[x], option D. No independence is assumed. If x=y is a fair 0/1 variable, E[xy]=1/2>E[x]E[y]=1/4; if y=1−x, E[xy]=0<1/4. These examples rule out universal equality and both fixed comparisons with the product of means.

2. Explanation and checks. Multiplication by a number between zero and one cannot increase a nonnegative quantity, so xy≤x in every outcome; similarly xy≤y. No factorization of expectation is needed. To test the other answers take x equal to 0 or 1 with probability one half each. Choosing y=x makes the variables positively associated, while y=1−x makes them mutually exclusive. Their means remain one half in both examples, yet their product means differ, ruling out any universal product-of-means comparison.

Original paper, page 31 · Answer key

2 marks · MCQ
Report issue

Witness three distinct residents with two products

Relational Algebra & Calculus

Question 45, GATE 2024: Person(pid,city) has a unique pid per person. Using only selection, projection, cross product and rename, how many cross-product operations are minimally required to find cities with at least three residents? A 1; B 2; C 3; D 4.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Approach: Introduce one independently chosen tuple for each person that must be witnessed.

1. Derivation. Rename three copies P1, P2, P3 of Person and take their product using two binary cross products. Select equal cities and pairwise distinct pids, then project the city. This identifies exactly cities with at least three residents. With only one cross product, selection/projection/rename can expose at most two independently chosen source tuples, which cannot witness a third distinct person. Thus the minimum is 2, option B, in the stated algebra without aggregation or other operators.

2. Explanation and checks. Write P1×P2×P3 as (P1×P2)×P3. Select P1.city=P2.city=P3.city and P1.pid≠P2.pid, P1.pid≠P3.pid, P2.pid≠P3.pid, then project P1.city. All three inequalities are necessary to prevent a two-person city from reusing one person. Rename, selection and projection do not introduce an additional independently chosen resident. This lower-bound argument assumes the stated relational algebra expression model, not a materialized intermediate relation supplied from outside the expression.

Original paper, page 31 · Answer key

2 marks · MSQ
Report issue

A semaphore ordering that can deadlock

Deadlocks

Question 46, GATE 2024: Threads share s1=1,s2=0,x=0. T1: wait(s1); x++; print(x); wait(s2); signal(s1). T2: wait(s1); x++; print(x); signal(s2); signal(s1). Possible outcomes? A T1 prints 1 then T2 prints 2; B T2 prints 1 then T1 prints 2; C T1 prints 1 then deadlock without T2 printing; D T2 prints 1 then deadlock without T1 printing.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

Approach: Branch on which thread acquires s1 first, since this excludes the other thread from its increment.

1. Derivation. The first successful wait(s1) excludes the other thread. If T1 acquires it first, T1 increments and prints 1, then blocks on initially zero s2 while still holding s1; T2 cannot reach its signal(s2), so this deadlocks, giving C. If T2 acquires first, it prints 1 and signals s2 and s1. T1 can then acquire s1, print2, consume s2, and finish, giving B. Thus B, C.

2. Explanation and checks. In the T1-first branch the wait-for chain is T1 waiting for s2, which only T2 signals; T2 waits for s1, which T1 will not signal until its s2 wait finishes. In the T2-first branch signal(s2) either stores a permit or satisfies a waiting thread, so T1’s later wait(s2) cannot deadlock. The mutual exclusion around x prevents a lost increment, but it does not prevent the circular wait caused by the semaphore ordering.

Original paper, page 32 · Answer key

2 marks · MSQ
Report issue

Which matrix properties survive a row swap?

Linear Algebra

Question 47, GATE 2024: B is obtained by swapping two rows of a real n×n matrix A. Select true statements: A det(B)=−det(A); B invertibility of A implies invertibility of B; C symmetry of A implies symmetry of B; D zero trace of A implies zero trace of B.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B

Approach: Use the determinant rule for the positive claims and small explicit matrices to refute universal claims.

1. Derivation. A single row swap negates the determinant, proving A. If det(A) is nonzero then det(B)=−det(A) is nonzero as well, proving B. Symmetry is not preserved: swapping rows of diag(1, 2) gives[[0, 2],[1, 0]], which is not symmetric. Zero trace is not preserved: A=[[1, 2],[3,−1]] has trace 0, but its row-swapped matrix has trace 5. Answer A, B.

2. Explanation and checks. A row swap is multiplication on the left by an invertible permutation matrix P, so B=PA and B−1=A−1 P−1 whenever A is invertible. This supplies another proof of B. In contrast symmetry would naturally be preserved by applying the same permutation to rows and columns, PAPT, not by a row permutation alone. Trace invariance also applies to similarity transformations, not arbitrary independent row operations. The two counterexamples in the derivation make these distinctions concrete.

Original paper, page 32 · Answer key

2 marks · MSQ
Report issue

Generate output through two bounded stacks

Stacks & Queues

Question 48, GATE 2024: S1 has capacity 4 and initially contains bottom-to-top 100,200,300,400. S2 has capacity 2 and is empty. T pops S1 into S2; R pops S2 into S1; O pops S1 to output. Empty pops and full pushes are forbidden. Which output orders are possible? A 100,200,400,300; B 200,300,400,100; C 400,200,100,300; D 300,200,400,100.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C, D

Step through it (4 options)

Approach: Give legal operation witnesses for possible orders and a storage lower bound for the impossible order.

1. Derivation. Write T for PushToS2, R for PushToS1, and O for GenerateOutput. Starting with S1 bottom-to-top100, 200, 300, 400 and empty S2: B is realized by T, T, O, R, O, R, O, O; C by O, T, O, O, R, O; D by T, O, O, R, O, O. These produce the stated sequences without exceeding S2 capacity 2. A cannot start with 100: reaching it before any output requires all three higher elements outside S1, but S2 holds only two. Thus B, C, D.

2. Explanation and checks. For B, the first two T operations park 400 then 300 in S2, exposing 200. Output 200, restore and output 300, restore and output 400, then output 100. For C, output 400 first and park only 300; this exposes both 200 and 100 before restoring 300. For D, park only 400 and output 300,200 before restoring it. No hidden extra buffer is available, which is why starting with 100 is impossible.

Original paper, page 33 · Answer key

2 marks · MSQ
Report issue

Compare numerals through a common base

Number Systems & Computer Arithmetic

Question 49, GATE 2024: Which equal 224 in base 5? A 64 in base 10; B 100 in base 8; C 50 in base 16; D 121 in base 7.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B, D

Step through it (7 steps)

Approach: Expand each numeral as a sum of digit×base^position.

1. Derivation. 224 base5 equals 2×25+2×5+4=64 decimal. 100 base8 is 64; 50 base16 is 80 and differs; 121 base7 is 49+14+1=64. Thus A, B, D.

2. Explanation and checks. The rightmost position is the units position in every base. Thus the 4 in 224_5 contributes four, the middle 2 contributes ten, and the left 2 contributes fifty. For 100_8 only the 8² term is nonzero. For 121_7 the contributions are 49,14,1. The digits 5 and 0 in hexadecimal 50 contribute 5×16 and zero, not fifty decimal. Comparing all four decimal values prevents confusing the numeral’s appearance with its represented number.

Original paper, page 34 · Answer key

2 marks · MSQ
Report issue

Compose minterm sets through AND, OR and XOR

Boolean Algebra & Logic Gates

Question 50, GATE 2024: Four-input-variable Boolean functions have minterm sets f1={0,2,3,5,7,8,11,13}, f2={1,3,5,7,11,13,15}, f3={0,1,4,11}, f4={0,2,6,13}. Circuit Y=(f1 AND f2) XOR (f3 OR f4). Which are correct? A Y=Σ(0,1,2,11,13); B Y=Π(3,4,5,6,7,8,9,10,12,14,15); C Y=Σ(0,1,2,3,4,5,6,7); D Y=Π(8,9,10,11,12,13,14,15).
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C, D

Approach: Treat each function’s one-set as a set: AND intersects, OR unites, XOR takes symmetric difference.

1. Derivation. The circuit first ANDs f1 and f2, whose common minterms are{3, 5, 7, 11, 13}. The OR of f3, f4 has minterms{0, 1, 2, 4, 6, 11, 13}. The final XOR keeps their symmetric difference, cancelling11, 13 and giving{0, 1, 2, 3, 4, 5, 6, 7}. Its complementary maxterm indices are 8 through 15. Hence C, D. The final gate was visually confirmed to be XOR, not OR.

2. Explanation and checks. At indices 11 and 13 both intermediate gates output 1, so XOR outputs 0; an OR final gate would incorrectly keep them. At 3,5,7 only the AND branch is 1; at 0,1,2,4,6 only the OR branch is 1. All eight indices 0 through 7 therefore survive. A product-of-maxterms lists zero positions rather than one positions, so complementing this set inside the 16 possible inputs yields D, an equivalent representation to C.

Original paper, page 35 · Answer key

2 marks · MSQ
Report issue

Infer cycle-edge parity from all spanning trees

Trees & Connectivity

Question 51, GATE 2024: A connected undirected graph has positive integer edge weights and every spanning tree has even total weight. What must hold? A all edges even; B all edges share one parity; C every cycle has only even edges; D within each cycle all its edges share one parity.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: D

Approach: Exchange one cycle edge in a spanning tree and compare the two total weights modulo two.

1. Derivation. Fix a cycle C and an edge e on it. The path C minus e is acyclic and can be extended to a spanning tree T. For any other cycle edge f, T−f+e is another spanning tree. Both tree weights are even, so w(e)−w(f) is even. Thus every pair of cycle edges has the same parity, proving D. A and B fail for a graph that is itself a tree with edge weights 1, 1, 2: its only spanning tree has even total 4 but mixed parity. C fails for a triangle with all three weights 1, whose spanning trees all weigh2 although its cycle edges are odd.

2. Explanation and checks. The extension step is justified because any acyclic edge set in a connected graph can be extended to a spanning tree by repeatedly joining components. Adding e to the tree containing C−e creates exactly the cycle C, so removing any f in that cycle returns a tree. Equal parity of tree sums forces equal parity of e and f. Bridges do not belong to cycles, explaining why D places no restriction on their individual parity and why global uniform parity need not follow.

Original paper, page 36 · Answer key

2 marks · MSQ
Report issue

Count terminals by production applications

Context-Free Grammars & Languages

Question 52, GATE 2024: Grammar S→aS | aSbS | c generates w. Let na,nb,nc count the respective terminals in w. Which always hold? A na>nb; B na>nc−2; C nc=nb+1; D nc=2nb.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

Approach: Count how each production changes both the terminal totals and the outstanding nonterminals.

1. Derivation. Let u count applications of S→aS and v count applications of S→aSbS. Then na=u+v and nb=v. A derivation starts with one S; unary rules leave the number of outstanding S unchanged, binary rules increase it by one, and S→c decreases it by one. Thus nc=v+1, proving C. Also na≥v=nc−1>nc−2, proving B. A fails for w=c, where both a and b counts are 0; D also fails for c, whose c count is 1 and b count 0.

2. Explanation and checks. Each binary rule contributes one b and creates one additional S requiring eventual termination by a c-rule. Starting with one S therefore requires exactly one more terminating c-rule than binary rules. Unary aS rules can add any extra a’s without changing b or c counts. Consequently na−nb equals their nonnegative number; it may be zero, so A’s strict inequality is too strong. In B the weaker strict bound still holds because na≥nc−1 is an integer stronger than na>nc−2.

Original paper, page 36 · Answer key

2 marks · NAT
Not in GATE 2027 syllabusReport issue

Average time for randomly located disk sectors

Secondary Storage

Question 53, GATE 2024: A disk rotates at 6000 RPM, has average seek time 5 ms, 500 sectors/track, and 512 bytes/sector. A file occupies 3000 randomly located sectors. Using average rotational latency, estimate total read time in seconds to two decimals.
Tap to enlarge
Answer & solution

Official answer: 29.50 to 30.50

Our answer: 30.06

Approach: For each random sector add average seek, half a revolution, and one-sector transfer time.

1. Derivation. At6000RPM one revolution takes 60/6000=0.01s=10ms. Mean rotational latency is 5ms; one of 500 sectors transfers in 10/500=0.02ms. Using a separate average seek and rotational wait for each randomly placed sector gives 3000×(5+5+0.02)ms=30060ms=30.06s. This is an average random-read estimate, not a guaranteed realized time; cache, scheduling and correlated sector positions are not modeled.

2. Explanation and checks. At 100 revolutions/s the entire track passes in 0.01 seconds. A sector is 1/500 of that track, so its transfer time is 0.00002 seconds. The sector byte count cancels if transfer speed is computed as 500×512 bytes per revolution and divided into a 512-byte request. Because locations are random, the intended model charges seek and rotation for every sector rather than only once for a contiguous file. The derived 30.06 lies inside the preserved official acceptance range 29.50–30.50.

Original paper, page 37 · Answer key

2 marks · NAT
Report issue

Window size in the third RTT after a timeout

Transport, Congestion Control & Traffic Shaping

Question 54, GATE 2024: A TCP connection has congestion window 12 MSS when a timeout occurs. All segments in the next two RTTs are acknowledged successfully. Under textbook timeout slow start, what is the congestion window during the third RTT, in MSS?
Tap to enlarge
Answer & solution

Official answer: 4

Step through it (4 steps)

Approach: Distinguish the window used during an RTT from its value after that RTT’s acknowledgements.

1. Derivation. Under the standard timeout slow-start model, a timeout sets ssthresh to half the old congestion window, 6MSS, and resets cwnd to 1MSS. The first subsequent RTT uses 1 and its successful ACKs grow cwnd to 2; the second uses 2 and grows it to 4. Thus during the third RTT cwnd is 4MSS, still below the threshold. This assumes the textbook one-MSS post-timeout reset and per-round doubling.

2. Explanation and checks. The timeout halves the threshold, not the new sending window: ssthresh becomes 6 while cwnd restarts at 1. Thus the three rounds begin with windows 1,2,4 respectively. Doubling the third round’s window to 8 would describe a later update, and would also require handling the threshold transition. The requested third round begins below ssthresh, so that boundary detail does not affect the answer. This is the stipulated textbook congestion-control model, not a universal statement about every modern TCP implementation.

Original paper, page 37 · Answer key

2 marks · NAT
Report issue

Collision detection requires round-trip propagation time

Medium Access & Ethernet

Question 55, GATE 2024: An Ethernet segment transmits at 10^8 bits/s, has maximum length 500 m and signal propagation speed 2×10^8 m/s. What theoretical minimum frame length in bits permits collision detection?
Tap to enlarge
Answer & solution

Official answer: 500

Approach: Ensure that the sender is still transmitting when a worst-case collision indication returns.

1. Derivation. The one-way propagation delay is 500/(2×10⁸)=2.5μs. To detect a collision originating at the far end, transmission must continue for at least the round-trip delay 5μs. At10⁸bits/s this requires 10⁸×5×10⁻⁶=500 bits. This is the theoretical collision-detection minimum from the supplied parameters, not the separate standardized512-bit Ethernet minimum.

2. Explanation and checks. A distant node may begin transmitting just before the first signal reaches it. Evidence of that collision must then travel back to the original sender, making the worst-case duration approximately twice the one-way propagation delay. Frame transmission time L/R must therefore satisfy L/R≥2d/v, or L≥2dR/v. Substituting gives 500 bits. Using only the one-way delay yields 250 bits and can let the sender finish too early to detect the collision.

Original paper, page 37 · Answer key

2 marks · NAT
Report issue

Count disjoint nonempty sides of a functional dependency

Functional Dependencies & Keys

Question 56, GATE 2024: On a schema of four attributes, call X→Y useful when X and Y are both nonempty and X∩Y=∅. How many different such dependencies are possible?
Tap to enlarge
Answer & solution

Official answer: 50

Approach: Assign each attribute to the left side, right side, or neither, then exclude empty sides.

1. Derivation. For each of four attributes choose membership in X, membership in Y, or neither: 3⁴ assignments enforce disjointness. Exclude assignments with X empty (2⁴) and Y empty (2⁴), then restore the all-neither assignment counted twice. The number is 3⁴−2⁴−2⁴+1=81−16−16+1=50. This counts possible syntactic dependencies, not dependencies that necessarily hold on a particular instance.

2. Explanation and checks. An alternative count chooses the size k of X: sum from k=1 to 3 of C(4,k)(24−k−1). For k=1 there are 4×7=28 choices; k=2 gives 6×3=18; k=3 gives 4×1=4, totaling 50. X→Y and Y→X are different dependencies because direction matters. Multiattribute right sides are allowed by the definition; restricting Y to a single attribute would answer a different question.

Original paper, page 37 · Answer key

2 marks · NAT
Report issue

Allocate fixed-width instruction fields

Instructions & Addressing Modes

Question 57, GATE 2024: A 32-bit instruction contains opcode, addressing-mode field, two register operands, and a 16-bit scalar. The processor has 16 general-purpose registers and 8 addressing modes. What maximum number of opcodes is possible for each mode?
Tap to enlarge
Answer & solution

Official answer: 32

Approach: Reserve enough binary codes for each independent fixed-width field, then count the remaining opcode patterns.

1. Derivation. Each of 16 registers requires 4 bits, so the two register fields use 8 bits. Eight addressing modes require 3 bits and the scalar field uses 16. The opcode therefore has 32−8−3−16=5 bits, supporting 2⁵=32 unique opcodes for each mode under the separate fixed-field format.

2. Explanation and checks. A register identifier uses ceil(log2 16)=4 bits even though an operand value may occupy many more bits. The two fields therefore cost eight bits, not sixteen or thirty-two. The mode field needs ceil(log2 8)=3 bits. After allocating these and the scalar there are five opcode bits. The question asks per addressing mode, so the eight mode patterns are not multiplied into the number of distinct opcode-field encodings.

Original paper, page 37 · Answer key

2 marks · NAT
Report issue

Compute speedup from effective CPI

Pipelining & Hazards

Question 58, GATE 2024: A nonpipelined 2 GHz unit averages 6 cycles/instruction. A 5-stage redesign at the same frequency ideally achieves 1 instruction/cycle. In program P, 20% of instructions incur 2 stall cycles for data hazards and 20% incur 3 stall cycles for control hazards. Find steady-state speedup to one decimal.
Tap to enlarge
Answer & solution

Official answer: 2.9 to 3.1

Our answer: 3.0

Approach: Add average stall cycles per instruction to ideal CPI and compare elapsed time at equal clock rate.

1. Derivation. The pipelined average CPI is 1+0.20×2+0.20×3=2. Both designs have the same 2GHz frequency, so their steady-state speedup is 6/2=3.0. The5-stage fill/drain overhead is ignored in this throughput model; instruction count is not supplied. Hazard penalties are treated as additive non-overlapped stalls.

2. Explanation and checks. For a conceptual batch of 100 instructions, ideal execution costs 100 cycles, data stalls add 20×2=40, and control stalls add 20×3=60, totaling 200. The old design costs 600 cycles, so the ratio is three. Pipeline depth alone is not the speedup: it affects overlap, while actual CPI includes stalls. No program length is supplied for computing fill/drain effects, and the conventional average calculation treats the stated penalties additively.

Original paper, page 38 · Answer key

2 marks · NAT
Report issue

Count MSTs after contracting forced light edges

Graph Algorithms

Question 59, GATE 2024: Undirected graph vertices a,b,c,d,e,f,g have weight-1 edges ab,af,cd,de; weight-2 edges ag,bg,fg,cg,dg,eg; weight-3 edges bc,fe; and no others. How many distinct minimum-weight spanning trees exist?
Tap to enlarge
Answer & solution

Official answer: 9

Step through it (11 steps)

Approach: Force uniquely lightest cut edges, contract them, then count independent minimum connections.

1. Derivation. Each weight 1 edge (ab, af, cd, de) is uniquely lightest across the cut isolating its noncentral endpoint b, f, c, e, respectively, so all four occur in every MST. Contracting them gives components L={a, b, f}, R={c, d, e}, and{g}. There are three weight 2 choices linking L to g and three linking R to g. A minimum tree uses one of each, giving 3×3=9 distinct MSTs, each weight 4+2+2=8. Weight3 links L–R cannot improve that value.

2. Explanation and checks. After contraction only three supervertices remain, requiring exactly two additional edges. Connecting g to the left component has three distinct original choices; connecting g to the right has another three. Each pair is acyclic and connects all seven original vertices once the four forced edges are restored. Choosing a weight-3 left–right link instead would require at least one further weight-2 edge and yield total at least nine rather than eight. Therefore it cannot contribute an alternative minimum tree.

Original paper, page 38 · Answer key

2 marks · NAT
Report issue

Two-color a graph despite crossing edges

Graph Theory

Question 60, GATE 2024: The diagram has eight marked vertices numbered clockwise from the upper-left corner of its top horizontal edge: 1 top-left,2 top-right,3 upper-right,4 lower-right,5 bottom-right,6 bottom-left,7 lower-left,8 upper-left. Edges are the boundary cycle 12,23,34,45,56,67,78,81 plus 14,16,25,27,36,38,47,58. Unmarked crossings are not vertices. Find the chromatic number.
Tap to enlarge
Answer & solution

Official answer: 2

Approach: Produce a valid coloring and separately show that fewer colors cannot suffice.

1. Derivation. Number the eight marked boundary vertices cyclically. Every drawn edge joins an odd-numbered vertex to an even-numbered one, so alternating two colours is a valid colouring. There is at least one edge, ruling out one colour. Thus the chromatic number is 2.

2. Explanation and checks. The two classes are {1,3,5,7} and {2,4,6,8}. Inspection of the full edge list shows every edge crosses between classes, so no two adjacent vertices share a color under this assignment. In fact the listed graph is K4,4, with all sixteen cross-class edges present. It has edges such as 12, so assigning just one color is impossible. Geometric crossings in a drawing do not imply graph adjacency without marked vertices.

Original paper, page 38 · Answer key

2 marks · NAT
Report issue

Account for a type tag and register fields

Instructions & Addressing Modes

Question 61, GATE 2024: A 32-bit ISA has 150 instructions, 75 each of R-type and I-type, and 50 registers. OPCODE includes a 1-bit type tag plus operation bits. R-type fields: OPCODE, UNUSED, DST, SRC1, SRC2. I-type: OPCODE, DST, SRC, immediate/address. Equal-sized register fields are used. If UNUSED, OPCODE and immediate/address sizes are X,Y,Z, find X+2Y+Z.
Tap to enlarge
Answer & solution

Official answer: 34

Approach: Count the operation bits within each type, add the type bit, then subtract register fields from each format.

1. Derivation. There are 75 operations per instruction type, requiring 7 operation bits plus the 1-bit type tag, so Y=8. Each of 50 architectural registers requires 6 bits. The R-type unused field has X=32−8−3×6=6 bits; the I-type immediate field has Z=32−8−2×6=12 bits. Hence X+2Y+Z=6+16+12=34.

2. Explanation and checks. Six bits encode only 64 operations, insufficient for 75, so seven operation bits are necessary. The one-bit type discriminator brings the full opcode width to eight. Similarly five register bits encode only 32 names, while six accommodate 50. The R-type equation is X+Y+18=32 and the I-type equation is Y+12+Z=32. Adding those equations directly gives X+2Y+Z=64−30=34, which independently checks the field-by-field calculation.

Original paper, page 39 · Answer key

2 marks · NAT
Report issue

Count short strings with odd a-parity

Regular Expressions & Languages

Question 62, GATE 2024: L1 is described by b*ab*(ab*ab*)*. L2 contains all strings over {a,b} of length at most four. How many strings belong to both?
Tap to enlarge
Answer & solution

Official answer: 15

Approach: Interpret the regex structurally before doing a length-by-length count.

1. Derivation. The regular expression has one initial a followed by any number of pairs of a’s, with arbitrary b runs between and around them. It therefore accepts exactly the strings with an odd positive number of a’s. For any positive length ℓ exactly half of the 2^ℓ binary strings have odd a-parity, by flipping one fixed position. Lengths1 through 4 contribute 1+2+4+8=15; ε has even parity and is excluded.

2. Explanation and checks. The one initial a plus any number of pairs makes the a-count odd; the b* runs admit arbitrary b’s before, between and after those a’s. For length 3 the allowable counts are one a or three a’s, giving C(3,1)+C(3,3)=4. For length 4 they give C(4,1)+C(4,3)=8. Lengths 1 and 2 contribute one and two. The empty string has no a and cannot match the mandatory initial a.

Original paper, page 39 · Answer key

2 marks · NAT
Report issue

Self-inverse elements in a product group

Algebraic Structures

Question 63, GATE 2024: Zn is the additive group modulo n. How many elements of Z2×Z3×Z4 are their own inverse?
Tap to enlarge
Answer & solution

Official answer: 4

Approach: Solve 2x=0 modulo the corresponding modulus independently in each coordinate.

1. Derivation. An element is its own inverse exactly when twice it is 0 in each coordinate. Z2 contributes 0, 1 (two choices); Z3 contributes only 0; Z4 contributes 0, 2 (two choices). The product group therefore has 2×1×2=4 such elements.

2. Explanation and checks. The identity element counts: it is always its own inverse. In Z2 both residues satisfy 2x≡0; in Z3 only zero does, because two is invertible modulo three; in Z4 the solutions are zero and two. Explicitly the four product elements are (0,0,0), (0,0,2), (1,0,0), (1,0,2). The coordinate choices multiply because the group operation is coordinatewise, so there is no additional compatibility condition between them.

Original paper, page 39 · Answer key

2 marks · NAT
Report issue

Minimize and maximize two-level page-table storage

Virtual Memory & Paging

Question 64, GATE 2024: A 32-bit byte-addressed system uses 4 KiB pages and 4-byte PTEs. Each process receives one outer directory page. Inner table pages are allocated only when they hold a valid mapping. A process accesses 2000 distinct pages and none is swapped out. Let X and Y be minimum and maximum total page-table pages over both levels. Find X+Y; do not count data pages.
Tap to enlarge
Answer & solution

Official answer: 1028

Approach: Compute how many data-page mappings each inner table can hold and how many inner tables the directory can address.

1. Derivation. A4KB table page holds 4096/4=1024 entries. The32-bit address divides into 10 outer-index bits, 10 inner-index bits and 12 offset bits, allowing 1024 inner table pages. Minimum table storage for 2000 mapped pages packs them into ceil(2000/1024)=2 inner pages plus the allocated outer page: X=3. Maximum spreads mappings across all 1024 distinct outer entries, possible with 2000 pages, giving Y=1024+1=1025. Thus X+Y=1028. Data pages themselves are not counted.

2. Explanation and checks. To achieve the minimum, map 1024 data pages through one outer entry and the remaining 976 through a second. To achieve the maximum, use at least one data page in each of the 1024 outer regions; the remaining 976 accesses can fall in regions already used. This construction shows the upper bound is attainable, not just theoretical. An outer entry does not itself map one data page: it selects an entire inner table, so counting 2000 table pages would be incorrect.

Original paper, page 40 · Answer key

2 marks · NAT
Report issue

Compute an LR(0) GOTO closure

Parsing & Syntax Analysis

Question 65, GATE 2024: Augmented grammar: S′→S; S→SS | Aa | bAc | Bc | bBa; A→d#; B→@. Terminals are a,b,c,d,#,@. I0=CLOSURE({S′→·S}). For an SLR parser, how many items are in GOTO(I0,S)?
Tap to enlarge
Answer & solution

Official answer: 9

Step through it (3 steps)

Approach: Move dots over S only where S immediately follows the dot, then close the resulting item set.

1. Derivation. The initial closure contains S′→·S and S→·SS, plus the other four S-start items and A→·d#, B→·@. GOTO on S shifts the first two into S′→S· and S→S·S. The latter requires closure under S, adding all five S-start items: ·SS, ·Aa, ·bAc, ·Bc, ·bBa. Closure of their leading A/B adds A→·d# and B→·@. The total is 2+5+2=9 distinct LR(0) items; SLR FOLLOW sets do not change this item-set construction.

2. Explanation and checks. The full resulting set is S′→S·; S→S·S; S→·SS; S→·Aa; S→·bAc; S→·Bc; S→·bBa; A→·d#; B→·@. The item S→·SS does not generate endlessly many items: closure is a set and revisiting the same production adds no duplicate. Terminals b,d,@ do not cause further closure expansion. Both # and @ are explicitly terminals here, so neither denotes epsilon or the end marker. FOLLOW sets govern SLR reduction entries, not this GOTO construction.

Original paper, page 40 · Answer key