GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 2022

65 questions

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

03:00:00
1 mark · MCQ
Report issue

Vocabulary & Verbal Analogies

Question 1, GATE 2022: Choose the words that complete “The ___ is too high for it to be considered ___.” A fair/fare; B faer/fair; C fare/fare; D fare/fair.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Fare is the price charged; fair means reasonable or equitable. A fare may be too high to be considered fair, so D.

First identify the two grammatical roles: the first blank names a charge, while the second describes whether that charge is reasonable. “Faer” is not the required English word. Interchanging the homophones changes the meanings rather than improving the sentence.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Geometry & Spatial Aptitude

Question 2, GATE 2022: Find the area under y(x) on [0,1], where y=2 on [0,1/3), y=3 on [1/3,3/4), and y=1 on [3/4,1]. A 5/6; B 6/5; C 13/6; D 6/13.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Integrate each constant piece: area=2(1/3)+3(3/4−1/3)+1(1−3/4)=2/3+5/4+1/4=13/6. The values at the breakpoints do not affect area. Thus C.

The three rectangle widths are 1/3, 3/4−1/3=5/12, and 1/4. Multiply widths by their respective heights before adding; averaging 2,3,1 without weighting would be wrong because the intervals differ in length.

Original paper, page 2 · Answer key

1 mark · MCQ
Report issue

Algebra, Equations & Number Patterns

Question 3, GATE 2022: If r is either root of x²+2x+6=0, evaluate (r+2)(r+3)(r+4)(r+5). A 51; B −51; C 126; D −126.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The root satisfies r²=−2r−6. Pair the factors as (r+2)(r+4)=4r+2 and (r+3)(r+5)=6r+9. Their product is 24r²+48r+18=−126. The calculation holds for either complex root, so D.

Reduction modulo the root equation avoids finding complex roots. Expanding the chosen pairs gives r²+6r+8=4r+2 and r²+8r+15=6r+9. On multiplying, the remaining r terms cancel after substituting r²=−2r−6.

Original paper, page 3 · Answer key

1 mark · MCQ
Report issue

Data Interpretation & Logical Reasoning

Question 4, GATE 2022: There is at least one student. Statements are 1: all students are inquisitive; 2: some are inquisitive; 3: none is inquisitive; 4: some are not inquisitive. Which offered pair cannot both be true? A (1,3); B (1,2); C (2,4); D (3,4).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Statements 1 and 3 assert that all students are inquisitive and no student is inquisitive. With at least one student, they cannot both hold. All and some can coexist, as can no and some-not. Therefore A.

To refute simultaneous truth of 1 and 3, pick an existing student: statement 1 assigns inquisitiveness and statement 3 denies it. The existence condition matters because universal statements about an empty class would both hold. Pair (2,4) is possible with one inquisitive and one noninquisitive student.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Geometry & Spatial Aptitude

Question 5, GATE 2022: Starting with plates A and D, select three more plates that permit a five-letter palindrome using every plate exactly once. In-plane rotation is allowed. Normalizing the displayed rotations, the choices contain A: D,D,J; B: R,A,R; C: Z,E,D; D: I,L,Y. In the source, the second D of A, A and last R of B, E of C, and L of D are rotated 180 degrees.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Rotate the upside-down A and R in B by 180 degrees. The five plates then contain A, A, R, R, D, permitting RADAR, which reads identically in both directions. Rotations suffice; no reflection or replacement of a plate is needed. Thus B.

In any odd-length palindrome, all letter counts except the center letter must be even. B supplies two A plates and two R plates overall, leaving D as center. The other choices have more than one odd-count letter after accounting for rotations, so cannot fill both symmetric pairs.

Original paper, page 5 · Answer key

2 marks · MCQ
Report issue

Reading Comprehension & Verbal Reasoning

Question 6, GATE 2022: A passage says metrics improve outcomes in organizations with good work culture but can be counterproductive with poor culture. Which inference follows? A useful with poor culture; B useful with good culture; C always counterproductive with good culture; D never useful with good culture.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

The passage criticizes using metrics without attention to workplace culture, rather than rejecting metrics altogether. Its supported conclusion is that metrics are useful when supported by a good work culture, B.

Separate the two conditional claims. Good culture supports beneficial metrics; poor culture supports gaming or counterproductive incentives. B repeats the supported good-culture conclusion, while A contradicts the poor-culture claim and C,D contradict the good-culture claim.

Original paper, page 6 · Answer key

2 marks · MCQ
Report issue

Arithmetic, Ratios & Percentages

Question 7, GATE 2022: Boys comprise 65% of entrance-test candidates and girls the other 35%. Among qualified candidates, 60% are girls. Choose the valid inference: A equal boys and girls qualified; B equal numbers appeared; C fewer boys appeared; D fewer boys qualified.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Girls are 60% of the qualified candidates, so boys are 40% of that group. Therefore fewer boys than girls qualified, D. The 65% male share among those appearing does not change this direct comparison or determine absolute counts.

Let the total qualifiers be q. Then girls=0.60q and boys=0.40q, so girls exceed boys by 0.20q. The appearance percentages apply to a different denominator and must not be substituted for qualifier percentages.

Original paper, page 7 · Answer key

2 marks · MCQ
Report issue

Counting, Probability & Sets

Question 8, GATE 2022: A box initially holds 3 green and 2 orange balls. A drawn green is removed; a drawn orange is replaced by another orange. After one draw, what is the unconditional probability that the second draw is orange? A 1/2; B 8/25; C 19/50; D 23/50.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Condition on the first draw. If green is drawn (3/5), it is removed and the next orange probability is 2/4. If orange is drawn (2/5), it is replaced and the next orange probability remains 2/5. Thus P(second orange)=3/5·2/4+2/5·2/5=23/50, D.

The first-draw cases are disjoint and exhaustive, so the law of total probability applies. The second-draw probability after green is higher because only the denominator falls, whereas after orange the complete original composition is restored. Thus the answer must lie between 0.4 and 0.5; 0.46 passes this check.

Original paper, page 8 · Answer key

2 marks · MCQ
Report issue

Geometry & Spatial Aptitude

Question 9, GATE 2022: Assign P,Q,R,S,T,U bijectively to a triangle's three corners and three side midpoints. PR is parallel to QS; T is a corner and P is on its opposite side; S and U share no side. Which must hold? A P is not a corner; B S is not a corner; C U is not a midpoint; D R is not a corner.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

S cannot be a corner. If S is corner A, U must be the midpoint of opposite side BC: every other marked point shares a side with A. By reflection take T=B, so P is C or the midpoint of AC. Testing the remaining placements of Q and R shows that PR cannot be parallel to AQ. Hence S must be a midpoint. For an explicit valid assignment use corner coordinates A=(0, 0), B=(2, 0), C=(0, 2), with midpoints M_AB, M_BC, M_AC: (P, Q, R, S, T, U)=(A, M_AB, C, M_BC, B, M_AC). Here PR and QS are vertical, P and R are corners, and U is a midpoint, refuting the other three offered restrictions. Thus B. An exhaustive check of all 720 assignments independently gave 30 valid assignments, all with S a midpoint.

To test a proposed arrangement, compare direction vectors rather than slopes, since vertical lines are valid. Two vectors are parallel exactly when their determinant is zero. The exhibited assignment satisfies all three constraints while showing that each of A,C,D can fail; the corner-S case eliminates the only alternative to B.

Original paper, page 9 · Answer key

2 marks · MCQ
Report issue

Geometry & Spatial Aptitude

Question 10, GATE 2022: Partition a plot into four similar shapes, not necessarily equal areas, retaining two fixed ropes. Reconstruct the diagram with unit integer-grid poles, x right/y down: boundary (0,0),(5,0),(6,1),(6,6),(1,6),(0,5), and all integer lattice points inside/on it. Fixed ropes are (0,4)–(2,4) and (4,0)–(4,2). A straight rope may pass through intermediate collinear poles. Minimum additional straight ropes? A 2; B 4; C 5; D 3.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Our answer: D under the pole-to-pole full-partition model

Use unit pole spacing, x right and y down. The boundary is (0, 0),(5, 0),(6, 1),(6, 6),(1, 6),(0, 5). Existing ropes are (0, 4)–(2, 4) and (4, 0)–(4, 2). Add (2, 4)–(2, 6), (4, 2)–(6, 2), and (2, 4)–(4, 2), the last through (3, 3). The four pieces are similar clipped squares: two have side 2 with corner-cut legs 1, and two have side 4 with corner-cut legs 2. This proves three ropes suffice and matches official D. For minimality under the pole-to-pole full-boundary-partition interpretation, an exhaustive exact-rational check enumerates all 47 poles and 1019 non-boundary straight segments. Of 9395 two-rope pairs that connect both existing interior rope ends, 528 yield four faces and none yield four mutually similar polygons; one rope never yields four faces. Similarity is checked using cyclic complex edge-ratio signatures, allowing reflection. The checker uses exact rational intersections, orientation ordering, and edge-ratio signatures. This proves the finite pole-to-pole model, not a general arbitrary-endpoint variant. The three-rope construction passes the same test.

