GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 2023

65 questions

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

03:00:00
1 mark · MCQ
Report issue

English Grammar & Usage

Question 1, GATE 2023: Complete “We reached the station late, and ___ missed the train” using A near, B nearly, C utterly, or D mostly.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Nearly is the adverb meaning almost and correctly modifies missed. Near is not the appropriate adverb in this construction; utterly and mostly do not express narrowly avoiding the event. Thus B.

Teaching detail. The blank modifies the verb “missed”, so the choice must fit both grammar and meaning. “Nearly missed” means they came close to missing the train but did not actually miss it. Being late at the station does not force the conclusion that departure had already occurred. “Near” ordinarily describes location or proximity, “utterly” means completely, and “mostly” means for the greater part; none expresses this near-event relation here.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Vocabulary & Verbal Analogies

Question 2, GATE 2023: Complete the meaning analogy Kind : ___ :: Often : Frequently. Choices: A Mean; B Type; C Cruel; D Kindly. Distinguish a semantic answer from the final official marking outcome.
Tap to enlarge
Your answer
Answer & solution

Official answer: MTA

Our answer: B as a synonym reading; official marks to all

Often and frequently are synonyms. Kind in the sense of category is synonymous with type, making B a defensible semantic answer. However the official key explicitly awards MTA, meaning Marks to All. Preserve that administrative outcome; do not replace it with B or invent a reason for the award.

Teaching detail. An analogy must preserve the same relation on both sides: Often and Frequently have substantially the same meaning. Distinguish the adjective kind (benevolent) from the noun kind (category). The noun reading supports Type; Mean and Cruel are opposites of the adjective, while Kindly changes grammatical form. This analysis does not establish why the organizers awarded marks to all. An official marking decision and a plausible language solution are different facts, and both must remain visible.

Original paper, page 1 · Answer key

1 mark · MCQ
Report issue

Algebra, Equations & Number Patterns

Question 3, GATE 2023: Natural numbers satisfy F(n+1)=F(n)+F(n−1) for n≥2. Given F6=37 and F7=60, find F1. Choices A 4, B 5, C 8, D 9.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Work backward using Fn−1=Fn+1−Fn: F5=60−37=23, F4=37−23=14, F3=23−14=9, F2=14−9=5, F1=9−5=4. Answer A.

Teaching detail. The recurrence is reversible because knowing two consecutive terms determines the preceding term by subtraction. Label each step carefully rather than treating F6 as the sixth Fibonacci number of the usual sequence beginning 1,1. A forward check from 4,5 gives 9,14,23,37,60, reproducing both supplied values. Thus no approximation or closed-form formula is necessary, and the positivity/natural-number condition is respected throughout.

Original paper, page 2 · Answer key

1 mark · MCQ
Report issue

Arithmetic, Ratios & Percentages

Question 4, GATE 2023: A survey says 90% of pregnant women received care at least once before delivery; among those, 60% received care from doctors and 40% from other providers. Which follows certainly: A more than half received doctor care at least once; B less than half did so; C more than half received doctor care at most once; D less than half did so?
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Of all pregnant women, the fraction receiving care from doctors is 0.90×0.60=0.54. Thus more than half received doctor care at least once, proving A. The information does not limit the number of visits, so at-most-once claims do not follow.

Teaching detail. Use 100 hypothetical women to make the conditional percentage concrete: 90 received some care, and 60% of those 90, namely 54, received doctor care. The remaining cared-for group has 36 women, and 10 received no care. The count 54 exceeds 50. “At least once” is not “exactly once”: the same 54 could each have visited one doctor once or many times, so the at-most-once alternatives are not fixed by the survey.

Original paper, page 3 · Answer key

1 mark · MCQ
Report issue

Geometry & Spatial Aptitude

Question 5, GATE 2023: Viewed externally, what is possible for a smooth three-dimensional object's surface? A necessarily concave everywhere; B necessarily convex everywhere; C concave in some regions and convex in others; D sharp edges but no corners.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

A smooth surface can include outward bulges and inward indentations, so it may be convex in some regions and concave in others. Smoothness rules out sharp edges and corners rather than requiring everywhere convex or everywhere concave shape. Answer C.

Teaching detail. Smoothness is a local regularity condition, not a global convexity condition. A rounded object with a smoothly formed dent supplies the required mental model: a bulging exterior region curves outward and the dent curves inward, without a sharp join. A sphere shows that wholly convex surfaces are possible, but it does not show they are compulsory. The question asks what may happen, so a valid smooth counterexample defeats any asserted universal shape constraint.

Original paper, page 3 · Answer key

2 marks · MCQ
Report issue

Reading Comprehension & Verbal Reasoning

Question 6, GATE 2023: In Zombieland, over 75% of workers have serious health issues, and experts identify lack of exercise as a leading cause. The government responds with incentives to cycle to work. Which inference follows: A all workers will cycle; B cycling removes all health issues; C experts recommended mandatory cycling; D the government regards cycling as exercise?
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The intervention is presented as a response to lack of exercise, so the intended inference is that the government treats cycling as physical exercise, option D. Nothing states that everyone will adopt it, that it cures every cause of illness, or that experts recommended compulsion. This is the ordinary policy-purpose reading of the passage rather than a formal proof about hidden beliefs independent of that context.

Teaching detail. Read the strength of each proposed conclusion. A financial incentive encourages behavior but does not logically guarantee universal adoption. The passage identifies exercise deficiency as one leading cause, leaving other causes untreated; it therefore cannot promise complete health. An incentive scheme is also not a mandatory rule, nor does the passage report that experts recommended one. D is the modest inference connecting the stated problem to the stated intervention, which is why the official answer selects it.

Original paper, page 4 · Answer key

2 marks · MCQ
Report issue

Algebra, Equations & Number Patterns

Question 7, GATE 2023: For t>0, f(t)=0.01t² and g(t)=4t. Decide whether (i) g(t)>f(t) for some t>0, and (ii) there is T with f(t)>g(t) for every t>T. A only i; B only ii; C both; D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

For t>0, 4t>0.01t² exactly when t<400; for instance t=1 proves statement(i). Conversely, 0.01t²>4t whenever t>400, so T=400 proves(ii). Both hold, option C.

Teaching detail. Factor the difference f(t)−g(t)=0.01t(t−400). Since t is positive, its sign is the sign of t−400: negative on (0,400), zero at 400, positive after 400. Statement (i) is existential and needs only one witness, while statement (ii) is eventually universal and needs a threshold after which every value works. These statements are compatible: a quadratic can start below a linear function and ultimately dominate it.

Original paper, page 5 · Answer key

2 marks · MCQ
Report issue

Reading Comprehension & Verbal Reasoning

Question 8, GATE 2023: Order these story fragments coherently: (i) reaching the terrace on her way to her corner room, she notices a man; (ii) she pants after climbing the stairs; (iii) Mina bought vegetables and rice, making her bags heavy; (iv) he leans on the parapet watching traffic. Options A i,ii,iv,iii; B ii,iii,i,iv; C iv,ii,i,iii; D iii,ii,i,iv.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The shopping trip explains why the bags are heavy(iii); climbing the stairs produces panting(ii); reaching the terrace introduces the man(i); the final sentence describes him(iv). Thus(iii),(ii),(i),(iv), option D.

Teaching detail. Chronology and pronoun references give independent checks. Fragment iii introduces Mina and the reason for her load. Fragment ii uses “she” naturally after that introduction and places her on the stairs. Fragment i explicitly begins after she reaches the terrace, so it follows the ascent. Fragment iv uses “he”, which needs the man introduced in i. Choosing an opening merely because it is a grammatical sentence misses these links between the sentences.

Original paper, page 6 · Answer key

2 marks · MCQ
Report issue

Algebra, Equations & Number Patterns

Question 9, GATE 2023: For every independent pair of real values x,y, f(x)=g(y). Must A both functions be zero, B both be the same constant, C both be nonconstant, or D f(x)+g(y)=f(x)−g(y)?
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Fix any y0. The premise gives f(x)=g(y0) for every x, so f is constant. Similarly fixing x0 makes g constant, and their constants are equal. They need not be zero. Hence B.

Teaching detail. The key phrase is “for all x and y”, not merely f(x)=g(x) for a common argument. Taking y=0 forces every value of f to equal the single number g(0). Taking x=0 similarly forces every value of g to equal f(0), and those two numbers agree. The common value can be 7, for example, refuting the necessity of zero and of the equality of sum and difference. No continuity or differentiability assumption is needed.

Original paper, page 6 · Answer key

2 marks · MCQ
Report issue

Geometry & Spatial Aptitude

Question 10, GATE 2023: An asymmetric star P has its longest point toward the upper right; Q is P with that point toward the lower right and all features correspondingly rotated; R has Q's top and bottom features interchanged while retaining left/right positions. Identify the two transformations. A clockwise 90° then horizontal-axis reflection; B counterclockwise 90° then horizontal reflection; C clockwise 90° then vertical reflection; D counterclockwise 180° then vertical reflection.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Track the unusually long point: in P it points upper-right, after operation1 in Q it points lower-right, a clockwise 90-degree rotation. Reflecting Q across a horizontal line moves that long point to upper-right in R while preserving its left/right orientation. The other notches and points also agree.