The four polygons can be reconstructed from the boundary and the listed new segments. The two small pieces have area 2²−1²/2=3.5 each, and the two large pieces area 4²−2²/2=14 each. Their total 35 matches the original 6×6 square minus two half-unit corner triangles. Similarity follows from scaling lengths by two, with rotation/reflection as needed; areas therefore scale by four. The exact enumeration is a finite-model lower-bound certificate, not a replacement for stating the allowed endpoints.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Asymptotic Analysis & Recurrences

Question 11, GATE 2022: For positive functions f(n), identify the universally valid statement under its specified restriction: A f(n²)=Θ(f(n)²) if f is polynomial; B f(n²)=o(f(n)²); C f(n²)=O(f(n)²) if f is exponential; D f(n²)=Ω(f(n)²).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

For a positive polynomial of degree d with leading coefficient c>0, f(n²)~c n2d and f(n)²~c² n2d, so they are Θ-equivalent, A. B fails with f(n)=n. C fails with f(n)=2n, since 2n²/22n diverges. D fails with f(n)=log n, since 2log n/(log n)² tends to zero.

The ratio f(n²)/f(n)² tends to 1/c for a degree-d polynomial, a positive finite constant, which is exactly enough for a Θ comparison. In B the ratio for n is 1 rather than tending to zero. In C the ratio is 2n²−2n, unbounded. In D use log(n+1) if positivity is required even at n=1; the ratio still tends to zero.

Original paper, page 11 · Answer key

1 mark · MCQ
Report issue

Regular Expressions & Languages

Question 12, GATE 2022: An NFA has nonfinal start s and final states u,v. Transitions: s—a→u, s—b→v, u—b→u and s, v—a→v and s; no other transitions. Choose its regular expression (plus means union): A ab*bab*+ba*aba*; B (ab*b)*ab*+(ba*a)*ba*; C (ab*b+ba*a)*(a*+b*); D (ba*a+ab*b)*(ab*+ba*).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Each return to the nonaccepting start state consumes either ab*b through the upper accepting state or ba*a through the lower one. Any number of such excursions may occur. Finally the path must stop in an accepting state, consuming ab* or ba*. Thus the language is (ba*a+ab*b)*(ab*+ba*), D.

A useful state-elimination decomposition is a sequence of complete excursions back to s, then one final unfinished excursion into u or v. Since s is nonaccepting, the final factor must consume at least one symbol; option C incorrectly admits ε. Option B disallows mixing the two types of returning excursion before the last segment.

Original paper, page 11 · Answer key

1 mark · MCQ
Report issue

Parsing & Syntax Analysis

Question 13, GATE 2022: Choose the true statement: A LALR(1) cannot introduce reduce/reduce conflicts absent from LR(1); B symbol tables are accessed only during lexical analysis; C data-flow analysis is necessary for run-time memory management; D LR(1) parsing suffices for deterministic context-free languages.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Every deterministic context-free language has an LR(1) grammar, so LR(1) parsing is sufficient for these languages, D. LALR merging can introduce reduce-reduce conflicts even when canonical LR has none. Symbol-table information is used beyond lexical analysis, and data-flow analysis is not a necessary runtime step in program execution. The claim is about existence of a suitable LR(1) grammar, not that every grammar of the language is LR(1).

LALR merges canonical states with identical LR(0) cores but potentially different lookahead sets; combining these lookaheads can create a reduce/reduce choice. Symbol tables also serve declaration/type checking, code generation, and optimization. LR(1) sufficiency concerns a grammar for the language, not every arbitrary presentation of it.

Original paper, page 12 · Answer key

1 mark · MCQ
Report issue

Normalization & Decomposition

Question 14, GATE 2022: Which relational-model statement is true under the intended textbook interpretation? A every two-attribute relation is BCNF; B all attributes prime implies BCNF; C every relation has a nonprime attribute; D BCNF decompositions preserve functional dependencies. Discuss any needed qualification.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: A under the nonempty-determinant convention

With two attributes A, B and nonempty determinants, the only potentially nontrivial dependencies are A→B and B→A; either determinant is a key. Thus the relation is BCNF, intended A. All-prime attributes do not suffice: R(A, B, C) with AB→C and C→B has keys AB and AC but violates BCNF. BCNF decomposition need not preserve all dependencies. Literal qualification: empty determinants are legal in general FD theory. If ∅→A holds in R(A, B) while B varies, ∅ is not a superkey, so this binary relation is not BCNF. Official A therefore needs the usual exclusion of constant-column dependencies, which the prompt does not state.

BCNF requires every determinant of a nontrivial functional dependency to be a superkey. For the three-attribute counterexample, AB and AC each determine all attributes, so all attributes are prime, but C alone determines B without determining A. This also illustrates why “prime” is weaker than the BCNF determinant condition. Keep the empty-determinant exception separate from the intended exam convention.

Original paper, page 12 · Answer key

1 mark · MCQ
Report issue

Arrays & Linked Lists

Question 15, GATE 2022: Reverse the links of an n-node singly linked list using O(1) auxiliary space, e.g. head→a→b→c→NULL becomes head→c→b→a→NULL. What is the best worst-case time? A Θ(n); B Θ(n log n); C Θ(n²); D impossible in O(1) space.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Keep previous, current and next pointers. Save current.next, reverse that link, and advance; at termination previous becomes the head. This uses constant auxiliary space and one pass, O(n). Reversing the links of an arbitrary n-node list requires Ω(n) link changes, so the optimum is Θ(n), A.

Executable pointer pseudocode:
prev=NULL; cur=head;
while(cur!=NULL){ next=cur.next; cur.next=prev; prev=cur; cur=next; }
head=prev;
Loop invariant: prev heads the already reversed prefix and cur heads the untouched suffix; saving next prevents losing the suffix. Only three pointer variables are needed, independent of n.

Original paper, page 13 · Answer key

1 mark · MCQ
Report issue

Hashing

Question 16, GATE 2022: Hash n keys into m slots, using simple-uniform hash function h1 for odd keys and h2 for even keys. Find the expected occupancy of a fixed slot. A m/n; B n/m; C 2n/m; D n/(2m).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

For a fixed slot, each key maps there with probability 1/m under whichever uniform hash function applies to its parity. Summing n indicator expectations gives n/m. Independence between all indicators is unnecessary for this expectation. Thus B.

Let Ii=1 if key i lands in the chosen slot, and 0 otherwise. Occupancy X=ΣIi. Whether i is odd or even, E[Ii]=1/m, so E[X]=ΣE[Ii]=n/m. Using two functions does not double the number of keys or halve the table.

Original paper, page 13 · Answer key

1 mark · MCQ
Report issue

Input/Output, DMA & Interrupts

Question 17, GATE 2022: Which method gives the highest bulk hard-disk-to-main-memory throughput among A DMA; B interrupt-driven I/O; C polling; D programmed I/O?
Tap to enlarge
Your answer
Answer & solution

Official answer: A

DMA transfers a block directly between the device and memory after CPU setup, avoiding a CPU instruction sequence or interrupt per transferred word. For a large transfer it therefore provides the highest throughput among the offered programmed/interrupt-driven methods, A, under the ordinary comparable-hardware model.

With programmed or polling transfer, the CPU repeatedly tests status and moves data. Interrupt-driven transfer avoids continuous polling but still involves servicing the device. DMA amortizes CPU setup over a block and lets its controller perform the memory transfers, which is the relevant advantage for bulk throughput.

Original paper, page 14 · Answer key

1 mark · MCQ
Report issue

Number Systems & Computer Arithmetic

Question 18, GATE 2022: Four-bit registers use two's complement. Which sum overflows? A 1011+1110; B 1100+1010; C 0011+0100; D 1001+1111.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (4 options)

Four-bit two’s-complement integers range from −8 through 7. The sums in A, C, D are −7, 7,−8 and are representable. B computes −4+(−6)=−10, outside the range, so it overflows. Thus B.

Decode a bit pattern with leading 1 by subtracting 16 from its unsigned value. Thus A is −5−2=−7; B is −4−6=−10; C is 3+4=7; D is −7−1=−8. B wraps to 0110 (+6), revealing the sign reversal for a negative-plus-negative sum.

Original paper, page 14 · Answer key

1 mark · MCQ
Report issue

Synchronization & Concurrency

Question 19, GATE 2022: Three infinite threads run on one CPU with binary semaphores. T1 repeats wait(S3); print C; signal(S2). T2 repeats wait(S1); print B; signal(S3). T3 repeats wait(S2); print A; signal(S1). Which initialization forces BCABC… despite arbitrary context switches? A (S1,S2,S3)=(1,1,1); B (1,1,0); C (1,0,0); D (0,1,1).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

T2 waits on S1 and prints B, then signals S3. T1 waits on S3 and prints C, then signals S2. T3 waits on S2 and prints A, then signals S1. Initialize only S1 to 1, with S2=S3=0, to force B→C→A repeatedly. That is C. This assumes ordinary successful semaphore operations and eventual scheduling of enabled threads.

Track the unique token: (1,0,0) enables only T2. Its wait consumes S1 and its signal creates the S3 token; then T1 creates S2; then T3 restores S1. Context switching can delay progress, but cannot permit a different letter while its semaphore is zero.

Original paper, page 15 · Answer key

1 mark · MCQ
Report issue

Linear Algebra

Question 20, GATE 2022: For A of size m×n, B n×m, and C,D n×n, assess 1: tr(AB)=tr(BA), and 2: tr(CD)=tr(DC). A only 1; B only 2; C both; D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

For A of size m×n and B of size n×m, trace(AB)=Σ_iΣ_j A_ij B_ji=Σ_jΣ_i B_ji A_ij=trace(BA). Both products are square even when their sizes differ. Hence both stated equalities hold, C.

Trace only sums diagonal entries, not all entries. (AB)ii=Σj AijBji. Finite sums may be exchanged, and scalar factors commute, giving the diagonal sum of BA. This cyclic identity does not assert AB=BA.

Original paper, page 16 · Answer key

1 mark · MCQ
Report issue

Pointers & Memory

Question 21, GATE 2022: Find the output of this ANSI C main body: int x=1,z[2]={10,11}; int *p=NULL; p=&x; *p=10; p=&z[1]; *(&z[0]+1)+=3; printf("%d, %d, %d\n",x,z[0],z[1]); return 0; (stdio.h included). A 1,10,11; B 1,10,14; C 10,14,11; D 10,10,14.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Initially x=1 and z={10, 11}. Assigning 10 through p=&x changes x to 10. After p points to z[1], the expression *(&z[0]+1) denotes that same second element; adding 3 changes it to 14. z[0] stays 10. The printed values are 10, 10, 14, D.

Pointer reassignment changes what p refers to; it does not copy values between x and z. After *p=10, x remains 10 even after p moves. Array pointer arithmetic advances by one int, so &z[0]+1 is &z[1], not a byte address or z[0].

Original paper, page 17 · Answer key

1 mark · MCQ
Report issue

IP Addressing, Fragmentation & Address Resolution

Question 22, GATE 2022: Count internal enterprise subnets in this topology: Internet—firewall; firewall—left router; firewall—top router; top router—right router; top router—web server; left router—Ethernet LAN 1; right router—Ethernet LAN 2. Each LAN has several hosts. Exclude the Internet-facing external link. A 3; B 12; C 6; D 8.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Count the separately routed internal links/LANs: two Ethernet LANs, firewall–left router, firewall–top router, top router–right router, and top router–web server. These are six subnets. The external Internet-facing link is outside the enterprise count. Thus C under the depicted routed-interface model.

A subnet groups interfaces sharing a layer-3 link, not individual computers. Therefore each multi-host Ethernet contributes one, not its host count. The four remaining internal point-to-point/server links each contribute one, making 2+4=6.

Original paper, page 18 · Answer key

1 mark · MSQ
Report issue

Decidability & Computability

Question 23, GATE 2022: Select true statements: A every subset of a recursively enumerable language is recursive; B if L and its complement are recursively enumerable, L is recursive; C the complement of a context-free language is recursive; D the intersection of two regular languages is deterministic context-free.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B,C,D

A is false: a recursively enumerable language such as Σ* can have a subset that is not recursive. B is true because dovetailing recognizers for a language and its complement always finds one acceptance, giving a decider. C is true because CFL membership is decidable and decidable languages are closed under complement. D is true because a DPDA can track a regular-language DFA in its finite control without losing determinism. Thus B, C, D.

For B, alternate one step of each recognizer on the same input. Exactly one must eventually accept, so the procedure always halts with the correct yes/no result. For D, regular languages are closed under intersection using a product DFA; a deterministic PDA can simulate that DFA while ignoring its stack.

Original paper, page 19 · Answer key

1 mark · MSQ
Report issue

Cache Memory

Question 24, GATE 2022: WB and WT are set-associative LRU caches using write-back and write-through respectively. Select FALSE statements: A both need a dirty bit per block; B every WB write hit transfers data to main memory; C WT eviction causes no cache-to-memory transfer; D a WB read miss never evicts a dirty block.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,D

The question asks for false statements. A is false because write-through does not require dirty bits: writes already update memory. B is false because a write-back hit normally only changes the cache and marks the line dirty. C is true: evicting a write-through line needs no extra write-back. D is false because a write-back read miss can evict a dirty victim and consequently write memory. Thus A, B, D.

Dirty means the cached copy differs from memory. A write-back eviction of a clean victim needs no write; a dirty victim must be written before replacement. LRU determines which victim is chosen, not whether it is dirty, so a read operation can indirectly cause a write-back.

Original paper, page 19 · Answer key

1 mark · MSQ
Report issue

Relational Algebra & Calculus

Question 25, GATE 2022: Given Employee(eId,Name), Brand(bId,bName), Own(eId,bId), select expressions returning owners of every brand. Define O=π_eId,bId(Own), E=π_eId(Own), B=π_bId(Brand), H=π_bId(Own). Options: A π_eId(O÷B); B E−π_eId((E×B)−O); C π_eId(O÷H); D π_eId((E×H)÷B).
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B

Our answer: A,B under the standard division candidate universe

A divides the employee-brand pairs by all brand IDs. B starts with employee IDs occurring in Own and removes those with at least one missing pair from the Cartesian product with Brand. These are the standard equivalent formulations of relational division. C divides only by brands that someone owns, potentially omitting unowned brands; D manufactures ownership pairs by a Cartesian product. Thus A, B. Boundary qualification: both A and B use π_eId(Own), not all rows of Employee, as their candidate universe. If Brand is empty and “all brands” is interpreted vacuously for every Employee, employees absent from Own are omitted. The intended nonempty-brand/owner-universe reading should be kept explicit.

For B, E×B enumerates every required owner-brand pair, and subtracting O finds missing ownerships. Projecting to eId identifies failures, which are subtracted from E. For C, one brand absent from all Own tuples is a counterexample: division by H ignores it. D can claim someone owns a brand merely because another employee owns it.

Original paper, page 20 · Answer key

1 mark · MSQ
Report issue

Deadlocks

Question 26, GATE 2022: Select true deadlock statements: A circular wait is necessary; B with multiple instances per resource a wait-for cycle guarantees deadlock; C an unsafe allocation necessarily leads to deadlock; D if all resource-allocation edges are assignment edges, there is no deadlock.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,D

Circular wait is a necessary Coffman condition, so A is true. With multiple instances per resource, a cycle alone need not imply deadlock: an external holder can release an instance and let a waiting process proceed. An unsafe state means some future demands may deadlock, not that deadlock must occur, so C is false. If every resource-allocation edge is an assignment, there are no request edges and therefore no waiting cycle, making D true. Thus A, D under the usual resource-allocation interpretation of the question’s wait-for terminology.

An unsafe state lacks a guaranteed completion sequence for all declared maximum demands; it need not be currently deadlocked. Processes may request less than their maxima or release resources. Without request edges no process is represented as waiting, so assignment-only graphs cannot contain the alternating request/assignment cycle needed for deadlock.

Original paper, page 20 · Answer key

1 mark · MSQ
Report issue

Algebraic Structures

Question 27, GATE 2022: For group G with identity 1, select true statements: A (xy)²=x²y² for all x,y implies commutativity; B x²=1 for all x implies commutativity; C order 2 implies commutativity; D a subgroup of a commutative group need not be commutative.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,C

A gives xyxy=xxyy; multiplying on the left by x−1 and on the right by y−1 gives yx=xy. In B each element is its own inverse, so xy=(xy)−1=y−1x−1=yx. Every group of order 2 is cyclic and hence abelian, proving C. Every subgroup of an abelian group inherits commutativity, so D is false. Thus A, B, C.

For A, x−1(xyxy)y−1=x−1(xxyy)y−1 simplifies to yx=xy; cancellation does not assume the very commutativity being proved. For C, writing G={1,g} forces g²=1 by closure and cancellation, and every product is among these commuting elements.

Original paper, page 21 · Answer key