Teaching detail. Use an asymmetric landmark rather than the overall star shape, since symmetric-looking outlines can make rotation and reflection easy to confuse. In Cartesian coordinates centered on the shape, clockwise 90° maps (x,y) to (y,−x); reflection in a horizontal axis maps (x,y) to (x,−y). The first operation changes orientation without reversing handedness, whereas the second reverses handedness. Checking the shorter neighboring points as well as the longest point rules out an accidental single-landmark match.

Original paper, page 7 · Answer key

1 mark · MCQ
Report issue

Compiler Phases, Linking & Loading

Question 11, GATE 2023: Assess compiler statements S1: front-end phases are target-hardware independent; S2: back-end phases are target-hardware specific; S3: back-end phases are specific to the source programming language. A S1 only; B S1,S2; C all; D S1,S3.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

The front end analyzes the source language and produces a target-independent representation, making S1 true. The back end maps that representation to the target instruction set and hardware, making S2 true. Source-language-specific analysis is normally a front-end responsibility rather than a back-end phase, so S3 is false. Thus B.

Teaching detail. Lexical analysis, parsing, and semantic/type analysis must understand source-language rules, but need not know the final processor's register set. Conversely, instruction selection, register allocation, and machine-code generation depend on the target. An intermediate representation is the interface separating these responsibilities. Particular compilers may mix optimizations across this boundary, but the question concerns the standard conceptual division; source-language semantics do not become a back-end-specific phase merely because the back end receives their translated representation.

Original paper, page 8 · Answer key

1 mark · MCQ
Report issue

Heaps & Priority Queues

Question 12, GATE 2023: Which 1-indexed array is a max-heap? A [23,17,10,6,13,14,1,5,7,12]; B [23,17,14,7,13,10,1,5,6,12]; C [23,17,14,6,13,10,1,5,7,15]; D [23,14,17,1,10,13,16,12,7,5].
Tap to enlarge
Your answer
Answer & solution

Official answer: B

In a one-indexed max-heap, A[i] must be at least both A[2i] and A[2i+1] when those children exist. B satisfies all parent-child inequalities: 23≥17, 14; 17≥7, 13; 14≥10, 1; 7≥5, 6; 13≥12. A fails at 10<14, C at 6<7 and 13<15, and D at 1<12. Answer B.

Teaching detail. A heap is only partially ordered: parent keys dominate child keys, but siblings need not be sorted and the array need not be globally descending. There are only five possible parent positions in this ten-element array. For A, index 3 contains 10 and child index 6 contains 14. For C, parent index 4 contains 6 but child 9 contains 7. For D, parent 4 contains 1 but child 8 contains 12. One violation suffices to reject a candidate; every edge must pass to accept B.

Original paper, page 9 · Answer key

1 mark · MCQ
Report issue

Arrays & Linked Lists

Question 13, GATE 2023: Given pointers to a list's head and an arbitrary node to delete, compare worst-case deletion time for singly and doubly linked lists of n nodes. A O(1),O(n); B O(log n),O(log n); C O(1),O(1); D O(n),O(1).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Deleting an arbitrary node of a singly linked list requires locating its predecessor to reconnect the list. In the worst case the target is the tail and this takes a traversal, Θ(n); copying the next node’s value is not a universal solution for the tail. A doubly linked node directly exposes its predecessor and successor, so a constant number of links and possibly the head pointer suffice, Θ(1). Answer D.

Teaching detail. The important missing link in a singly linked node is its predecessor. Knowing the head and the target does not provide that predecessor directly, and freeing the target without redirecting its predecessor would leave a dangling link. For a doubly linked node u, set u.prev.next=u.next and u.next.prev=u.prev when those neighbors exist; handle a head or tail by changing the relevant end pointer. These are bounded operations independent of n. The worst-case claim concerns arbitrary nodes, including the tail.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Finite Automata

Question 14, GATE 2023: A DFA over {0,1} starts in s, accepts only in p, and has transitions s:0→r,1→p; p:0→p,1→q; q:0→r,1→p; r:0→r,1→r. Which expression describes its language? A 1(0*11)*; B 0(0+1)*; C 1(0+11)*; D 1(110*)*.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

The initial 1 enters accepting p; an initial 0 reaches the dead state. At p, 0 loops, while 11 follows p→q→p. A0 at q is rejected, so all accepted suffixes are concatenations of 0 and 11. This gives 1(0+11)*, option C. For example 10 is accepted but not generated by A or D.

Teaching detail. Every accepting run must first consume 1 to reach p. From p there are two ways to return to p without entering the trap: consume a single 0, or consume the pair 11 through q. Any number of these complete return segments is allowed, including none, so the one-letter string 1 is accepted. A suffix ending after the first 1 of a pair stops at nonaccepting q. This run decomposition proves both that every accepted word has the expression's form and that every generated word is accepted.

Original paper, page 11 · Answer key

1 mark · MCQ
Report issue

Recurrences & Generating Functions

Question 15, GATE 2023: The Lucas sequence has L1=1,L2=3 and Ln=L(n−1)+L(n−2). Put α=(1+√5)/2, β=(1−√5)/2, γ=(1−√5)/3. Which is Ln? A αⁿ+βⁿ; B αⁿ−γⁿ; C αⁿ+γⁿ; D αⁿ−βⁿ.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

The characteristic roots of r²=r+1 are α=(1+√5)/2 and β=(1−√5)/2. The sequence αⁿ+βⁿ satisfies the recurrence; at n=1 it is 1, and at n=2 it is(α+β)²−2αβ=1+2=3. These initial values uniquely specify the sequence, so A.

Teaching detail. For a recurrence Ln=L(n−1)+L(n−2), trying a solution rⁿ gives r²−r−1=0. Each root therefore yields a valid exponential sequence, and linear combinations remain solutions. Here α+β=1 and αβ=−1 establish the initial values without numerical square-root calculations. Uniqueness follows inductively: if two sequences agree at positions 1 and 2, their recurrence makes them agree at 3 and then at every later position. Checking only one initial value would not establish the result.

Original paper, page 12 · Answer key

1 mark · MCQ
Report issue

Database Models, Architecture & ER Diagrams

Question 16, GATE 2023: What is a relation's degree or arity? A number of attributes; B number of tuples; C number of entries; D number of distinct attribute domains.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

The degree or arity of a relation is its number of attributes/columns. Its number of tuples is its cardinality, and multiple attributes may share a domain. Therefore A.

Teaching detail. For example, a Student relation with columns rollNum, name, gender, marks has degree 4 whether it contains zero rows or a million rows. Its cardinality changes when rows are inserted, but its arity changes only if the schema's attribute count changes. Two columns can share the same domain, such as two integer-valued attributes, so counting distinct domains can undercount attributes. “Entries” is not the precise schema-level definition sought here.

Original paper, page 13 · Answer key

1 mark · MCQ
Report issue

Data Link, Framing, Error Control & ARQ

Question 17, GATE 2023: Two hosts use stop-and-wait on a point-to-point link. For the same frame size, which combination gives lowest utilization? A longer link/lower bit rate; B longer link/higher bit rate; C shorter link/lower bit rate; D shorter link/higher bit rate.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Ignoring a negligible ACK, stop-and-wait utilization is T_tx/(T_tx+2T_prop)=1/(1+2T_prop R/L) for fixed frame size L. A longer link raises propagation time, and a higher transmission rate R shortens transmission time relative to the wait. Both decrease utilization, so the lowest is B.

Teaching detail. Let L be frame bits, R link bits/second, and d one-way propagation time. The sender spends L/R seconds transmitting, then approximately 2d waiting for propagation and acknowledgment before the next frame. Thus the useful busy fraction is (L/R)/(L/R+2d). Faster transmission can improve absolute throughput while lowering this fraction, because a short burst is followed by the same propagation wait. This distinction between utilization and raw link speed is the main trap in the options.

Original paper, page 14 · Answer key

1 mark · MCQ
Report issue

Linear Algebra

Question 18, GATE 2023: Let A have rows (1,2,3,4),(4,1,2,3),(3,4,1,2),(2,3,4,1). Let B have rows (3,4,1,2),(4,1,2,3),(1,2,3,4),(2,3,4,1). Which holds? A det A=det B; B det B=−det A; C det A=0; D det(AB)=det A+det B.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

B is obtained from A by exchanging rows 1 and 3, which negates the determinant. Direct elimination gives det(A)=−160 and det(B)=160, so neither is zero or equal. Also det(AB)=det(A)det(B)=−25600, not their sum 0. Thus only B.

Teaching detail. A row swap reverses the alternating sign in the determinant definition. It does not depend on the actual values of the other rows, so the visible swap gives the answer immediately. To confirm the exclusions, subtract suitable multiples of row 1 to reduce the determinant to a 3×3 determinant: rows (−7,−10,−13),(−2,−8,−10),(−1,−2,−7) give −160. Determinants multiply under matrix multiplication; they do not add. The explicit nonzero check prevents mistakenly treating A as another true statement.

Original paper, page 15 · Answer key

1 mark · MCQ
Report issue

Lexical Analysis

Question 19, GATE 2023: Identifiers match letter(letter|digit)*, with letter in A–Z or a–z and digit in 0–9. Choose the equivalent ε-NFA: A permits skipping the initial letter and then loops on letters/digits; B after the initial letter branches into an all-letter loop or an all-digit loop; C after the initial letter reaches an accepting hub, from which either a letter or digit branch can be selected by ε-transitions and returned to repeatedly; D after the initial letter repeats letter-then-digit pairs. The source diagrams are linked for exact state layouts.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