1 mark · NAT
Report issue

Binary Search & Balanced Trees

Question 28, GATE 2022: A BST with 1000 distinct keys is a complete binary tree, stored in zero-based heap-array positions 0…999. At what index is its third-largest key?
Tap to enlarge
Answer & solution

Official answer: 509

The maximum key lies on the right spine, with zero-based array indices 0, 2, 6, 14, 30, 62, 126, 254, 510. Index 510 has no children because their indices exceed 999. The predecessor is its parent 254. The next predecessor is the maximum in 254’s left subtree, rooted at 509; 509 has no children either. Hence the third largest key is at index 509.

The heap-array formulas are left(i)=2i+1, right(i)=2i+2; they locate nodes, not key ordering. BST ordering implies reverse inorder visits largest first. At 254, the right child is 510 and left child 509. Both are leaves, so the first three reverse-inorder positions are 510,254,509.

Original paper, page 22 · Answer key

1 mark · NAT
Report issue

Parsing & Syntax Analysis

Question 29, GATE 2022: Grammar: S′→S; S→S+R|R; R→R*P|P; P→(S)|id. Let I0={S′→S·, S→S·+R}. Count items in goto(closure(I0),+).
Tap to enlarge
Answer & solution

Official answer: 5

Step through it (3 steps)

Taking goto on + advances S→S·+R to S→S+·R. Closure then adds R→·R*P, R→·P, P→·(S), and P→·id. No dot precedes S in these items, so no further closure is needed. Total 5 items.

Closure only expands a nonterminal immediately after a dot. Initially the dots precede end-of-rule or terminal +, so closure(I0)=I0. After shifting +, R is exposed; recursively expanding R and P yields the five items listed. The left-recursive R production is added once, so closure terminates.

Original paper, page 22 · Answer key

1 mark · NAT
Report issue

Graph Theory

Question 30, GATE 2022: What is the maximum possible edge count of a disconnected simple undirected graph on 10 vertices?
Tap to enlarge
Answer & solution

Official answer: 36

For a disconnected simple graph with 10 vertices, maximize edges by making each component complete. Moving vertices into the largest component increases the sum of binomial(component size, 2), so the maximum uses sizes 9 and 1. This gives binomial(9, 2)=36 edges.

If two nonempty components have a and b vertices, merging them would add ab edges. To keep at least two components while maximizing edges, use one largest possible component and one isolated vertex. Equivalently for a split k and 10−k the complete-component bound is C(10,2)−k(10−k), largest at k=1 or 9.

Original paper, page 22 · Answer key

1 mark · NAT
Report issue

Functional Dependencies & Keys

Question 31, GATE 2022: For R(A,B,C,D,E), dependencies are AB→C, BC→D, C→E. How many superkeys exist?
Tap to enlarge
Answer & solution

Official answer: 8

Step through it (3 steps)

A and B never appear on a dependency’s right side, so every key and superkey must include both. AB determines C, then BC determines D, and C determines E; hence AB is a key. All superkeys are AB with any subset of {C, D, E}, giving 2³=8.

Compute (AB)+: begin {A,B}; AB→C adds C; BC→D adds D; C→E adds E. No set lacking A or B can obtain it from these FDs, proving AB is the unique minimal key. The eight superkeys are AB,ABC,ABD,ABE,ABCD,ABCE,ABDE,ABCDE.

Original paper, page 22 · Answer key

1 mark · NAT
Report issue

Combinatorics & Counting

Question 32, GATE 2022: How many distributions of six identical balls into three identical bins exist, allowing empty bins?
Tap to enlarge
Answer & solution

Official answer: 7

Because both balls and bins are identical, count unordered partitions of 6 into at most three parts. In nonincreasing order they are (6, 0, 0),(5, 1, 0),(4, 2, 0),(4, 1, 1),(3, 3, 0),(3, 2, 1),(2, 2, 2). Therefore 7 distributions, allowing empty bins as stated by the ordinary distribution model.

Sort occupancies a≥b≥c≥0 so each distribution is counted once. For c=0, b ranges 0…3 giving four cases; for c=1, b=1 or 2 gives two; for c=2, only a=b=c=2 gives one. Hence 4+2+1=7. Stars-and-bars would count labeled bins and overcount here.

Original paper, page 22 · Answer key

1 mark · NAT
Report issue

Cache Memory

Question 33, GATE 2022: A cache initially has hit rate 0.8, lookup latency 10 ns and additional miss penalty 100 ns. An optimization increases lookup latency to 15 ns, leaving miss penalty unchanged. What minimum new hit rate prevents AMAT increasing? Round to two decimals.
Tap to enlarge
Answer & solution

Official answer: 0.85

Originally the average access time is 10+(1−0.8)100=30 ns. With the slower 15 ns cache it becomes 15+(1−h)100. Requiring this to be at most 30 gives h≥0.85, so the minimum hit ratio is 0.85. The 100 ns miss penalty is additional to the cache lookup, as in the standard AMAT formula.

Solve 15+100−100h≤30: 100h≥85, hence h≥0.85. At exactly 0.85 the AMAT is 15+15=30 ns. A smaller rate would cause the extra cache latency to outweigh the miss-rate improvement.

Original paper, page 23 · Answer key

1 mark · NAT
Report issue

Calculus

Question 34, GATE 2022: Evaluate lim as x→0 from above of x/(1−e^(2x)).
Tap to enlarge
Answer & solution

Official answer: -0.5 to -0.5

Our answer: -0.5

At x=0 numerator and denominator both vanish. Using e2x=1+2x+O(x²), x/(1−e2x)=x/(−2x+O(x²)) tends to −1/2. Thus −0.5.

Alternatively l’Hôpital gives numerator derivative 1 and denominator derivative −2e2x, yielding −1/2. For small positive x, e2x>1, so the quotient is negative, consistent with the answer.

Original paper, page 23 · Answer key

1 mark · NAT
Report issue

Application Protocols

Question 35, GATE 2022: An uncached DNS resolver iteratively resolves www.gate.org.in. Under the intended separate-delegation model for each domain level, how many query-response pairs are required? Distinguish this convention from what the domain name alone guarantees.
Tap to enlarge
Answer & solution

Official answer: 4

Our answer: 4 under one delegation per named level

In the intended uncached iterative resolution, query the root, then the in server, then org.in, then gate.org.in for the www record. That is four query-response pairs. This counts the resolver’s outbound iterative exchanges, not a separate stub-to-resolver request. Four assumes a separate delegation at every shown domain level and no additional aliases; domain labels alone do not guarantee actual zone boundaries.

The logical exchange sequence is resolver→root (referral to .in), →.in (referral to org.in), →org.in (referral to gate.org.in), →gate.org.in (www address). Each request together with its response counts as one pair, not two. Real deployments can combine labels into one zone, so this is the examination hierarchy assumption.

Original paper, page 23 · Answer key

2 marks · MCQ
Report issue

Recurrences & Generating Functions

Question 36, GATE 2022: For n≥0, a_n=n+1 if n is odd, and 1 otherwise. Find the ordinary generating function. Options all include +1/(1−x): A x(1+x²)/(1−x²)²; B x(3−x²)/(1−x²)²; C 2x/(1−x²)²; D x/(1−x²)².
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Write an=1+n for odd n and 1 for even n. The baseline generating function is 1/(1−x). Also Σ_(odd n≥1) n xn=x d/dx[x/(1−x²)]=x(1+x²)/(1−x²)². Adding gives 1/(1−x)+x(1+x²)/(1−x²)², option A.

The first coefficients are 1,2,1,4,1,6,… . Begin with the all-ones series, then add x+3x³+5x⁵+… . Differentiating x+x³+x⁵+…=x/(1−x²) and multiplying by x produces exactly that odd-index correction. This also checks that the constant coefficient remains 1.

Original paper, page 24 · Answer key

2 marks · MCQ
Report issue

Graph Theory

Question 37, GATE 2022: For a simple undirected unweighted graph on at least three vertices with adjacency matrix A, the triangle count is the trace of which matrix? A A³; B A³/2; C A³/3; D A³/6.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The ith diagonal entry of A³ counts length-three closed walks starting at vertex i. In a simple undirected graph each such walk traverses a triangle. Each triangle contributes three starting vertices and two directions, hence six walks. Therefore the number of triangles is trace(A³)/6, D.

A length-three closed walk i→j→k→i cannot repeat an adjacent vertex because there are no loops, so i,j,k are distinct. Every triangle is counted starting at i,j,k and in each of two orientations: 3×2=6. Dividing by 3 alone would still count both orientations.

Original paper, page 24 · Answer key

2 marks · MCQ
Report issue

Virtual Memory & Paging

Question 38, GATE 2022: Identify the intended FALSE virtual-memory statement: A a TLB searches all valid entries associatively in parallel by virtual page number; B a TLB hit followed by a cache miss guarantees the word is in main memory; C a given inverted page table has identical access time for all virtual addresses; D distinct virtual addresses hashing to the same value necessarily have different memory access times. Retain literal-model qualifications.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Our answer: C in the intended textbook model; D is also overbroad literally

Inverted page-table lookup can scan or follow collision chains of different lengths, so access time is not always identical: C is false. The intended model treats A as a fully associative TLB search and B as a valid, coherent TLB translation implying resident data memory. D is intended to distinguish positions in a serial hash collision chain, but its literal universal claim is not valid: two distinct virtual byte addresses in the same virtual page share the same hashed page entry and may have identical access time. Other collision-resolution and caching implementations also defeat the asserted necessity. Preserve official C, while disclosing that the question needs distinct-page, serial-chain and textbook TLB assumptions to make it uniquely false.

An inverted table has one entry per physical frame and needs to locate a process/virtual-page pair; search or hash-chain length can vary by input. In a serial collision chain, different pages at different positions may take different time, explaining the intended D. But distinct byte addresses with the same page number use the same entry, providing a concrete counterexample to its unqualified wording.

Original paper, page 25 · Answer key

2 marks · MCQ
Report issue

Transactions & Concurrency Control

Question 39, GATE 2022: With Ri(z),Wi(z) denoting transaction i's reads/writes, schedule S is R4(x),R2(x),R3(x),R1(y),W1(y),W2(x),W3(y),R4(y). Choose a conflict-equivalent serial order: A 1,3,4,2; B 1,4,3,2; C 4,1,3,2; D 3,1,4,2.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (10 steps)

Conflicts on x give T4→T2 and T3→T2. Conflicts on y give T1→T3, T1→T4 and T3→T4. Their topological order is T1, T3, T4, T2, option A. Read-read pairs add no edges.

The precedence graph can be drawn as T1→T3→T4→T2, with additional T1→T4 and T3→T2 edges. Each edge enforces the same relative ordering of conflicting operations in a serial schedule. Since this chain orders all four transactions, the topological order is unique.

Original paper, page 25 · Answer key

2 marks · MCQ
Report issue

Combinational Circuits

Question 40, GATE 2022: A 16-bit control word contains mode M, an address for 1024-word memory S, and an address for 32-word register file R. Blocks P,Q select their addressed words; mode-controlled T selects one word to load display register X. Identify P,Q,T: A 10:1 mux,5:1 mux,2:1 mux; B 10:1024 decoder,5:32 decoder,2:1 encoder; C those two decoders and 2:1 mux; D 1:10 demux,1:5 demux,2:1 mux.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Selecting one of 1024 memory words requires a 10-to-1024 decoder P. Selecting one of 32 registers requires a 5-to-32 decoder Q. Mode bit M selects between the two data words through a 2-to-1 multiplexer T. The fields use 1+10+5=16 bits, consistent with the code word.

A decoder expands a binary address into one selected word line; log2(1024)=10 and log2(32)=5 give its input widths. T routes one of two data-word inputs to one output and is therefore a multiplexer, not an encoder. The mode wire is one select bit, making the complete instruction width 1+10+5=16.

Original paper, page 26 · Answer key

2 marks · MCQ
Report issue

Data Representation & Arithmetic

Question 41, GATE 2022: IEEE-754 binary32 register patterns for A,B,C are C1400000,42100000,41400000 (hex). Which is false? A A+C=0; B C=A+B; C B=3C; D B−C>0.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (9 steps)

Decode the binary32 values: 0xC1400000 has sign 1, exponent 130 and significand 1.5, giving −12. 0x42100000 has exponent 132 and significand 1.125, giving 36. 0x41400000 gives 12. Therefore C=A+B is false, since 12≠−12+36=24. The other offered relations hold, so B.

For normalized binary32, value=(−1)^sign ×(1+fraction/223)×2exponent−127. A has unbiased exponent 3 and fraction 0.5: −1.5×8=−12. B has exponent 5 and fraction 0.125: 1.125×32=36. C is +12. Thus A+C=0, B=3C, and B−C=24>0.

Original paper, page 27 · Answer key

2 marks · MCQ
Report issue

CPU Scheduling

Question 42, GATE 2022: P,Q,R,S arrive at time zero in that order. Round-robin quantum is 4. Observed switches include exactly one S→Q, one R→Q, two Q→R and no S→P, counting switches after termination too. Which burst tuple (P,Q,R,S) is impossible? A (4,10,6,2); B (2,9,5,1); C (4,12,5,4); D (3,7,7,3).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

With quantum 4, A, B, C each give execution segments P, Q, R, S, Q, R, Q: P and S finish in their first turn, R in its second, and Q in its third. This yields two Q→R switches, one R→Q and one S→Q. For D, burst times (3, 7, 7, 3) instead give P, Q, R, S, Q, R: Q finishes on its second turn, leaving no final R→Q switch. Thus D cannot produce the stated trace.

For option D the slices have lengths 3,4,4,3,3,3 respectively. The running order P,Q,R,S,Q,R has Q→R twice and S→Q once, but no R→Q. For A the slice lengths are 4,4,4,2,4,2,2, so P,Q,R,S,Q,R,Q satisfies all stated counts. B,C have that same order because Q needs three turns and R two.

Original paper, page 27 · Answer key

2 marks · MCQ
Report issue

Arrays & Strings

Question 43, GATE 2022: An ANSI C program initializes int a[3][3][3]={{1,2,3,4,5,6,7,8,9},{10,11,12,13,14,15,16,17,18},{19,20,21,22,23,24,25,26,27}}; int i=0,j=0,k=0; then for(i=0;i<3;i++){for(k=0;k<3;k++) printf("%d ",a[i][j][k]); printf("\n");}. Find the rows printed. A (1,2,3)/(10,11,12)/(19,20,21); B (1,4,7)/(10,13,16)/(19,22,25); C (1,2,3)/(4,5,6)/(7,8,9); D (1,2,3)/(13,14,15)/(25,26,27).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

The initializer fills the 3×3×3 array in row-major order with 1 through 27. The middle index is fixed at j=0, while i and k vary. The selected values are a[0][0][k]=1, 2, 3; a[1][0][k]=10, 11, 12; a[2][0][k]=19, 20, 21. Thus the output is option A.

The address/value formula for this initializer is a[i][j][k]=9i+3j+k+1. Since j never changes from zero, each outer iteration jumps nine values, while each inner iteration advances one. The newlines occur after the three k values, producing exactly three rows.

Original paper, page 28 · Answer key

2 marks · MCQ
Report issue

Expressions, Operators & Types

Question 44, GATE 2022: ANSI C uses char a='P',b='x'; char c=(a&b)+'*',d=(a|b)-'-',e=(a^b)+'+'; printf("%c %c %c\n",c,d,e). ASCII values P=80,x=120,*=42,−=45,+=43,z=122,K=75,S=83. Choose output: A z K S; B 122 75 83; C * − +; D P x +.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Using the provided ASCII values, a=P=80 and b=x=120. a&b=80, so adding *=42 gives 122, character z. a|b=120, so subtracting -=45 gives 75, character K. ab=40, so adding +=43 gives 83, character S. Thus the output is z K S, option A.

Binary P=01010000 and x=01111000. AND keeps their shared 1 bits (01010000); OR combines them (01111000); XOR keeps differing bits (00101000). The arithmetic uses integer promotions, and the resulting 122,75,83 fit char. %c converts the codes to characters; %d would have printed numbers instead.

Original paper, page 29 · Answer key

2 marks · MCQ
Report issue

Linear Algebra

Question 45, GATE 2022: Solve x1+x2−2x3=4, x1+3x2−x3=7, 2x1+x2−5x3=7 using A=LU, lower/upper triangular L/U. Which tuple (L32,U33,x1) is intended? A (2,−1/2,−1); B (2,2,−1); C (−1/2,2,0); D (−1/2,−1/2,0). No diagonal normalization is explicitly stated in the source.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Our answer: D for unit-diagonal L; C also possible without normalization

Gaussian elimination with unit diagonal L gives L=[[1, 0, 0],[1, 1, 0],[2,−1/2, 1]] and U=[[1, 1,−2],[0, 2, 1],[0, 0,−1/2]]. Solving gives (x1, x2, x3)=(0, 2,−1), so L32=−1/2, U33=−1/2, x1=0, official D. However the source does not specify a unit diagonal for L. Replacing L33 by −1/4 and U33 by 2 keeps LU equal to the original coefficient matrix and leaves L32=−1/2, x1=0. That realizes option C as well. Thus uniqueness depends on the unstated Doolittle normalization; the key is retained with that ambiguity open.