A valid identifier begins with one letter and then permits any mixture of letters and digits, including an empty suffix. In C the first letter reaches an accepting state; each repeated epsilon-selected letter/digit branch returns there through the outer epsilon edge. A wrongly accepts epsilon and leading digits; B forces the suffix to be all letters or all digits; D only permits letter-digit pairs after the first letter. Thus C.

Teaching detail. Test a candidate recognizer against boundary cases: a single letter must be accepted, an initial digit must be rejected, and the empty word must be rejected. Then test mixing in the suffix, such as a1b2. The accepting hub of C allows stopping immediately after the first letter and returning after each one-symbol suffix choice. An ε-transition changes state without consuming input; it does not allow an initial digit unless it bypasses the required initial-letter transition. These tests reveal why merely having letter and digit edges somewhere is insufficient.

Original paper, page 16 · Answer key

1 mark · MCQ
Report issue

Hashing & Randomized Algorithms

Question 20, GATE 2023: An adversary chooses k keys for m hash slots, k>m, to maximize collisions. Which strategy best counters a malicious fixed key set: A division with a fixed modulus; B multiplication with a fixed constant; C universal hashing; D choose division or multiplication based on whether k is prime?
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Universal hashing chooses a hash function randomly from a family with a bounded collision probability for distinct fixed keys, preventing an adversary from exploiting one known deterministic mapping. Division and multiplication with fixed constants can be targeted. Thus C under the standard model in which the selected random function is hidden or chosen independently of the adversary’s key set; unrestricted adaptive knowledge would require additional assumptions.

Teaching detail. For a universal family H, each distinct fixed pair x,y has collision probability at most 1/m when h is selected randomly from H. With chaining, the expected number of other keys colliding with a particular key is consequently bounded by (k−1)/m by linearity of expectation. Since k>m, some collisions are unavoidable by the pigeonhole principle: the goal is controlling concentrated collisions, not eliminating them. Random selection must be independent of the malicious fixed keys for this standard guarantee to apply.

Original paper, page 18 · Answer key

1 mark · MCQ
Report issue

Flip-Flops, Registers & Sequential Circuits

Question 21, GATE 2023: A 2:1 multiplexer has its output Q fed to input 0 and external data D at input 1, controlled by S. Is it equivalent to A a D flip-flop; B a D latch; C a half-adder; D a demultiplexer?
Tap to enlarge
Your answer
Answer & solution

Official answer: B

The feedback wire reaches mux input 0 and the external data wire reaches input 1. When S=0 the output feeds itself, holding the stored value; when S=1 the output follows the data continuously. This is a level-sensitive D latch, not an edge-triggered flip-flop.

Teaching detail. The mux equation is Qnext=(NOT S)Q+SD. At S=0 it reduces to Qnext=Q, providing storage through feedback. At S=1 it reduces to Qnext=D, so changes in D can propagate for the whole enabled level. An edge-triggered device would sample only at a clock transition, which this circuit does not implement. Calling the component a latch also assumes ordinary stable operation of the feedback circuit rather than treating its loop as a feed-forward combinational expression.

Original paper, page 19 · Answer key

1 mark · MSQ
Report issue

Processes, Threads & System Calls

Question 22, GATE 2023: During a switch between two threads of the same process, which state needs saving? A page-table base register; B stack pointer; C program counter; D general-purpose registers. Select all applicable options.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C, D

Threads in one process share the same virtual address space, so the page-table base normally need not change. Their stacks, instruction positions, and working register values differ, requiring preservation of stack pointer, program counter, and general-purpose registers. Thus B, C, D in the usual same-process thread model.

Teaching detail. A thread must later resume at its own instruction and restore the register values on which that computation depends. It also needs its own stack pointer because function frames and local storage belong to that thread's call chain. Threads in one process ordinarily share the page tables, so changing only the thread does not require switching the address-space root. Real implementations may save additional architecture-specific state, but that does not alter which of the four listed items are logically thread-specific in the stated model.

Original paper, page 20 · Answer key

1 mark · MSQ
Report issue

Processes, Threads & System Calls

Question 23, GATE 2023: Which events necessarily enter kernel mode from user mode? A ordinary function call; B malloc call; C page fault; D system call. Select all.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C, D

A page fault is an exception handled in kernel mode, and a system call deliberately enters kernel mode. An ordinary function call need not do so. malloc may satisfy a request from already acquired user-space allocator memory and therefore does not always invoke the kernel. Hence C, D.

Teaching detail. The word “guarantee” excludes events that merely sometimes need kernel assistance. A user-space function can manipulate registers and its stack entirely in user mode. A malloc implementation often serves a request from a previously acquired heap arena; only some calls need to request more memory from the operating system. A page fault is a processor exception and transfers control to the kernel fault handler. A system call is the designated controlled entry mechanism for requesting kernel services.

Original paper, page 21 · Answer key

1 mark · MSQ
Report issue

Closure Properties & Language Hierarchy

Question 24, GATE 2023: Which language classes are closed under intersection with another language in the same class? A regular; B context-free; C recursive (decidable); D recursively enumerable (recognizable). Select all.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C, D

Regular intersection uses a product automaton. Decidable-language intersection runs both halting deciders and accepts iff both accept. For recursively enumerable languages, dovetail the recognizers and accept once both have accepted, giving a recognizer. CFL intersection is not closed: {aⁿbⁿcᵐ}∩{aᵐbⁿcⁿ}={aⁿbⁿcⁿ}, which is not context-free. Thus A, C, D.

Teaching detail. For regular languages, a product DFA tracks both component states and accepts only when both components accept. For decidable languages, running the two deciders sequentially terminates, whether the answer is yes or no. For recognizers, a rejecting computation might never terminate, so dovetailing makes explicit that an accepting computation in each recognizer will eventually be observed. The CFL counterexample uses one language checking equality of a's and b's and another checking equality of b's and c's; requiring both produces the standard non-CFL of three equal counts.

Original paper, page 22 · Answer key

1 mark · MSQ
Report issue

Routing Algorithms

Question 25, GATE 2023: Select the incorrect OSPF statements: A it uses Bellman–Ford; B it uses Dijkstra's least-cost paths; C it is an inter-domain protocol; D it supports hierarchical routing.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C

OSPF is a link-state intra-domain routing protocol that applies Dijkstra’s shortest-path algorithm. It also supports hierarchical areas with a backbone. Bellman-Ford is associated with distance-vector protocols, and inter-domain routing is not OSPF’s role. The incorrect statements are A, C.

Teaching detail. OSPF routers distribute link-state information within an autonomous system, build a topology view, and compute shortest paths using Dijkstra. Areas provide hierarchy, normally tied together by a backbone area. Inter-domain routing means routing between autonomous systems and is associated with BGP rather than OSPF. Notice that the question asks for incorrect statements: selecting the two true statements B,D would reverse the answer even if the protocol facts were understood correctly.

Original paper, page 23 · Answer key

1 mark · MSQ
Report issue

Propositional & Predicate Logic

Question 26, GATE 2023: Over integers, the target conjecture is ∀x(P(x)⇒∃y Q(x,y)). Which imply it? A ∃x(P(x)∧∀y Q(x,y)); B ∀x∀y Q(x,y); C ∃y∀x(P(x)⇒Q(x,y)); D ∃x(P(x)∧∃y Q(x,y)).
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

B states Q(x, y) for every pair, so each x satisfying P certainly has a witness y (the integer domain is nonempty). C provides one y working for every qualifying x, a stronger condition than allowing the witness to depend on x. A, D only give information for some x. For a common counterexample take P true at 0 and 1 and Q(x, y) true exactly when x=0: A, D hold, but the conjecture fails at 1.

Teaching detail. To prove the target, start with an arbitrary integer x satisfying P(x) and find a witness y. Under B, every integer y works. Under C, the single promised y works for this x and all other qualifying x. A and D describe only one favorable x, leaving other integers uncontrolled. In the counterexample where P holds at 0 and 1 but Q holds only for first coordinate 0, choosing x=0 makes both existential options true while x=1 defeats the target conjecture.

Original paper, page 24 · Answer key

1 mark · MSQ
Report issue

CPU Scheduling

Question 27, GATE 2023: Which scheduling policies can cause starvation? A FIFO; B round robin; C priority scheduling; D shortest job first. Preserve all answer sets accepted in the official key.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C, D or C, D

Our answer: C;D under finite-burst FIFO; A;C;D also officially accepted

Priority scheduling can indefinitely postpone a low-priority process when higher-priority work keeps arriving. SJF can similarly starve a long job under a continuing supply of shorter jobs. Round robin provides recurring turns under its usual finite-quantum assumptions. Ordinary FIFO with finite earlier jobs does not starve a waiting job, giving C, D. If an earlier nonpreemptive FIFO job never relinquishes the CPU, a later job can wait forever; the official key additionally accepts A, C, D. Preserve both accepted sets rather than silently selecting one.