Elimination details: R2←R2−R1 gives [0,2,1|3]; R3←R3−2R1 gives [0,−1,−1|−1]. Then R3←R3+(1/2)R2 gives [0,0,−1/2|1/2]. Back substitution yields x3=−1, x2=2, x1=0. The multipliers 1,2,−1/2 populate a unit-diagonal L only if that convention is imposed.

Original paper, page 30 · Answer key

2 marks · MSQ
Report issue

Decidability & Computability

Question 46, GATE 2022: Select undecidable problems: A equality of languages of two given Turing machines; B whether a given TM language is regular; C whether a TM accepts all strings; D whether a given TM takes more than the fixed printed bound 1073 steps on every string.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,C

Turing-machine language equivalence, regularity, and universality are undecidable semantic properties: fix one machine to recognize Σ* for an equivalence-to-universality reduction, and apply Rice’s theorem to the other two nontrivial language properties. D asks about a fixed finite time bound, printed as 1073. Simulate on the finitely many distinguishable input prefixes/end-marker cases visible within that many steps. This decides whether every input runs longer than the bound; complexity is enormous but finiteness suffices. Thus A, B, C.

A language property is nontrivial when some recognizable languages possess it and others do not. Regularity and universality satisfy this requirement, so Rice applies. Runtime within a fixed number of steps is instead a bounded execution property: only finitely many tape cells can be inspected. An astronomical fixed bound remains finite and does not become the unbounded halting problem.

Original paper, page 31 · Answer key

2 marks · MSQ
Report issue

Regular Expressions & Languages

Question 47, GATE 2022: Over Σ={a,b}, L1={a^n w a^n : w∈Σ*}, L2={w x w^R : w,x∈Σ*, |w|,|x|>0}. Select true statements: A both regular; B both context-free; C L1 regular and L2 context-free; D both context-free but neither regular. The source does not explicitly state the allowed n in L1.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,C

In L1 the arbitrary middle word absorbs all content: if n=0 is allowed, L1=Σ*; if n is required positive, taking n=1 gives aΣ*a. Either reading is regular. L2 consists exactly of strings of length at least 3 whose first and last symbols agree: take w to be the first symbol and x the nonempty middle. Hence L2=aΣ+a ∪ bΣ+b is regular. Both are therefore context-free as well, so A, B, C are true and D is false.

For L2, any allowed decomposition has equal first and last symbols and at least one middle symbol. Conversely if those conditions hold, choose |w|=1 and put everything else in x. Longer equal/reversed boundary strings are optional witnesses, not extra restrictions. This existential choice is why the language is much simpler than a general palindrome language.

Original paper, page 31 · Answer key

2 marks · MSQ
Report issue

Context-Free Grammars & Languages

Question 48, GATE 2022: L1={ww:w∈{a,b}*}, L2={a^n b^n c^m:m,n≥0}, L3={a^m b^n c^n:m,n≥0}. Select FALSE claims: A L1 not context-free, L2/L3 deterministic context-free; B neither L1 nor L2 context-free; C L2,L3 and their intersection all context-free; D neither L1 nor its complement context-free.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B,C,D

The copy language L1={ww} is not context-free: intersecting with a+b+a+b+ gives {aⁱbʲaⁱbʲ: i, j>0}. For pumping length p, aᵖbᵖaᵖbᵖ has any pumping window of length at most p within at most two adjacent blocks. Pumping changes at least one block without changing its matching nonadjacent block, or creates extra alternations, contradicting this language’s form. L2 and L3 are deterministic context-free by pushing one block and matching the adjacent equal-count block; their intersection is {aⁿbⁿcⁿ}, not context-free. Thus A is true and B, C are false. D is also false because the complement of L1 is context-free: include all odd-length words, and for even length choose two different symbols in corresponding half-positions. Let Ea={uav:|u|=|v|} and Eb={ubv:|u|=|v|}; each is context-free via Sa→cS_a d | a for c, d∈Σ, and similarly Sb. E_aE_b ∪ E_bE_a describes exactly the even noncopies, since the two centers differ and are separated by half the total length. Closure under concatenation and union proves the complement claim. Select false statements B, C, D.

For the complement construction, Ea contains odd strings whose center is a and Eb those whose center is b. Concatenating lengths 2r+1 and 2s+1 puts their centers r+s+1 positions apart, exactly half the total length. Thus choosing unequal centers witnesses unequal half-positions. Conversely any mismatching pair in two equal halves determines such a split. Odd-length strings are automatically noncopies and form a regular language.

Original paper, page 32 · Answer key

2 marks · MSQ
Report issue

Graph Algorithms

Question 49, GATE 2022: A simple undirected weighted graph has distinct edge weights. Select true MST claims: A second-lightest edge is always included; B at least one of third/fourth lightest is included; C unique lightest edge across every nontrivial cut is included; D multiple MSTs can exist. Assume existence of an MST and the referenced edges.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,C

Assume an MST exists and the graph has the referenced four edges. Kruskal always accepts the second-lightest edge: with only one accepted edge a simple graph cannot form a cycle. If the third is rejected, the first three edges form a triangle. The fourth cannot be another simple edge inside that already complete triangle, so it is accepted. Thus at least one of the third and fourth edges belongs to the MST. The unique lightest edge crossing any nontrivial cut belongs to every MST by the cut property. Distinct weights imply the MST is unique, making D false. Hence A, B, C. Connectedness and existence of the named edges are implicit in the question’s wording.

The cut property follows by exchange: if an MST omits the unique cheapest crossing edge e, adding e creates a cycle containing another crossing edge f. Since w(f)>w(e), replacing f by e lowers the total, a contradiction. Distinct weights also prove uniqueness by considering the cheapest edge where two proposed MSTs differ.

Original paper, page 32 · Answer key

2 marks · MSQ
Report issue

Graph Theory

Question 50, GATE 2022: For the Petersen graph define vertices v0…v4,u0…u4, with edges vi–v(i+1), vi–ui, ui–u(i+2), subscripts modulo 5. Select true claims: A chromatic number 3; B Hamiltonian path exists; C isomorphic to the alternate source drawing; D maximum independent-set size 3. Reconstruct the alternate drawing by a 9-cycle h0…h8 plus center h9, with extra edges h0–h9,h3–h9,h6–h9,h1–h5,h2–h7,h4–h8.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,C

Label the outer pentagon v0,…, v4 clockwise from the top, and corresponding inner vertices u0,…, u4. Edges are vi-v(i+1), vi-ui, ui-u(i+2), indices modulo 5. A proper three-coloring is v=(0, 1, 0, 1, 2), u=(1, 0, 2, 2, 1); the outer odd cycle rules out two colors. A Hamiltonian path is v0, v1, v2, v3, v4, u4, u1, u3, u0, u2. For the second drawing label its nine perimeter vertices h0,…, h8 clockwise from the top and its central vertex h9. Its extra edges are h0-h9, h3-h9, h6-h9, h1-h5, h2-h7, h4-h8. An edge-preserving bijection maps (v0, v1, v2, v3, v4, u0, u1, u2, u3, u4) to (h0, h1, h2, h3, h9, h8, h5, h7, h4, h6), proving isomorphism. Finally {v0, v2, u3, u4} is independent, disproving the claimed maximum 3. In fact an independent set of 5 in this cubic 10-vertex 15-edge graph would force every edge across that partition, contradicting its odd cycle, so the maximum is 4. Thus A, B, C.

The explicit coloring is a verifiable upper bound, and the outer 5-cycle supplies the matching lower bound of three. A Hamiltonian path need not close back to its start, so the Petersen graph’s lack of a Hamiltonian cycle is irrelevant. The bijection in the solution preserves all fifteen edges, providing a stronger isomorphism witness than matching degrees alone.

Original paper, page 33 · Answer key

2 marks · MSQ
Report issue

Proof Techniques & Number Theory

Question 51, GATE 2022: Given f(1)=1, f(2n)=2f(n)−1, f(2n+1)=2f(n)+1 for n≥1, select identities for positive n: A f(2^n−1)=2^n−1; B f(2^n)=1; C f(5·2^n)=2^(n+1)+1; D f(2^n+1)=2^n+1.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,C

For positive integer n, prove A by induction: f(1)=1, and applying the odd recurrence to 2n+1-1=2(2n-1)+1 preserves f(2n-1)=2n-1. For B, repeated use of f(2m)=2f(m)-1 starting with f(1)=1 yields f(2n)=1. Also f(5)=2f(2)+1=3. Repeated doubling gives f(5*2n)-1=2n(f(5)-1)=2n+1, proving C. D is false: at n=2, f(5)=3 whereas 22+1=5.

A useful closed form is f(m)=2(m−2^⌊log2(m)⌋)+1. It follows by induction on the binary length: the leading 1 determines the power of two, and the even/odd recurrence appends a bit while updating the residual. Substituting m=2n−1,2n,5·2n confirms the three identities and also shows f(2n+1)=3, not 2n+1 for n≥2.

Original paper, page 34 · Answer key

2 marks · MSQ
Report issue

Recurrences & Generating Functions

Question 52, GATE 2022: For the adjacency matrix A of an n-vertex simple undirected unweighted graph, select true statements: A diagonal of A² equals degrees; B connectivity implies A^(n−1)+I has no zero entry; C sum of A's entries ≤2(n−1) implies acyclic; D a 1 in every row/column implies connectivity.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A

The ith diagonal of A squared is sum_j A_ij A_ji=sum_j A_ij, since the matrix is symmetric with binary entries. It therefore equals degree(i), proving A. B fails for the three-vertex path: no length-two walk connects adjacent vertices, so that off-diagonal entry of A2+I is zero. C fails for a triangle plus an isolated vertex: n=4 and the entry sum is 6=2(n-1), yet there is a cycle. D fails for two disjoint edges, which give no zero row or column but are disconnected.

The distinction in B is walks of exactly n−1 edges versus paths of at most n−1 edges. Connectivity guarantees the latter, not the former. Adding I supplies only length-zero diagonal walks; it does not add all smaller powers needed to test reachability. In D, absence of isolated vertices still permits several nontrivial components.

Original paper, page 34 · Answer key

2 marks · MSQ
Report issue

Linear Algebra

Question 53, GATE 2022: Which vectors are eigenvectors of M=[[-9,-6,-2,-4],[-8,-6,-3,-1],[20,15,8,5],[32,21,7,12]]? A (−1,1,0,1); B (1,0,−1,0); C (−1,0,2,2); D (0,1,−3,0).
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,C,D

Multiply each offered vector by the displayed matrix. For A, the result is (-1, 1, 0, 1), equal to the original vector (eigenvalue 1). For B, the result is (-7,-5, 12, 25), not proportional to (1, 0,-1, 0), so B fails. For C the result is (-3, 0, 6, 6)=3(-1, 0, 2, 2), and for D it is (0, 3,-9, 0)=3(0, 1,-3, 0). Thus A, C, D are eigenvectors.

For example, multiplying C row by row gives 9−4−8=−3; 8−6−2=0; −20+16+10=6; −32+14+24=6. Zero coordinates must remain zero in any scalar multiple, so B is immediately ruled out by its second coordinate −5 and fourth coordinate 25.

Original paper, page 35 · Answer key

2 marks · MSQ
Report issue

Cache Memory

Question 54, GATE 2022: An initially empty 2 KB direct-mapped data cache has 64-byte blocks; physical space is 64 KB and words are 16 bits. Access P,Q,R,S in that order ten times, with first-byte addresses 0xA248,0xC28A,0xCA8A,0xA262. Select true statements: A every S hits; B P never evicted after loading; C only R,S remain at the end; D every R evicts Q.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,D

There are 2048/64=32 cache lines. A byte address maps to line (address>>6) mod 32. P and S both lie in the same block from 0xA240 through 0xA27F, mapping to line 9. Q and R map to line 10 but have different tags. Thus the first P loads the P/S block permanently, and every S access hits. Each Q access replaces R (or loads the initially empty line), and every R access replaces Q. At the end the cache contains the P/S block and the R block, so P still resides and C is false. Select A, B, D. Each two-byte word fits inside its block.

The 16-bit physical byte address splits into 5 tag bits, 5 line bits and 6 offset bits. P: line9,tag 20,offset 8; S: line9,tag 20,offset 34; Q: line10,tag 24,offset 10; R: line10,tag 25,offset 10. The first cycle is miss,miss,miss,hit; later cycles are hit,miss,miss,hit. Therefore there are 21 misses and 19 hits across 40 accesses.

Original paper, page 36 · Answer key

2 marks · MSQ
Report issue

Routing Algorithms

Question 55, GATE 2022: Routing entries are 12.20.164.0 mask 255.255.252.0→R1; 12.20.170.0 mask 255.255.254.0→R2; 12.20.168.0 with /23→interface 0; 12.20.166.0 with /23→interface 1; default→R3. Which offered prefixes collectively aggregate the nondefault address set? A 12.20.164.0/20; B 12.20.164.0/22; C 12.20.164.0/21; D 12.20.168.0/22.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B,D

The nondefault entries cover third-octet ranges 164-167, 170-171, 168-169 and 166-167. Their union is exactly 164-171. It is covered by the two aligned prefixes 12.20.164.0/22 (164-167) and 12.20.168.0/22 (168-171), giving B, D. A /21 containing 164 begins at 160 and covers 160-167; a /20 containing it begins at 160 and covers 160-175. The offered /21 and /20 addresses are not canonical network starts and would include extra destinations when masked. This answer describes address-set aggregation, not replacing all forwarding entries with two routes while preserving their different next hops; the more-specific routes are still needed for those next-hop distinctions.

A /22 fixes the top six bits of the third octet, so its network begins on a multiple of four and covers four consecutive values. Ranges 164–167 and 168–171 straddle a /21 boundary and cannot be replaced by the offered /21 without changing the address set. Longest-prefix forwarding details remain distinct from this coverage calculation.

Original paper, page 37 · Answer key

2 marks · NAT
Report issue

SQL & Queries

Question 56, GATE 2022: Student(sNo,sName,dNo): (S01,James,D01),(S02,Rocky,D01),(S03,Jackson,D02),(S04,Jane,D01),(S05,Milli,D02). Dept: (D01,CSE),(D02,EEE). Course(cNo,cName,dNo): (C11,DS,D01),(C12,OS,D01),(C21,DE,D02),(C22,PT,D02),(C23,CV,D03). Register pairs: S01:C11,C12; S02:C11; S03:C21,C22,C23; S04:C11,C12; S05:C11,C21. Count rows returned by SELECT * FROM Student AS S WHERE NOT EXIST (SELECT cNo FROM Course WHERE dNo = “D01” EXCEPT SELECT cNo FROM Register WHERE sNo = S.sNo). The printed spelling/quotes are retained to expose the source syntax issue.
Tap to enlarge
Answer & solution

Official answer: 2

The intended NOT EXISTS test succeeds when the set of D01 courses minus the student's registered courses is empty. The D01 course set is {C11, C12}. Therefore the intended query returns 2 student rows. Source syntax discrepancy: the printed SQL says NOT EXIST, missing the final S, and uses typographic double quotes around D01. Executable standard SQL needs NOT EXISTS and a single-quoted character literal. The official numeric answer assumes these obvious syntax repairs; the literal printed statement is not valid standard SQL.

The missing-D01-course sets are S01:∅, S02:{C12}, S03:{C11,C12}, S04:∅, S05:{C12}. NOT EXISTS accepts only empty sets. A student’s own department is not a filter in the outer query; only coverage of the D01 courses matters.

Original paper, page 38 · Answer key

2 marks · NAT
Report issue

Routing Algorithms

Question 57, GATE 2022: Unit-cost routers form P—Q—R. Distance-vector tables have converged when Q—R fails. P and Q send updates at random times at the same average rate. Find, to one decimal place, the intended probability of a P↔Q loop and count-to-infinity; explain the stochastic assumptions needed.
Tap to enlarge
Answer & solution

Official answer: 0.5

Before failure, P believes R is two hops away via Q, and Q has a one-hop route. After detecting Q-R failure, Q can be misled if P advertises its stale route first: Q installs distance 3 via P while P still routes via Q, forming a loop. If Q announces unreachability first, P removes the route and avoids that loop. In the intended symmetric independent update-race model, either router is equally likely to send first, so the probability is 1/2=0.5. The stated equality of average update rates alone does not mathematically specify this race probability: identical/exchangeable timing distributions and no relevant delivery delay are additional assumptions. The example also assumes ordinary distance vector without split horizon or poisoned reverse; those safeguards change the result.

For independent exponential update clocks of rate λ, P(P sends first)=∫₀∞ λe−λte−λtdt=1/2. Equal mean intervals without identical residual-time distributions do not justify this integral. In the loop, Q installs 3 via P, then P learns 4 via Q, then Q learns 5, illustrating count-to-infinity.

Original paper, page 38 · Answer key

2 marks · NAT
Report issue

Trees & Connectivity

Question 58, GATE 2022: Directed graph on {1,2,3,4,5} has edge i→j exactly when 1≤j≤i≤5. Count directed spanning trees rooted at 5 with directed paths from 5 to every vertex and an undirected underlying tree.
Tap to enlarge
Answer & solution

Official answer: 24