Teaching detail. Starvation means indefinite postponement despite continuing operation, rather than a long but finite waiting time. Under conventional finite service times, FIFO eventually reaches each queued job, whereas higher priorities or shorter new jobs can repeatedly overtake an eligible job under the other policies. Round robin with finite quanta and the ordinary finite active-set assumptions revisits each ready process. The official acceptance of a second set including FIFO must not be erased by applying only the conventional model. The nonterminating FIFO-job scenario explains one possible model distinction, not an official stated rationale.

Original paper, page 25 · Answer key

1 mark · MSQ
Report issue

Calculus

Question 28, GATE 2023: For f(x)=x³+15x²−33x−36, select true statements: A no local maximum; B a local maximum exists; C no local minimum; D a local minimum exists.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Differentiate: f′(x)=3x²+30x−33=3(x−1)(x+11). The derivative changes from positive to negative at−11 and from negative to positive at 1, giving a local maximum and minimum respectively. Equivalently f″(−11)=−36 and f″(1)=36. Therefore B, D.

Teaching detail. A stationary point alone need not be an extremum, so the sign change or second derivative must be checked. Here f′ is positive for x<−11, negative for −11<x<1, and positive for x>1. Therefore the curve rises then falls at −11 and falls then rises at 1. The second derivative gives the same conclusion since neither value is zero. These are local extrema; an odd-degree cubic is unbounded in both directions and has no global maximum or minimum over all real numbers.

Original paper, page 26 · Answer key

1 mark · MSQ
Report issue

Asymptotic Analysis & Recurrences

Question 29, GATE 2023: For f(n)=n and g(n)=n², select true claims: A f∈O(g); B f∈Ω(g); C f∈o(g); D f∈Θ(g).
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C

f(n)/g(n)=n/n²=1/n tends to 0. Hence f=o(g), which also implies f=O(g). A positive constant lower bound proportional to n² cannot hold for all large n, so f is neither Ω(g) nor Θ(g). Answer A, C.

Teaching detail. The asymptotic definitions distinguish an upper bound from a tight bound. For n≥1, n≤n², so O(g) holds with constant 1. Little-o requires that for every ε>0, n≤εn² for all sufficiently large n; choosing n≥1/ε establishes it. An Ω(n²) lower bound would require 1/n≥c for some fixed c>0 eventually, which is impossible. Since Θ requires both O and Ω, it fails as well. A vanishing ratio is stronger evidence than a few sample comparisons.

Original paper, page 27 · Answer key

1 mark · NAT
Report issue

Graph Theory

Question 30, GATE 2023: An undirected graph on {1,2,3,4,5} has edges {1,2},{2,3},{2,4},{3,5},{4,5}, and self-loops at 3 and 4. Find the sum of the five eigenvalues of its adjacency matrix. Account for the two officially accepted self-loop conventions.
Tap to enlarge
Answer & solution

Official answer: 2 OR 4

Our answer: 2 or 4, according to the self-loop adjacency convention

The sum of eigenvalues equals trace(A). Only the self-loops at vertices 3 and 4 contribute diagonal entries; the other edges do not. If each loop contributes 1 to its adjacency diagonal, the trace is 2. If the undirected-loop convention records 2 on the diagonal to count incidences, the trace is 4. Both exact alternatives are officially accepted: 2 to 2 OR 4 to 4. This is a union of two singleton answers, not the interval from 2 to 4.

Teaching detail. The characteristic polynomial coefficient for the sum of eigenvalues gives trace(A), counting algebraic multiplicity, even without computing individual eigenvalues. Every edge joining two different vertices contributes off-diagonal entries and cannot affect this trace. The only contributions are therefore the two loops. Some adjacency conventions count each loop once, others twice to preserve row-sum degree identities. The official key accepts exactly 2 or exactly 4; 3 is not accepted, despite lying numerically between them. This is why the key must retain separate singleton ranges.

Original paper, page 28 · Answer key

1 mark · NAT
Report issue

Calculus

Question 31, GATE 2023: Evaluate the triple integral of 4x²y−z³ over −3≤x≤3, −2≤y≤2, −1≤z≤1, in the order dz dy dx, rounded to the nearest integer.
Tap to enlarge
Answer & solution

Official answer: 0

The integral is over the symmetric box x∈[−3, 3], y∈[−2, 2], z∈[−1, 1]. The term 4x²y is odd in y and integrates to 0 over its symmetric limits. The term−z³ is odd in z and also integrates to 0. Their sum therefore has integral 0, already an integer.

Teaching detail. One can integrate in the stated order to verify the symmetry shortcut. The z integral of −z³ is zero, while integrating 4x²y over a z-interval of length 2 gives 8x²y. Integrating this over y from −2 to 2 gives zero for every fixed x, and the remaining x integration stays zero. Oddness is used in the variable whose bounds are symmetric; the fact that x² is even causes no problem. No rounding uncertainty remains because the value is exactly zero.

Original paper, page 29 · Answer key

1 mark · NAT
Report issue

Number Systems & Computer Arithmetic

Question 32, GATE 2023: Convert the number (132)₄ to radix 5; enter its base-5 digits.
Tap to enlarge
Answer & solution

Official answer: 110

Step through it (9 steps)

132 base4 equals 1×16+3×4+2=30 decimal. Dividing30 by 5 gives quotient 6 remainder 0, and 6 by 5 gives quotient 1 remainder 1. Thus30=1×25+1×5+0, or 110 base5.

Teaching detail. The digits of a positional numeral are coefficients of powers of the base, starting at exponent zero from the right. Thus the conversion first obtains the underlying integer and then re-expresses it with powers of 5. The final check is 1·5²+1·5+0=30, equal to the original 1·4²+3·4+2. Do not enter 30 as the answer: that is the decimal intermediary, whereas the question requests the digit string in radix 5. All digits of 110 are valid in base 5.

Original paper, page 30 · Answer key

1 mark · NAT
Report issue

Pipelining & Hazards

Question 33, GATE 2023: A hazard-free 3-stage pipeline has stage delays 10,20,14 ns, no other delay, and fetches one instruction per cycle. Find total time in ns for 100 instructions, starting with an empty pipeline.
Tap to enlarge
Answer & solution

Official answer: 2040

The pipeline clock must accommodate the slowest stage, 20 ns. Three stages take 3 cycles for the first instruction, followed by one cycle per additional instruction. Thus100 instructions require 100+3−1=102 cycles and 102×20=2040 ns. There are no extra latch delays or hazard stalls by premise.

Teaching detail. A synchronous pipeline cannot clock each stage at its own independent duration: its common cycle length is bounded by the slowest stage. The first instruction leaves stage 3 after three 20 ns cycles. The remaining 99 instructions then finish one per cycle, so the elapsed time is (3+99)·20. Summing delays to get 44 ns per instruction would describe a different, unpipelined calculation. Multiplying only 100·20 overlooks the two extra fill/drain cycles in the finite batch.

Original paper, page 31 · Answer key

1 mark · NAT
Report issue

Input/Output, DMA & Interrupts

Question 34, GATE 2023: A keyboard produces one keystroke per second. Polling every 10 ms costs 100 μs per poll plus 200 μs per detected keystroke; its CPU-time fraction is T1. Interrupt handling and processing together cost 1 ms per keystroke; its fraction is T2. Find T1/T2 to one decimal place.
Tap to enlarge
Answer & solution

Official answer: 10.2

Polling every 10 ms means 100 polls per second, consuming 100×100μs=10000μs. Processing one keystroke adds 200μs, giving T1=10200μs/second. Interrupt-based processing consumes 1ms=1000μs per second, so T1/T2=10200/1000=10.2.

Teaching detail. Keep all quantities in the same unit before taking the ratio. Each second contains 1000/10=100 polling intervals, even though only one of those intervals typically detects a keystroke. Poll overhead is therefore paid 100 times, whereas keystroke processing is paid once. The fractions are T1=0.0102 and T2=0.001, and division gives 10.2. The interrupt approach's larger cost per event can still be much cheaper overall because it avoids 99 unproductive polling checks.

Original paper, page 32 · Answer key

1 mark · NAT
Report issue

Scope, Lifetime & Storage Classes

Question 35, GATE 2023: In C, funcp has static int x=1, then increments x and returns it. main declares separate int x,y, executes x=funcp(); y=funcp()+x; and prints x+y. What integer is printed?
Tap to enlarge
Answer & solution

Official answer: 7

The static local x in funcp persists across calls. Its first call increments 1 to 2 and returns 2, assigned to main’s x. The second increments the same static value 2 to 3; main’s y becomes 3+2=5. Therefore main prints x+y=2+5=7. The local static and main’s x are distinct objects.

Teaching detail. A static local has block scope but static storage duration: its initialization occurs once, and the stored value survives a return from the function. It is not reinitialized to 1 at each invocation. Track the function's private x separately from main's x to avoid accidental overwriting: after the first call they both happen to equal 2, but the second call changes only the static variable to 3. main's previously stored x remains 2 and participates in both subsequent arithmetic expressions.

Original paper, page 33 · Answer key

2 marks · MCQ
Report issue

Recursion

Question 36, GATE 2023: main calls f1(), f2(2), f3() in that order. f1 returns 1; f3 returns 5. f2(X) first calls f3(), then returns f1() if X==1, otherwise returns X*f2(X−1). Describe its activation tree and identify the matching source option.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Main has three ordered children f1, f2(2), f3. The f2(2) activation first calls f3 and then recursively calls f2(1). That activation calls f3 and, because X=1, calls f1. Thus f2(2) has children f3, f2(1), and f2(1) has children f3, f1.

Teaching detail. An activation-tree node represents one invocation, not one distinct function name. The recursive f2 calls at arguments 2 and 1 therefore occupy different nodes. The ordered tree is main[f1, f2(2)[f3, f2(1)[f3,f1]], f3]. Returning a value does not create another activation, so multiplying by X adds no node. Likewise the final f3 called by main is a sibling of f2, not a descendant. This trace verifies both call nesting and left-to-right sibling order.

Original paper, page 35 · Answer key

2 marks · MCQ
Report issue

Code Optimization & Data-Flow Analysis

Question 37, GATE 2023: The control-flow graph has B1: i=m−1;j=n;a=10; B2: i=i+1;j=j−1; B3: a=20; B4: i=a+1. Edges are entry→B1→B2, B2→B3, B2→B4, B3→B4, B4→B2, and B4→exit. Find the live-variable set at each block exit; no values are used after exit.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Liveness means a current value can be read along some future path before redefinition. B4 computes i from a, then can return to B2, where i and j are read; a can also survive to another B4. Thus OUT(B4)={a, i, j}. Before B4 the old i is killed, so IN(B4)={a, j}, yielding OUT(B3)={a, j}. B2 can reach B4 directly or through B3, so OUT(B2)={a, j}; its updates read i, j, yielding IN(B2)={a, i, j}=OUT(B1). Therefore D.

Teaching detail. Use OUT(B)=the union of IN over successor blocks and IN(B)=USE(B) union (OUT(B)−DEF(B)). Here USE(B2)={i,j}, DEF(B2)={i,j}, USE(B3)=∅, DEF(B3)={a}, USE(B4)={a}, DEF(B4)={i}. The loop requires a fixed point rather than a single backward pass. Crucially j remains live through B4 because the next B2 reads it; old i is killed inside B4 but the newly assigned i is live afterward. Values m,n are used only in B1 and are not live at its exit.

Original paper, page 37 · Answer key

2 marks · MCQ
Report issue

Synchronization & Concurrency

Question 38, GATE 2023: Shared X starts at 10. Five threads each do wait(s); X=X+1; signal(s), and three do wait(s); X=X−1; signal(s). The updates are non-atomic read/modify/write operations. Find minimum final values V1,V2 for a binary semaphore initially 1 and a counting semaphore initially 2. A 15,7; B 7,7; C 12,7; D 12,8.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

With binary semaphore1 the updates are mutually exclusive: V1=10+5−3=12. With counting semaphore2, two updates may overlap. For a witness to V2=7, let one decrement enter and read 10, then pause before its write. Through the second permit run all five increments to completion. Resume the held decrement to overwrite X with 9, then run the other two decrements serially, giving 8 then 7. No value below 7 can arise because a value’s chain of read/write dependencies starts at 10 and contains at most the three decrement operations; increments only increase it. Thus12, 7, option C, under the intended non-atomic read-modify-write interleaving model.

Teaching detail. A semaphore with capacity two limits concurrency but does not make each arithmetic assignment atomic. Two threads can read the same old value and later overwrite each other's results. The witness yielding 7 uses only two simultaneous entrants at any moment: one delayed decrement occupies one permit while all other selected operations use the second. The lower-bound argument follows the ancestry of the final written value, not the total number of writes. Each decrement in that ancestry contributes −1 once at most, and there are only three decrements available.

Original paper, page 39 · Answer key

2 marks · MCQ
Report issue

Context-Free Grammars & Languages

Question 39, GATE 2023: For grammar S→aSb|X and X→aX|Xb|a|b with start S, identify the language: A (a+b)*; B a*(a+b)b*; C a*b*(a+b); D a nonregular language.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

X generates every nonempty string of the form aⁱbʲ: its alternatives prepend a or append b and terminate at a or b. These operations never introduce a b before an a. Wrapping with S→aSb preserves that form and adds no strings beyond those already generated by X. Thus L(G)=a*b* minus epsilon, equivalently a*(a+b)b*, option B. The grammar may be context-free while its generated language is regular.

Teaching detail. For completeness, any aⁱbʲ with i+j≥1 can be derived from X. If i≥1, terminate with a and use i−1 prepending steps plus j appending steps. If i=0 and j≥1, terminate with b and append j−1 further b's. Conversely every X-production preserves the a-before-b ordering and cannot create ε. The S wrapping rule also preserves this ordering and nonemptiness. Hence it neither removes any X-generated word nor introduces a word outside the claimed regular language.

Original paper, page 40 · Answer key

2 marks · MCQ
Report issue

Pushdown Automata

Question 40, GATE 2023: An empty-stack-accepting PDA starts in s with stack ⊥. In s, a/⊥/A⊥ and a/A/AA push one A. Transition s→p and the loop at p are b/A/ε. Transitions s→q and p→q are ε/A/ε. At q, ε/A/ε and ε/⊥/ε empty the stack. Describe its accepted language over {a,b}, consuming all input.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

In s each a pushes A. The first b moves to p and pops A, and further b’s pop more A. Entry to the cleanup state q requires an A at the stack top and pops it, so at least one A must remain after all input has been read. Then q removes the remaining stack symbols, including the bottom marker. Consequently input is aᵐbⁿ with m≥1 and 0≤n<m, option A. Equal counts leave only the bottom symbol in s/p and cannot enter q; epsilon is not accepted.

Teaching detail. After reading m a's, the stack is Am⊥. Reading n b's pops n A's, leaving Am−n⊥. The only gateway to the cleanup state consumes one further A without consuming input, which is possible precisely when m−n≥1. Cleanup cannot read more input, so all a's and b's must already have been consumed. Pure a strings with m≥1 are accepted via s→q; the empty string is not, because no transition from s pops ⊥ directly. The strict inequality n<m, not n≤m, is therefore essential.

Original paper, page 41 · Answer key

2 marks · MCQ
Report issue

Instructions & Addressing Modes

Question 41, GATE 2023: Translate for(i=0;i<10;i++) a[i]=b[i]*8, with 32-bit ints and byte addressing. r1=0,r2=10 and r3,r4 point to a,b. L01 tests r1==r2 and exits; L02 loads from r4; L03 shifts left by U1; L04 stores at r3; L05,L06 add U2,U3 to r3,r4; L07 increments r1; L08 jumps to U4. Find U1,U2,U3,U4.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Multiplication by 8 is a left shift by 3, so U1=3. A32-bit int occupies 4 bytes in the stated byte-addressed memory, so both source and destination pointers advance 4: U2=U3=4. Each iteration must revisit the termination test at L01, making U4=L01. Answer B, under the usual arithmetic range assumptions for this translation.

Teaching detail. The loop counter r1 counts elements, so its increment is one; the address registers count bytes, so their increments differ. Shifting by 3 multiplies a representable nonnegative binary value by 2³, whereas shifting by 8 would multiply by 256. A jump to L02 would skip the test on later iterations and make termination incorrect. Translating signed C shifts or overflow in full generality requires care, but the intended machine-code comparison is element addressing and multiplication by a power of two within the assumed range.

Original paper, page 42 · Answer key

2 marks · MCQ
Report issue

Memory Organization & Address Translation

Question 42, GATE 2023: Four 1 KiB blocks form a 4 KiB byte-addressed memory. External IA4,IA3 select blocks X1,X2,X3,X4 through decoder outputs 00,01,10,11; the other ten address lines feed each block's internal address. Find the external decimal addresses where internal Addr=0 for X1 through X4.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

The internal address lines are all external lines except IA4 and IA3. Internal Addr=0 forces every one of those ten lines to 0. The four blocks are then selected by(IA4, IA3)=00, 01, 10, 11, whose external numeric contributions are 0, 8, 16, 24. Thus C. These are the starts in the interleaved external address map, not contiguous 1024-byte block boundaries.

Teaching detail. The address bits used for selection do not feed the internal address port. Setting internal Addr=0 therefore fixes IA11..IA5 and IA2..IA0 to zero, while leaving IA4,IA3 free to encode the selected block. Their binary place values are 16 and 8. This is an interleaved address mapping: the internal address can change as lower external bits change and block selection can change at bit 3. Assuming the chip-select lines are the two most significant bits would incorrectly produce 0,1024,2048,3072.

Original paper, page 43 · Answer key

2 marks · MCQ
Report issue

Finite-State Machine Design

Question 43, GATE 2023: A synchronous circuit starts at (Q1,Q2,Q3)=(0,1,1). Its first T flip-flop input is NOT Q3, its middle D flip-flop input is Q1, and its third T flip-flop input is Q2; all share one clock. Which state is unreachable? A 001; B 100; C 101; D 111.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

All three flip-flops share the clock. The inspected wiring gives Q1_next=Q1 XOR NOT Q3, Q2_next=Q1, and Q3_next=Q3 XOR Q2. Starting at 011, simultaneous updates give 000→100→010→101→111→110→011, a seven-state cycle. State001 never occurs, while the other offered states 100, 101, 111 do. Thus A. Each update uses old state values, not sequentially updated outputs.

Teaching detail. A D flip-flop copies its input at the active clock edge; a T flip-flop holds when T=0 and toggles when T=1, so its equation is Qnext=Q XOR T. Apply all three equations to the same old state. For initial 011, NOT Q3=0 keeps Q1 at 0, Q2 copies old Q1=0, and Q3 toggles because old Q2=1, giving 000. Continuing until the initial state repeats proves the whole reachable cycle is exhausted; a few sampled clock steps alone would not prove unreachability.