An edge goes only from a larger label to a smaller label, apart from irrelevant self-loops. Every nonroot vertex j in an outward tree must choose exactly one incoming edge from a parent in {j+1,..., 5}. There are respectively 4, 3, 2, 1 choices for j=1, 2, 3, 4. Any such choices form a tree rooted at 5: following parents strictly increases the label and must end at 5, so there are no cycles and every vertex is reached. The total is 4*3*2*1=24.

Self-loops cannot be in a spanning tree. Each nonroot has indegree exactly one in an outward arborescence, so choosing its parent is necessary, not merely sufficient. Exactly four nonloop edges are selected; increasing parent labels ensure all parent chains terminate at the sole root 5 rather than another component.

Original paper, page 39 · Answer key

2 marks · NAT
Report issue

Physical Layer & Transmission

Question 59, GATE 2022: A 100 Mbps earth-to-satellite link spans 2100 km; propagation speed is 3×10^8 m/s. How many milliseconds elapse from starting transmission until a 1000-byte packet is completely received? Round to two decimals.
Tap to enlarge
Answer & solution

Official answer: 7.07 to 7.09

Our answer: 7.08

Propagation takes 2100000/(3*108)=0.007 seconds=7 ms. Serializing 1000 bytes at 100*106 bits per second takes 8000/(100*106)=0.00008 seconds=0.08 ms. Complete reception occurs after one propagation delay plus serialization, not a round trip. Total 7.08 ms lies in the official 7.07-7.09 range.

Use decimal networking units: 100 Mbps=100,000,000 bits/s and 1000 bytes=8000 bits. The first bit arrives at 7 ms; the last bit starts 0.08 ms later and experiences the same propagation delay, arriving at 7.08 ms. Acknowledgment or round-trip delays are not requested.

Original paper, page 39 · Answer key

2 marks · NAT
Report issue

Transport, Congestion Control & Traffic Shaping

Question 60, GATE 2022: TCP sends over 1 Gbps with maximum segment lifetime 60 seconds. What minimum sequence-number bit width avoids wrapping during that lifetime?
Tap to enlarge
Answer & solution

Official answer: 33

TCP sequence numbers identify bytes. At 109 bits per second, the stream uses 109/8=125000000 sequence numbers per second and 7500000000 in 60 seconds. A nonwrapping sequence space must accommodate that many distinct bytes during the MSL. Since 232=4294967296 is too small but 233=8589934592 is enough, 33 bits are required.

The bound is 2b≥rate_in_bytes_per_second×MSL. Taking a ceiling gives b=ceil(log2(7.5×109))=33. Counting bits rather than bytes would give the wrong sequence-space requirement because TCP increments sequence numbers per payload byte.

Original paper, page 39 · Answer key

2 marks · NAT
Report issue

Pipelining & Hazards

Question 61, GATE 2022: X1 runs at 2 GHz, base CPI 1, with 30% branches and two stall cycles per branch. X2 has the same frequency and base CPI, but predicts 80% of branches correctly, eliminating stalls for those; mispredictions keep the same two-cycle penalty. No other hazards occur. Find speedup rounded to two decimals.
Tap to enlarge
Answer & solution

Official answer: 1.42 to 1.45

Our answer: 1.43

Without prediction, CPI1=1+0.30*2=1.6. With 80 percent correct predictions, only 20 percent of branches still pay the two-cycle penalty, so CPI2=1+0.30*0.20*2=1.12. Both processors have the same frequency and execute the same program, giving speedup 1.6/1.12=10/7, or 1.43 to two decimal places. This uses the stated steady-state CPI model, without separately charging pipeline fill/drain.

Speedup is old execution time/new execution time, not new CPI/old CPI. For N instructions at frequency F, times are N·1.6/F and N·1.12/F, so N and F cancel. The branch predictor saves 0.30×0.80×2=0.48 cycles per instruction, reducing CPI from 1.60 to 1.12.

Original paper, page 39 · Answer key

2 marks · NAT
Report issue

Stacks & Queues

Question 62, GATE 2022: Q1 initially contains four elements in front-to-back order 1,2,3,4 and Q2 is empty. Only Enqueue and Dequeue on either queue are permitted, with no extra storage. End with Q1 empty and Q2 front-to-back 4,3,2,1. What minimum number of Enqueue operations on Q1 is necessary?
Tap to enlarge
Answer & solution

Official answer: 0

No enqueue into Q1 is necessary. Move its front item to Q2, then rotate Q2 by moving each of its previously present items from front to back. Starting with Q2 empty, the successive states after these steps are [1], [2, 1], [3, 2, 1], [4, 3, 2, 1]. Each insertion is Enqueue(Q2, Dequeue(Q1)), and rotations are Enqueue(Q2, Dequeue(Q2)); Q1 is never enqueued. Since the count cannot be negative, the minimum is 0. As in the allowed operation model, a dequeued value can be passed directly to enqueue without an auxiliary storage data structure.

Construction using only queue operations: after transferring item k from Q1 to Q2, rotate Q2 exactly k−1 times by Enqueue(Q2,Dequeue(Q2)). Before rotation Q2=[k−1,…,1,k], and afterward [k,k−1,…,1]. Induction establishes reversal after four transfers. The rotations cost enqueues on Q2, which the objective does not count.

Original paper, page 40 · Answer key

2 marks · NAT
Report issue

File Systems

Question 63, GATE 2022: A 100-block file exists in contiguous-allocation system A and linked-allocation system B. Insert one memory-resident block between original blocks 50 and 51. There is enough free space after the contiguous file; file-control blocks are in memory. If the respective disk-access counts are nA,nB, find nA+nB.
Tap to enlarge
Answer & solution

Official answer: 153

For contiguous allocation, shift original blocks 51 through 100 one position to the right, working backward. Each of the 50 blocks is read and written, costing 100 disk accesses; writing the new memory-resident block costs one more, so nA=101. For linked allocation, follow the chain by reading blocks 1 through 50, costing 50 reads. Retain block 50 and its old next pointer in memory, write the new block pointing to original block 51, and rewrite block 50 to point to the new block: two writes, so nB=52. The sum is 153. This is the usual uncached data-block I/O model, with file-control blocks already in memory and no extra metadata-flush charges.

The backward shift in A is essential: forward shifting would overwrite block 52 before reading its original contents. In B, the data of blocks 51…100 stay in place; only the predecessor’s link and new block are written. Traversing 50 blocks rather than reading all 100 is sufficient to locate the insertion point.

Original paper, page 40 · Answer key

2 marks · NAT
Report issue

Virtual Memory & Paging

Question 64, GATE 2022: Four initially empty demand-paging frames use LRU. References: 7,2,7,3,2,5,3,4,6,7,7,1,5,6,1. Find page faults/accesses rounded to one decimal.
Tap to enlarge
Answer & solution

Official answer: 0.6

Step through it (17 steps)

Simulating four LRU frames gives faults at reference positions 1, 2, 4, 6, 8, 9, 10, 12, 13, for the values 7, 2, 3, 5, 4, 6, 7, 1, 5. The other six references hit. In particular, the second consecutive 7 hits, and the last 6 and 1 both remain resident. Hence the fault rate is 9/15=0.6.

Maintain recency oldest→newest after each access: [7]; [7,2]; [2,7]; [2,7,3]; [7,3,2]; [7,3,2,5]; [7,2,5,3]; [2,5,3,4]; [5,3,4,6]; [3,4,6,7]; [3,4,6,7]; [4,6,7,1]; [6,7,1,5]; [7,1,5,6]; [7,5,6,1]. On a full-frame miss remove the oldest before appending; on a hit move the referenced page to newest.

Original paper, page 40 · Answer key

2 marks · NAT
Report issue

Semantic Analysis & Type Checking

Question 65, GATE 2022: Translation grammar: S→S1#T gives S.val=S1.val*T.val; S→T copies T.val; T→T1%R gives T.val=T1.val/R.val; T→R copies R.val; R→id copies integer id.val. Evaluate root S.val for 20#10%5#8%2%2. The source lists an unused nonterminal P as well.
Tap to enlarge
Answer & solution

Official answer: 80

Step through it (28 steps)

The grammar gives % higher precedence than #, with both operators left-associative. Their semantic operations are division and multiplication, respectively, rather than C remainder. The three T values are 20, 10/5=2, and (8/2)/2=2. The left-associative S combination therefore gives (20*2)*2=80. The printed nonterminal list includes an unused P, but no production or calculation depends on it.

The parse groups as (20 # (10 % 5)) # ((8 % 2) % 2). The left recursion in T fixes the latter association, so its value is (8/2)/2=2 rather than 8/(2/2)=8. S’s translation multiplies the three T values: 20×2×2=80.

Original paper, page 41 · Answer key