Original paper, page 45 · Answer key

2 marks · MCQ
Report issue

Combinational Circuits

Question 44, GATE 2023: Two 4:1 muxes M1,M2 use select bits (S1,S0)=(A,C) and inputs X0..X3,X4..X7. A final mux selects M1 when B=0 and M2 when B=1. Set all Xi to constants to implement F=NOT A+(NOT A)(NOT C)+A(NOT B)C. Find the eight constants in order.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Both four-input muxes use select bits(A, C), while the final mux selects M1 for B=0 and M2 for B=1. For B=0, evaluating at AC=00, 01, 10, 11 gives 1, 1, 0, 1; for B=1 it gives 1, 1, 0, 0. Therefore(X0,…, X7)=(1, 1, 0, 1, 1, 1, 0, 0), option C.

Teaching detail. The mux address inside each 4:1 block is 2A+C. Thus each Xi is simply the desired output for one combination of A,C, with the block chosen by B. When A=0, the NOT A term forces output 1 irrespective of B,C, giving X0=X1=X4=X5=1. When A=1, the function reduces to (NOT B)C: it is zero for C=0 in both blocks, one only in the B=0,C=1 position. This independently obtains X2=X6=X7=0 and X3=1.

Original paper, page 46 · Answer key

2 marks · MCQ
Report issue

Data Representation & Arithmetic

Question 45, GATE 2023: Multiply binary32 values P=0xC1800000 and Q=0x3F5C2EF4. Which binary32 encoding results? A 0x404C2EF4; B 0x405C2EF4; C 0xC15C2EF4; D 0xC14C2EF4.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

P=0xC1800000 is−16=−2⁴. Q is a positive normal binary32 number with exponent 126 and fraction 0x5C2EF4. Multiplying by−2⁴ flips the sign and raises the biased exponent from 126 to 130, leaving the fraction unchanged. The result is 0xC15C2EF4, option C. Scaling remains within the normal range and is exact.

Teaching detail. A normal binary32 value is (−1)s·(1+fraction/2²³)·2e−127. For P the sign is 1, biased exponent 131, and fraction zero, yielding −16. For Q the sign is 0 and biased exponent 126. Exact scaling by 16 adds four to that exponent, while the negative multiplier changes the sign bit to 1. Packing sign 1, exponent 130, and unchanged fraction 0x5C2EF4 yields the stated hexadecimal word. No significand multiplication or rounding is needed for this power-of-two scaling.

Original paper, page 48 · Answer key

2 marks · MCQ
Report issue

Heaps & Priority Queues

Question 46, GATE 2023: A priority queue of n elements is implemented as a max-heap. What are the worst-case times for Extract-Max (remove maximum and restore heap) and Insert (add key and restore heap)? A both O(1); B both O(log n); C O(1),O(n); D O(1),O(log n).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

A binary heap has heightΘ(log n). Extract-Max removes the root, moves the final element there, and can sift it down the full height. Insertion appends a leaf and can sift it up the full height. Both therefore take O(log n) worst-case time, option B, under the ordinary heap-storage model without charging an occasional external dynamic-array resize.

Teaching detail. Reading a heap's maximum is O(1) because it is at the root, but Extract-Max includes deletion and restoration, which is more work. A replacement root may be smaller than descendants all the way to a leaf, requiring one comparison/swap step per level. A newly inserted large key may similarly rise from its leaf to the root. A complete binary tree has logarithmic height, giving both upper bounds, and such examples attain that height. Neither operation scans all n items in the ordinary representation.

Original paper, page 49 · Answer key

2 marks · MCQ
Report issue

Recursion

Question 47, GATE 2023: The binary tree has root 10, left child 5 with leaves 3,8, and right child 11 with right leaf 13. C function foo(NULL) returns 0; otherwise it evaluates retval=p->val+foo(p->left)+foo(p->right), prints retval, and returns retval. Find the output under the intended left-before-right evaluation, and explain the C-language caveat. Source options include C: 3 8 16 13 24 50.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Our answer: C under left-before-right recursive evaluation; order not fixed by C

Each call returns its subtree sum and prints that sum after both child calls. The leaf sums are 3, 8, 13; the subtree rooted at 5 sums 16; that at 11 sums 24; the root sums 50. If the left recursive operand is evaluated before the right, the output is 3 8 16 13 24 50, official C. However C does not specify operand evaluation order for +. Evaluating the right subtree first can instead print13 24 3 8 16 50, and the two left leaves may also appear in either order. The printed order is therefore not portable as written; the final return value 50 is stable. Preserve the official answer with this missing evaluation-order assumption disclosed.

Teaching detail. For a node u, the return value obeys sum(u)=value(u)+sum(left)+sum(right), with sum(NULL)=0. The print is after both recursive returns, so children print their subtree totals before their parent prints. The left subtree total is 3+5+8=16; the right is 11+13=24; the root is 10+16+24=50. The parenthesization of additions does not impose an evaluation order on function-call operands in C. The key's ordering is therefore an intended traversal convention, not a portable consequence of the written expression.

Original paper, page 50 · Answer key

2 marks · MCQ
Report issue

Combinatorics & Counting

Question 48, GATE 2023: Let U={1,...,n}, n>1000, and disjoint A,B⊆U each have size k>0. Count permutations in which every A-element precedes every B-element or every B-element precedes every A-element; other elements may appear anywhere.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Choose the 2k positions occupied by A∪B in binomial(n, 2k) ways. For A before B, the first k chosen positions receive A in k! orders and the last k receive B in k! orders. The remaining elements occupy other positions in(n−2k)! orders. The reversed block order contributes an equal, disjoint count because k>0. Total 2 binomial(n, 2k)(k!)²(n−2k)!, option D. Existence of the disjoint sets implicitly guarantees 2k≤n.

Teaching detail. A and B need not occupy consecutive positions in the full permutation: unrelated U-elements may be interspersed. After choosing their 2k positions, requiring A before B completely determines which k positions are reserved for each set but leaves internal order free. As an alternative check, all binomial(2k,k) patterns of A/B labels among those positions are equally likely, and exactly two are favorable. Multiplying n! by 2/binomial(2k,k) gives the same expression. When k=1 every permutation qualifies, and the formula correctly reduces to n!.

Original paper, page 51 · Answer key

2 marks · MSQ
Report issue

Sets, Relations & Functions

Question 49, GATE 2023: For surjection f:A→B on nonempty sets, define x~y iff f(x)=f(y), and let E be its equivalence classes. Define F:E→B by F([x])=f(x). Select true claims: A not well-defined; B surjective; C injective; D bijective.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C, D

F is well-defined because all representatives of one class have the same f-value. It is onto because every b∈B has an f-preimage x and hence class[x]. If F([x])=F([y]), then f(x)=f(y), so x~y and[x]=[y], proving injectivity. Therefore F is bijective as well. Answer B, C, D.

Teaching detail. The equivalence classes are exactly the nonempty fibers f−1({b}). Replacing x with another representative of its class cannot change f(x), which proves the mapping is legitimate before discussing injectivity. Surjectivity of the original f ensures that no element of B lacks a fiber. Distinct classes cannot map to the same b, because that would make their representatives equivalent and hence put them in the same class. The construction collapses the only source of noninjectivity of f, turning the induced mapping into a bijection.

Original paper, page 52 · Answer key

2 marks · MSQ
Report issue

Transport, Congestion Control & Traffic Shaping

Question 50, GATE 2023: A TCP-like byte-stream protocol runs at 100 Mbps, RTT 150 ms, and maximum segment lifetime 2 minutes. Which sequence-number field lengths prevent reuse within a segment lifetime at full rate? A 30 bits; B 32; C 34; D 36.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C, D

At100Mbps a byte-stream consumes 100×10⁶/8=12.5×10⁶ sequence numbers per second. During the 120-second maximum segment lifetime it can send 1.5×10⁹ bytes. The sequence space must exceed that count to avoid wraparound while old data can still exist. Since2³⁰≈1.074×10⁹ is too small and 2³¹≈2.147×10⁹ is sufficient, the listed 32-, 34-, 36-bit fields work, but 30 bits does not. Thus B, C, D. RTT affects window sizing, not this lifetime wraparound bound.

Teaching detail. Sequence numbers label bytes, not bits or whole packets, so the conversion from 100 megabits/second to bytes/second is essential. For b bits, wrap time is 2b/(12.5×106) seconds; it must exceed 120 seconds in the intended model. A 30-bit space wraps in about 85.9 seconds, whereas 32 bits lasts about 343.6 seconds. The mathematical minimum is 31 bits, which is absent from the offered choices; that does not make 32 the sole valid answer, because larger listed fields also work.

Original paper, page 53 · Answer key

2 marks · MSQ
Report issue

Algebraic Structures

Question 51, GATE 2023: On the powerset 2^X, define A Δ B=(A−B)∪(B−A). Select true general statements: A (2^X,Δ) is a group; B inverses exist but it is not a group; C the inverse of A is its complement in X; D the inverse of A is A.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, D

Membership in a symmetric difference is exclusive-or of the two membership bits. Thus the operation is closed and associative, the identity is the empty set, and A Δ A is empty for every A. This proves the group property and makes every element its own inverse: A and D. B incorrectly denies the group property. A complement is not generally an inverse: A Δ (X minus A)=X, not the empty identity (except in the degenerate case X empty).

Teaching detail. For each element x∈X, membership in A Δ B is 1 exactly when the two membership bits differ. XOR is associative and commutative, so applying this pointwise establishes those properties for sets, not merely for a sample. The empty set contributes a zero bit everywhere and is the identity. A set XOR itself gives zero everywhere, proving the inverse claim and the group axioms. For nonempty X, taking A=∅ immediately refutes the complement-as-inverse claim: ∅ Δ X=X, not ∅.

Original paper, page 54 · Answer key

2 marks · MSQ
Report issue

Application Protocols

Question 52, GATE 2023: A browser and all DNS servers have empty caches. Resolving a hostname requires iterative queries through three DNS tiers, each costing RTT. Fetching its small HTML reveals ten small same-server objects; all transmission/rendering times are negligible and web-server RTT is identical. Which totals are correct? A 7 RTT for nonpersistent HTTP with five parallel connections; B 5 RTT for persistent pipelining; C 9 RTT for nonpersistent/five parallel; D 6 RTT for persistent/pipelining.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C, D

The three uncached DNS tiers require three sequential round trips. Fetching the base HTML adds one TCP-handshake RTT and one request/response RTT. With non-persistent HTTP and five parallel connections, the ten objects take two batches, each needing two RTTs, so the total is 3+2+4=9 RTTs (C). With a persistent connection and pipelining, all ten object requests share one further RTT after parsing the HTML, giving 3+2+1=6 RTTs (D). This is the stipulated negligible-transmission, classic HTTP-over-TCP model; no extra TLS handshake is included.

Teaching detail. Write a dependency timeline: DNS root, DNS next tier, DNS authoritative lookup, TCP connection for HTML, then HTML request/response. This consumes five RTTs before the browser learns the object URLs. Parallel nonpersistent transfers then require two waves of five, each with a connection RTT and a response RTT. Persistent pipelining reuses the HTML connection and places all ten requests in flight together, requiring just one further RTT. The objects cannot be requested before their references are learned; disregarding that dependency undercounts the total.

Original paper, page 55 · Answer key

2 marks · MSQ
Report issue

Probability & Statistics

Question 53, GATE 2023: Two fair coins are tossed independently. A={HH}, B={HH,HT} (first head), C={HH,TH} (second head). Select true claims: A events A,B independent; B events A,C independent; C events B,C independent; D P(B|C)=P(B).
Tap to enlarge
Select all that apply
Answer & solution

Official answer: C, D

The four outcomes HH, HT, TH, TT are equally likely. P(A)=1/4, P(B)=P(C)=1/2. Since A is a subset of B and of C, P(A intersection B)=P(A intersection C)=1/4, whereas P(A)P(B)=P(A)P(C)=1/8; neither pair is independent. But P(B intersection C)=1/4=P(B)P(C), and P(B given C)=1/2=P(B). Hence C and D.

Teaching detail. Independence asks whether learning one event changes the other's probability, not whether the events overlap. Knowing C leaves the first coin fair, so the two equally likely remaining outcomes HH,TH give P(B|C)=1/2. By contrast, learning A guarantees B, giving P(B|A)=1 rather than P(B)=1/2. The same reasoning applies to C. The direct product checks in the solution are valid because all four outcomes have probability 1/4 under the standard independent fair-coin experiment.

Original paper, page 56 · Answer key

2 marks · MSQ
Report issue

Asymptotic Analysis & Recurrences

Question 54, GATE 2023: Function 1 repeats while n>1: increment x exactly n times, then set n=floor(n/2). Function 2 increments x exactly 100n times. Let their increment counts be f1(n),f2(n) for the original n. Select true claims: A f1∈Θ(f2); B f1∈o(f2); C f1∈ω(f2); D f1∈O(n).
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, D

For integer n at least 2, the first function executes at least n increments and fewer than n+n/2+n/4+...=2n increments. Therefore f1(n)=Theta(n). The second executes exactly 100n increments, also Theta(n). Their ratio stays bounded above and below by positive constants, so A and D hold, while neither little-o nor little-omega holds. The floor in the halving assignment does not change these bounds.

Teaching detail. Do not multiply the outer-loop count Θ(log n) by the original inner-loop length n: the inner length shrinks each time. For n a power of two, the exact count is n+n/2+...+2=2n−2. For arbitrary n, flooring can only reduce the geometric upper bound and the first pass alone supplies the n lower bound for n≥2. Compared with f2=100n, the ratio lies between 1/100 and 2/100. Being a smaller constant fraction is not little-o; little-o needs the ratio to vanish.

Original paper, page 57 · Answer key

2 marks · MSQ
Report issue

Graph Theory

Question 55, GATE 2023: For a simple finite undirected graph, process vertices in a fixed order and assign each the smallest positive color absent from already colored neighbors. With maximum degree Δ, select valid guarantees: A proper coloring; B at most Δ+1 colors; C at most Δ colors; D exactly the chromatic number of colors.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B

When a vertex is colored, its chosen color differs from every already-colored neighbor. Each edge therefore has distinct colors at its endpoints after its later endpoint is processed, proving A. At most degree(v) colors are forbidden, so one of the first degree(v)+1 colors is available, proving B. C fails on any complete graph, which needs Delta+1 colors. D fails for a path a-b-c-d processed in the order a, d, b, c: the colors are respectively 1, 1, 2, 3, although the graph is bipartite and has chromatic number 2.

Teaching detail. The proper-coloring invariant can be proved edge by edge: for every edge uv, whichever endpoint is processed later explicitly avoids the earlier endpoint's color. For the degree bound, a vertex with d neighbors sees at most d distinct forbidden colors, so among colors 1 through d+1 at least one remains. On a complete graph with r vertices, Δ=r−1 but r colors are necessary, refuting C. The four-vertex path example refutes optimality without compromising correctness: greedy remains proper while using an avoidable third color.

Original paper, page 58 · Answer key

2 marks · NAT
Report issue

Graph Algorithms

Question 56, GATE 2023: The vertices of a graph are all eight subsets of {1,2,3}. Distinct vertices are adjacent exactly when one set is a subset of the other. How many different BFS vertex-visit orders can start at ∅, allowing arbitrary neighbor ordering?
Tap to enlarge
Answer & solution

Official answer: 5040

The empty set is a proper subset of every nonempty subset, so it is adjacent to each of the other seven vertices. BFS discovers all seven while scanning the start vertex. Any permutation of those neighbors can be its adjacency order; all seven are already discovered before any is expanded. Thus precisely 7!=5040 visit orders are possible.

Teaching detail. BFS uses a queue and discovers every neighbor of the start before expanding any of those neighbors. Since ∅ is contained in every subset, all other vertices are at distance one. No deeper layer imposes additional order constraints. Choosing any desired permutation of the seven neighbors as the start's adjacency-list order produces exactly that traversal after the fixed initial ∅. Thus the number is 7!, not 8!; the start position is not free. Later edges cannot create new vertices because all seven are already discovered.

Original paper, page 59 · Answer key

2 marks · NAT
Report issue

Virtual Memory & Paging

Question 57, GATE 2023: Row-major C array int D[128][128] is accessed by for i=0..127, for j=0..127, D[j][i]*=10. A page holds 512 array elements and 30 frames are available under LRU demand paging. Count faults in the intended page-aligned, initially nonresident array model; disclose these implicit assumptions.
Tap to enlarge
Answer & solution

Official answer: 4096

Under the usual page-aligned, initially nonresident array model, one page holds four complete rows because 512/128=4. The inner loop scans down a column and touches 32 pages in order, with four consecutive accesses per page. Only the first access of each four-row group faults. A cyclic traversal of 32 distinct pages with only 30 LRU frames has a miss on each page at every column: the reuse distance is 31 other pages. Hence 128 columns times 32 faults per column gives 4096. The standard answer implicitly assumes the array starts at a page boundary and ignores unrelated memory references. A non-page-aligned placement or a different initial residency can change the count; these are not specified explicitly.

Teaching detail. For aligned storage, element D[j][i] has page number floor((128j+i)/512)=floor(j/4) for each fixed i∈[0,127]. The page stream per column is therefore 0 repeated four times, 1 repeated four times, through 31 repeated four times. Only the first access to each repeated group faults. Between two uses of any page in successive columns are 31 distinct other pages, exceeding the 30-frame capacity, so no page survives until its next reuse. Multiplying 32 by 128 gives the count; multiplying 128² would ignore within-page hits.

Original paper, page 60 · Answer key

2 marks · NAT
Report issue

Virtual Memory & Paging

Question 58, GATE 2023: A 57-bit virtual address uses an L-level tree of page tables. Pages are 4 KiB; each page-table entry is 8 bytes at every level. Find L under the conventional one-page-per-table-node layout.
Tap to enlarge
Answer & solution

Official answer: 5

Step through it (8 steps)

A 4 KiB page has a 12-bit offset. Under the conventional one-page-per-page-table-node layout, each node holds 4096/8=512 entries and contributes 9 index bits. The virtual page number has 57-12=45 bits, requiring L=45/9=5 levels. The page-sized table-node convention is implicit in this standard multilevel-paging calculation.

Teaching detail. The address must be partitioned into a page offset and a sequence of table indexes. Offset bits select one byte within 4096 bytes, so there are 12. Each page-sized table contains 512 entries, whose selection requires 9 bits. Five indexes account for 45 virtual-page bits and, together with the 12-bit offset, exactly cover 57 bits. In cases where this division is not exact, the top-level index can be shorter; here no partial level is needed. The result depends on page-sized table nodes, not merely on entry width alone.

Original paper, page 61 · Answer key

2 marks · NAT
Report issue

Stacks & Queues

Question 59, GATE 2023: Start with empty stack S and queue Q. Push/enqueue 1,5,7,8,9,2 in that order into each. Then pop S, dequeue Q, pop S, dequeue Q. Four times, dequeue Q and push that element into S. Finally pop S twice. What is the remaining top?
Tap to enlarge
Answer & solution

Official answer: 8

Step through it (24 steps)

Write the stack from bottom to top. After the initial pushes it is [1, 5, 7, 8, 9, 2], and the queue front-to-back is [1, 5, 7, 8, 9, 2]. The two pops remove 2 and 9; the two dequeues remove 1 and 5. The stack is then [1, 5, 7, 8] and the queue [7, 8, 9, 2]. Operation VII and its three repetitions append 7, 8, 9, 2 to the stack. The final two pops remove 2 and 9, leaving top element 8.

Teaching detail. Use different ends for the two structures: a stack removes the most recently pushed item, while a queue removes the earliest enqueued one. After the four transfers, the stack bottom-to-top is [1,5,7,8,7,8,9,2] and the queue is empty. Removing its top two entries leaves [1,5,7,8,7,8], whose final entry is 8. Operation VIII says repeat VII three times after its first execution, making four transfers total. Mistaking this for only three transfers changes the trace.

Original paper, page 62 · Answer key

2 marks · NAT
Report issue

Semantic Analysis & Type Checking

Question 60, GATE 2023: Syntax-directed rules: N→I#F gives N.val=I.val+F.val; I→I1 B gives I.val=2I1.val+B.val and I→B copies B.val; F→B F1 gives F.val=(B.val+F1.val)/2 and F→B gives B.val/2; B→0 or 1 takes the bit value. Evaluate 10#011 to three decimals.
Tap to enlarge
Answer & solution

Official answer: 2.374 to 2.376

Our answer: 2.375

Step through it (19 steps)

The I rules interpret the left substring as a binary integer: I(10)=2*1+0=2. Evaluate the fractional suffix from right to left: F(1)=1/2, F(11)=(1+1/2)/2=3/4, and F(011)=(0+3/4)/2=3/8. Thus N.val=2+3/8=2.375, within the official interval 2.374 to 2.376.

Teaching detail. The separator # plays the role of a binary radix point in these semantic rules, not a multiplication or concatenation operator on numbers. The left-recursive integer production multiplies the accumulated prefix by two before appending the next bit. The right-recursive fractional production halves the sum of the current bit and the suffix fraction, placing successive bits at weights 1/2,1/4,1/8. Directly, 10#011 represents 2+0/2+1/4+1/8. This corroborates the synthesized-attribute evaluation and yields an exact terminating decimal.

Original paper, page 63 · Answer key

2 marks · NAT
Report issue

SQL & Queries

Question 61, GATE 2023: Student rows (rollNum,name,gender,marks) are (1,Naman,M,62),(2,Aliya,F,70),(3,Aliya,F,80),(4,James,M,82),(5,Swati,F,65); rollNum is primary key. How many rows does SELECT * FROM Student WHERE gender='F' AND marks>65 return?
Tap to enlarge
Answer & solution

Official answer: 2

The condition requires both female gender and marks strictly greater than 65. Roll numbers 2 and 3 qualify, with marks 70 and 80. Swati has exactly 65 and is excluded; the other two rows are male. The two Aliya rows remain distinct because their roll numbers differ, and SELECT * does not deduplicate them. The result contains 2 rows.

Teaching detail. Evaluate the conjunction row by row: row 1 fails gender, row 2 passes both predicates, row 3 passes both, row 4 fails gender despite high marks, and row 5 fails the strict greater-than test. The primary key identifies records by rollNum, not by name, so equal names do not imply one record. SQL's ordinary SELECT is not SELECT DISTINCT; moreover even DISTINCT over all columns would keep the two qualifying rows because both roll numbers and marks differ. Only the number of qualifying rows is requested.

Original paper, page 64 · Answer key

2 marks · NAT
Report issue

Indexing, Storage & Query Processing

Question 62, GATE 2023: An ordered file has 25,000 unspanned records of 100 bytes, including a 15-byte primary key. Blocks hold 1024 bytes. A sparse primary index has one anchor key and 5-byte block pointer per data block, with unspanned entries. Binary search on b index blocks costs ceil(log2 b) accesses by stipulation. How many accesses identify the candidate data block, without reading that block?
Tap to enlarge
Answer & solution

Official answer: 6

Each data block holds floor(1024/100)=10 unspanned records, so 25000 records occupy 2500 blocks. The sparse primary index has one anchor entry per data block. Each entry occupies 15+5=20 bytes, so an index block holds floor(1024/20)=51 entries and the index needs ceil(2500/51)=50 blocks. By the expressly given search-cost rule, identifying the data-block pointer costs ceil(log2 50)=6 block accesses. Reading that data block would add one more, but the question asks only to identify it.

Teaching detail. Unspanned storage requires rounding at each level before progressing. A block cannot store 10.24 records, so 24 bytes remain unused after its ten full records. Similarly an index block stores 51 complete 20-byte entries, leaving four bytes. There are 2500 data-block anchors, not 25,000 record-level entries, because the index is sparse. Since 49·51=2499, a fiftieth index block is necessary for the final anchor. With 32<50≤64, the stated ceiling-logarithm search rule yields six accesses, excluding the data fetch.

Original paper, page 65 · Answer key

2 marks · NAT
Report issue

Finite Automata

Question 63, GATE 2023: Find the minimum number of states of a complete DFA over {0,1} accepting strings that never contain three consecutive 1s.
Tap to enlarge
Answer & solution

Official answer: 4

Step through it (2 parts)

Use three accepting states tracking the trailing run of ones of lengths 0, 1, 2, and a rejecting trap after the third consecutive one. A zero resets each nontrap state to run length 0; a one advances the run or reaches the trap. All four states are reachable. The trap differs from the others on the empty suffix. For two run lengths i<j among 0, 1, 2, append 3-j ones: the state j rejects but state i still accepts. Thus all four are pairwise distinguishable and the DFA is minimal.

Teaching detail. Name states q0,q1,q2,dead by the count of trailing 1s until a forbidden run has occurred. On 0, q0,q1,q2 go to q0; on 1 they go to q1,q2,dead respectively. dead loops on both symbols because an earlier occurrence of 111 can never be undone by later zeros. q0,q1,q2 accept, including q0 for ε. Reachability witnesses are ε,1,11,111. A construction alone proves an upper bound of four; the distinguishability argument is required to exclude every possible smaller DFA.

Original paper, page 67 · Answer key

2 marks · NAT
Report issue

Cache Memory

Question 64, GATE 2023: An 8-way set-associative cache has 64 KiB data capacity and 32-bit byte addresses divided into tag, set index, and block offset. Find the tag width.
Tap to enlarge
Answer & solution

Official answer: 19

Step through it (4 steps)

For byte addressing, cache data capacity equals associativity times number of sets times bytes per block. Therefore the number of sets times block size is 65536/8=8192=213. The index and block-offset fields together occupy 13 bits regardless of the particular power-of-two block size. The tag has 32-13=19 bits. As usual, the stated capacity is data capacity, excluding tag and replacement metadata.

Teaching detail. Let block size be 2b bytes and the number of sets be 2s. Eight ways means each set stores eight blocks, so 216=23·2s·2b and s+b=13. These lower address bits choose a set and byte within a block; the remaining bits identify which memory block occupies the selected way. Therefore tag width is independent of the unspecified block size, provided the conventional power-of-two partition is used. Associativity bits do not appear as a separate address field selecting a way.

Original paper, page 68 · Answer key

2 marks · NAT
Report issue

Routing Algorithms

Question 65, GATE 2023: Routes are 200.150.0.0/16→1, 200.150.64.0/19→2, 200.150.68.0/24→3, 200.150.68.64/27→4, and default→0. Which interface receives destination 200.150.68.118 under longest-prefix matching?
Tap to enlarge
Answer & solution

Official answer: 3

Step through it (3 steps)

The destination matches 200.150.0.0/16 and 200.150.64.0/19, and it also matches 200.150.68.0/24. The /27 entry 200.150.68.64 covers last-octet values 64 through 95, so it does not match 118. The longest matching prefix is consequently the /24 entry, whose interface ID is 3.

Teaching detail. Check network matches rather than selecting the most specific row unconditionally. The /19 mask fixes the top three bits of the third octet and covers third-octet values 64 through 95, including 68. The /24 fixes the entire third octet to 68. The /27 additionally divides the last octet into groups of 32; its network 64 covers 64..95, whereas 118 lies in 96..127. The /27 is more specific but fails to match, leaving /24 as the longest matching row. The default is used only when no more specific route matches.

Original paper, page 69 · Answer key