GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 2003

90 questions

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

03:00:00
1 mark · MCQ
Report issue

Exponential-series accumulation

Control Flow & Loop Tracing

Question 1, GATE 2003: For large positive integer y, what does this C function approximate?
float f(float x, int y) { float p, s; int i; for(s=1,p=1,i=1; i<y; i++){p*=x/i; s+=p;} return s; }
A. x^y; B. e^x; C. ln(1+x); D. x^x.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. The recurrence for p is p₀=1 and pᵢ=pᵢ₋₁x/i. Induction gives pᵢ=xⁱ/i!. The accumulator includes the initial term 1, so it contains exactly y terms, not y+1. Comparing with the Taylor expansion eˣ=1+x+x²/2!+⋯ identifies the limit.

2. Initially p=1 and s=1. On iteration i, p is multiplied by x/i, so it becomes xi/i!, which is added to s. The returned value is the truncated series sum from i=0 to y−1 of xi/i!, approaching ex for fixed x as y increases. Thus B in the mathematical arithmetic model; finite floating-point range/roundoff can limit the actual approximation.

Original paper, page 1

1 mark · MCQ
Report issue

Assignable array and pointer expressions

Pointers & Memory

Question 2, GATE 2003: Given int *A[10], B[10][10]; consider I. A[2], II. A[2][3], III. B[1], IV. B[2][3]. Which expressions can be left-hand sides of assignments without compile-time errors, assuming type-compatible right-hand sides? A. I, II and IV only; B. II, III and IV only; C. II and IV only; D. IV only.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Resolve the declarations before considering assignment: A[i] has type int*, while B[i] has array type int[10]. Applying another subscript dereferences an element and yields int in either case. Arrays are not modifiable lvalues, but pointer objects and int objects are. No actual dereference safety can be inferred from these declarations alone.

2. A is an array of 10 pointers to int. A[2] is an assignable pointer object, and A[2][3] is an assignable int lvalue if the pointer identifies suitable storage. B[2][3] is likewise an int lvalue. B[1] is an array row and cannot be assigned as a whole in C. Thus I,II,IV, option A, with type-compatible right-hand sides; compile-time validity does not establish safe runtime initialization.

Original paper, page 1

1 mark · MCQ
Report issue

Conditioning on an almost-sure event

Probability & Random Variables

Question 3, GATE 2003: Events A and B satisfy P(A)=1 and P(B)=1/2. Find P(A|B) and P(B|A), in that order. A. (1/4,1/2); B. (1/2,1/4); C. (1/2,1); D. (1,1/2).
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. A has probability one, so its complement has probability zero. Decompose B as (A∩B)∪(Aᶜ∩B); the second part has probability zero. Now apply P(X|Y)=P(X∩Y)/P(Y) separately in the two directions rather than treating conditional probability as symmetric.

2. Since P(A)=1, P(A∩B)=P(B)=1/2. Thus P(A|B)=(1/2)/(1/2)=1, while P(B|A)=(1/2)/1=1/2, D. Both conditioning events have positive probability.

Original paper, page 1

1 mark · MCQ
Report issue

Splitting a sorted sequence before merging

Combinatorics & Counting

Question 4, GATE 2003: A contains eight distinct integers sorted in increasing order. How many ordered pairs of increasing sequences (B,C), with five elements in B and three in C, merge to A? A. 2; B. 30; C. 56; D. 256.
Question 4, GATE 2003: A contains eight distinct integers sorted in increasing order. How many ordered pairs of increasing sequences (B,C), with five elements in B and three in C, merge to A? A. 2; B. 30; C. 56; D. 256.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. There is no additional permutation factor: once B’s five members are selected, sorting fixes their order, and the remaining three fix C. Compute 8!/(5!3!)=(8·7·6)/(3·2·1)=56. Choosing C first gives the same count binomial(8,3).

2. Choose which 5 of the 8 distinct elements belong to B; the other 3 belong to C. Their increasing orders are then forced, and merging reconstructs A. Hence binomial(8,5)=56 pairs, C.

Original paper, page 1

1 mark · MCQ
Report issue

Attendance with a spouse constraint

Combinatorics & Counting

Question 5, GATE 2003: There are n invited couples. A husband can attend only with his wife, but a wife can attend without her husband. How many different gatherings are possible? A. binomial(2n,n)·2^n; B. 3^n; C. (2n)!/2^n; D. binomial(2n,n).
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. The unconstrained four possibilities for a couple are neither, husband only, wife only, and both. Delete just husband only, leaving three. Multiplication across n distinguishable couples gives 3·3·…·3; the empty gathering is one of these assignments.

2. For each couple the allowed attendance choices are neither person, wife only, or both. These three independent choices give 3n gatherings, B, including the empty gathering. Husband-only attendance is excluded.

Original paper, page 1

1 mark · MCQ
Report issue

Catalan recurrence for binary search trees

Binary Search & Balanced Trees

Question 6, GATE 2003: Let T(n) count binary search trees on n distinct keys. In T(n)=sum from k=1 to n of T(k−1)T(x), what is x? A. n−k+1; B. n−k; C. n−k−1; D. n−k−2.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. Partition all trees by their root’s rank k. No key greater than the root may be in its left subtree, so the sizes are forced rather than chosen. For each left shape any right shape is allowed; multiply within a fixed k and sum over the disjoint root choices. Empty subtrees contribute T(0)=1.

2. If the root is the kth smallest key, its left subtree contains k−1 keys and its right subtree n−k. Their shapes can be chosen independently, giving T(k−1)T(n−k). Thus the missing argument x=n−k, B, with T(0)=1.

Original paper, page 1

1 mark · MCQ
Report issue

Strings under concatenation

Algebraic Structures

Question 7, GATE 2003: For Σ={0,1}, consider Σ* under string concatenation. Which statement holds? A. It does not form a group; B. It forms a noncommutative group; C. It has no right identity; D. Removing the empty string makes it a group.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. A group must have an identity and an inverse for every element. The empty string is a two-sided identity. If s is nonempty, however, |st|=|s|+|t|>0 for every t, so st can never be the empty identity. Associativity alone is insufficient for group structure.

2. Concatenation is associative and ε is an identity, but a nonempty string cannot have a concatenative inverse because lengths add. Therefore Σ* is a monoid, not a group, A. Removing ε also removes the identity and does not fix the missing inverses.

Original paper, page 1

1 mark · MCQ
Report issue

Components after deleting a vertex

Trees & Connectivity

Question 8, GATE 2003: An arbitrary graph has n vertices and k connected components. After deleting one vertex and its incident edges, between which bounds must the new component count lie? A. k and n; B. k−1 and k+1; C. k−1 and n−1; D. k+1 and n−k.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. To see why k is not a valid lower bound, delete an isolated vertex. To see why k+1 is not a valid upper bound, delete the center of a large star, leaving many isolated leaves. In every case the k−1 untouched components remain and the n−1 remaining vertices bound the total above.

2. Only the deleted vertex’s original component can change. If it is an isolated vertex, the component count decreases to k−1; otherwise that component can split but the other k−1 remain. At most n−1 components can exist on the remaining n−1 vertices. Thus the necessary bounds are k−1 and n−1, C.

Original paper, page 1

1 mark · MCQ
Report issue

Signed binary divisibility

Number Systems & Computer Arithmetic

Question 9, GATE 2003: Interpret every bit string as an eight-bit two’s-complement integer. Which is divisible by 11111011? A. 11100111; B. 11100100; C. 11010111; D. 11011011.
Question 9, GATE 2003: Interpret every bit string as an eight-bit two’s-complement integer. Which is divisible by 11111011? A. 11100111; B. 11100100; C. 11010111; D. 11011011.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Step through it (12 steps)

1. For an eight-bit word with most significant bit 1, subtract 256 from its unsigned value. The divisor is −5, so only signed multiples of 5 qualify. Dividing −25 by −5 gives the integer 5; the other listed values leave nonzero remainders.

2. The 8-bit two’s-complement divisor 11111011 is 251−256=−5. The listed values 11100111,11100100,11010111,11011011 are respectively−25,−28,−41,−37. Only−25 is divisible by−5, so A.

Original paper, page 1

1 mark · MCQ
Report issue

Three pipeline hazard classes

Pipelining & Hazards

Question 10, GATE 2003: For a pipelined CPU with one ALU, consider I. Instruction j+1 uses instruction j’s result; II. A conditional jump executes; III. Instructions j and j+1 need the ALU simultaneously. Which can cause a hazard? A. I and II only; B. II and III only; C. III only; D. All three.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. A data hazard concerns operand availability, a control hazard concerns which instruction address to fetch, and a structural hazard concerns resource availability. These are separate reasons a pipeline may need a stall or other mitigation. A single ALU does not eliminate the data or control cases.

2. Using a preceding result can cause a data hazard; a conditional branch causes a control hazard; simultaneous demand for the single ALU causes a structural hazard. Therefore all three can cause hazards, D. The question asks possibility, not that every instance necessarily stalls.

Original paper, page 2

1 mark · MCQ
Report issue

Array-multiplier propagation depth

Combinational Circuits

Question 11, GATE 2003: An array multiplier multiplies two n-bit numbers. Every gate has unit delay. What is its total propagation delay? A. Θ(1); B. Θ(log n); C. Θ(n); D. Θ(n²).
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. The relevant quantity is longest input-to-output path, not total gate count. Partial-product generation occurs in parallel, after which a regular array has a number of dependent addition levels proportional to operand width. Unit gate delay therefore makes the critical delay linear even though there are quadratically many partial-product cells.

2. A conventional array multiplier forms partial products in parallel and propagates carries/sums through a linear number of adder stages. With constant delay per gate/stage, its critical path is Θ(n), C. Its Θ(n²) hardware area does not imply quadratic propagation delay; a tree multiplier is a different architecture.

Original paper, page 2

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Two directions of an NP-completeness proof

Complexity & Reductions

Question 12, GATE 2003: Ram gives a polynomial-time reduction from 3-SAT to decision problem Π. Shyam gives a polynomial-time reduction from Π to 3-SAT. What follows? A. Π is NP-hard but not NP-complete; B. Π is in NP but not NP-complete; C. Π is NP-complete; D. Π is neither NP-hard nor in NP.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Reduction direction matters: 3-SAT≤pΠ means a solver for Π could solve an NP-complete problem, proving hardness. For membership, compute the other reduction and use a satisfying assignment to the resulting 3-CNF as a polynomial certificate. Combining membership and hardness is precisely NP-completeness.

2. The reduction 3-SAT≤pΠ proves Π is NP-hard. The reduction Π≤p 3-SAT supplies a polynomial verifier/NP algorithm because 3-SAT is in NP, so Π is in NP. Together these establish NP-completeness, C, for the standard decision-problem reductions.

Original paper, page 2

1 mark · MCQ
Report issue

Unknown proposition defining a simple language

Decidability & Computability

Question 13, GATE 2003: Define L={0,1}* if P=NP, and L=∅ otherwise. Which statement is true? A. L is recursive; B. L is recursively enumerable but not recursive; C. L is not recursively enumerable; D. Its recursiveness can be known only after resolving P=NP.
Question 13, GATE 2003: Define L={0,1}* if P=NP, and L=∅ otherwise. Which statement is true? A. L is recursive; B. L is recursively enumerable but not recursive; C. L is not recursively enumerable; D. Its recursiveness can be known only after resolving P=NP.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Reason by cases without trying to resolve the open problem. If P=NP, an always-accept machine decides L. Otherwise an always-reject machine decides L. Each possible language has a halting decider, so the uncertainty about which case holds is not noncomputability of L.

2. Regardless of the truth of P=NP, L is either all binary strings or the empty language. Both are regular and recursive, so L is recursive, A. Establishing that some decider exists does not require knowing which of these two particular deciders describes L.

Original paper, page 2

1 mark · MCQ
Report issue

Equivalent binary regular expressions

Regular Expressions & Languages

Question 14, GATE 2003: Which regular expression denotes the same language as 0*(10*)*? Here + means union. A. (1*0)*1*; B. 0+(0+10)*; C. (0+1)*10(0+1)*; D. None of these.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. For instance, 0010010 splits as 00·100·10 under the given expression. In A it splits into zero-terminated blocks with a final run of ones. B cannot produce the single string 1, and C requires a substring 10 and thus misses ε,0,1. This distinguishes the alternatives without merely appealing to a pattern resemblance.

2. Every binary string can be divided into an initial zero run followed by successive 1-and-zero-run blocks, so 0*(10*)*=Σ*. Likewise(1*0)*1* parses successive zero-terminated blocks followed by a final one run and also gives Σ*. Thus A. The other listed expressions do not cover exactly all binary strings.

Original paper, page 2

1 mark · MCQ
Report issue

Ordered enumeration and decidability

Decidability & Computability

Question 15, GATE 2003: If a language’s strings can be effectively enumerated in lexicographic (the reproduction says “alphabetic”) order, which conclusion is intended? A. L is necessarily finite; B. L is regular but not necessarily finite; C. L is context-free but not necessarily regular; D. L is recursive but not necessarily context-free. The distinction between dictionary order and the usual effective length-first order must be addressed.
Tap to enlarge
Your answer
Answer & solution

Answer: D under the standard length-lexicographic convention (no official key was published)

1. Separate two issues: whether membership is decidable, and whether the enumerator itself yields a stopping test. In effective length-first order each target has finitely many predecessors; its absence is detected once the enumeration passes it. Alphabetic dictionary order lacks that finite-predecessor property, so the conventional answer needs the stated interpretation rather than an unqualified appeal to sortedness.

2. With an effective shortlex (length-first, then alphabetic) enumeration in increasing order, membership is decided by enumerating until the target appears or an output exceeds it; if the enumerator terminates, absence is also decided. Finite languages are recursive separately. Thus the conventional result is recursive but not necessarily context-free, D; for example{0n 1n 2n} has a computable ordered enumeration. The the paper explicitly says lexicographic/alphabetic, not length-first. Ordinary dictionary order can have infinitely many predecessors, so the surpassing argument needs an additional guarantee: enumeration of 0,00,000,... never surpasses the absent string 1. The conclusion is recorded under the standard effective length-order convention, not justified by that flawed stopping argument for arbitrary dictionary order.

Original paper, page 2

1 mark · MCQ
Report issue

Limits of LL-one grammar transformations

Parsing & Syntax Analysis

Question 16, GATE 2003: Which transformation suffices to turn an arbitrary context-free grammar into an LL(1) grammar? A. Removing left recursion alone; B. Left factoring alone; C. Both removing left recursion and left factoring; D. None of these.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. LL(1) requires a deterministic choice of production from one lookahead symbol. Factoring resolves shared prefixes and removing left recursion removes an immediate predictive-parsing obstacle; neither establishes the required disjoint prediction sets in all grammars. In particular LL(1) cannot describe every context-free language.

2. Removing left recursion and left factoring remove common obstacles but do not make every CFG LL(1). Inherently ambiguous CFLs have no unambiguous grammar, whereas every LL(1) grammar is unambiguous; some unambiguous CFLs also are not LL(1). Thus none of the proposed transformations suffices for an arbitrary CFG, D.

Original paper, page 2

1 mark · MCQ
Report issue

SLR and LALR state counts

Parsing & Syntax Analysis

Question 17, GATE 2003: The SLR parser for grammar G has n₁ states and its LALR parser has n₂ states. Which relationship is necessary in the standard constructions? A. n₁<n₂; B. n₁=n₂; C. n₁>n₂; D. None of these.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. SLR states are sets of LR(0) items. Start with canonical LR(1) states for LALR and discard lookaheads to identify equal cores; merging those states leaves the reachable LR(0) cores. Different reduction entries in the tables do not create extra automaton cores.

2. SLR uses the canonical LR(0) item-state cores. LALR merges canonical LR(1) states that share an LR(0) core, leaving one state per such core. Thus their automata have the same number of states, n 1=n 2, B, under the conventional constructions, even though their reduction lookaheads and conflict behavior differ.

Original paper, page 2

1 mark · MCQ
Report issue

Inherited attributes during bottom-up parsing

Semantic Analysis & Type Checking

Question 18, GATE 2003: In bottom-up evaluation of a syntax-directed definition, inherited attributes can: A. Always be evaluated; B. Be evaluated only if the definition is L-attributed; C. Be evaluated only if the definition has synthesized attributes; D. Never be evaluated. Discuss the usual parsing-time interpretation and its limitation.
Tap to enlarge
Your answer
Answer & solution

Answer: B under a restricted one-pass evaluation model (no official key was published)

1. A synthesized attribute flows from children to parent and is naturally evaluated when a bottom-up parser reduces a production. An inherited attribute flows from parent or siblings toward a child and may be needed before that child is reduced. Therefore identify which dependency schedule the question permits before selecting an option.

2. Inherited attributes cannot in general be computed by the simple reduce-only mechanism used for synthesized attributes. In the usual left-to-right one-pass implementation, usable inherited information must be available from the parent context and already processed left siblings, the L-attributed dependency condition behind B. Even then suitable scheduling/marker productions or stack access may be needed; being L-attributed is not a blanket guarantee for every unmodified LR evaluation scheme. If bottom-up evaluation instead allows building a full parse/dependency graph and later scheduling arbitrary acyclic dependencies, L-attributedness is not necessary. The choice therefore depends on the conventional parsing-time model, which the prompt does not spell out.

Original paper, page 2

1 mark · MCQ
Report issue

Inorder traversal of inserted keys

Binary Search & Balanced Trees

Question 19, GATE 2003: Insert 7,5,1,8,3,6,0,9,4,2, in this order, into an initially empty binary search tree using ordinary numerical order. What is its inorder traversal? A. 7,5,1,0,3,2,4,6,8,9; B. 0,2,4,3,1,6,5,9,8,7; C. 0,1,2,3,4,5,6,7,8,9; D. 9,8,6,4,2,3,0,1,5,7.
Question 19, GATE 2003: Insert 7,5,1,8,3,6,0,9,4,2, in this order, into an initially empty binary search tree using ordinary numerical order. What is its inorder traversal? A. 7,5,1,0,3,2,4,6,8,9; B. 0,2,4,3,1,6,5,9,8,7; C. 0,1,2,3,4,5,6,7,8,9; D. 9,8,6,4,2,3,0,1,5,7.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Step through it (23 steps)

1. At each node, all left-subtree keys are smaller and all right-subtree keys larger. Inorder recursively visits left subtree, root, right subtree, so this invariant sorts the output. The insertion order determines tree shape but cannot change this ordering property.

2. An inorder traversal of a BST visits its distinct keys in increasing order, independently of insertion order. The given keys are exactly 0 through 9, so the sequence is 0,1,2,3,4,5,6,7,8,9, C.

Original paper, page 2

1 mark · MCQ
Report issue

Polynomial shifts and exponential bounds

Asymptotic Analysis & Recurrences

Question 20, GATE 2003: Which asymptotic claims are correct? I. (n+k)^m=Θ(n^m) for fixed constants k,m; II. 2^(n+1)=O(2^n); III. 2^(2n)=O(2^n) in GFG; GateForum instead shows 2^(2n+1)=O(2^n). Both claims have the same false truth value. A. I and II; B. I and III; C. II and III; D. I, II and III.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Test big-O claims by ratios. A bounded positive ratio suffices for O; a ratio bounded away from zero as well establishes Θ. Doubling the exponent is not multiplying the result by a constant: 22n=(2n)². This is the specific error behind claim III.

2. For fixed k,m, ((n+k)m)/(nm)=(1+k/n)m tends to 1, so I holds.2n+1=2·2n, so II holds. But 22 n/2n=2n is unbounded, so III fails. Thus I and II only, A.

Original paper, page 3

1 mark · MCQ
Report issue

Possible depth-first traversal sequences

Graph Algorithms

Question 21, GATE 2003: An undirected graph has vertices {a,b,e,f,g,h} and edges {ae,ab,af,eb,eg,bf,bh,fh,fg,gh}. Which listed sequences can be depth-first traversals starting at a, allowing arbitrary neighbor order? I. a,b,e,g,h,f; II. a,b,f,e,h,g; III. a,b,f,h,g,e; IV. a,f,g,h,b,e. A. I, II and IV only; B. I and IV only; C. II, III and IV only; D. I, III and IV only.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (4 options)

1. DFS must finish every reachable unexplored neighbor before returning from a vertex. The three accepted sequences can be realized without any backtrack until all six vertices are visited because each consecutive pair is an edge. In II the transition from f to e would require backtracking through b, but f still has unvisited neighbors g and h, so DFS cannot yet leave f. Hence e cannot be next.

2. I, III and IV each trace a simple path through all vertices using displayed edges, so a neighbor order realizes each. In II, f has no edge to e and still has unvisited neighbors g and h; DFS must visit one of these before backtracking. Thus II is impossible and the answer is D.

Original paper, page 3

1 mark · MCQ
Report issue

Binary search inside insertion sort

Searching, Sorting & Selection

Question 22, GATE 2003: Array insertion sort normally uses linear search to find where the next element belongs. If binary search replaces that search, what happens to worst-case total running time? A. It remains Θ(n²); B. It becomes Θ(n(log n)²); C. It becomes Θ(n log n); D. It becomes Θ(n).
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. During insertion into a sorted prefix of length i, search needs O(log i) comparisons but opening an array slot may move i elements. Summing these movements over all prefixes dominates the sum of logarithmic searches. Binary search improves comparisons, not the cost of physically maintaining the sorted array.

2. Binary search reduces comparisons needed to locate each insertion position, but array elements still must shift to make room. A reverse-sorted input needs 1+2+...+(n−1)=Θ(n²) moves. The worst-case runtime therefore remains Θ(n²), A, despite O(n log n) comparisons.

Original paper, page 3

1 mark · MCQ
Report issue

Fixed-rank selection from a min heap

Heaps & Priority Queues

Question 23, GATE 2003: A min-heap has n elements, with its smallest at the root. For n≥7, what time is sufficient to find the seventh smallest element, as a function of n? A. Θ(n log n); B. Θ(n); C. Θ(log n); D. Θ(1).
Question 23, GATE 2003: A min-heap has n elements, with its smallest at the root. For n≥7, what time is sufficient to find the seventh smallest element, as a function of n? A. Θ(n log n); B. Θ(n); C. Θ(log n); D. Θ(1).
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. The candidate frontier contains the roots of all unexplored subheaps. Heap order makes its minimum the smallest unseen element. Extract that node and add at most its two children, preserving the invariant. After seven iterations the frontier and work are bounded by constants independent of n.

2. Maintain a small candidate min-priority queue initially containing the root. Repeatedly remove its minimum and insert that node’s children; after seven removals the extracted value is seventh smallest. Only a constant number of nodes and candidate operations are used because rank 7 is fixed, hence Θ(1) with respect to n, D, assuming n≥7. Repeatedly deleting from the original n-element heap is unnecessarily expensive.

Original paper, page 3

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Static types and runtime subtypes

Other Computing Topics

Question 24, GATE 2003: Which typing statement is false? A. In statically typed languages each program variable has a fixed type; B. In untyped languages values do not have types; C. In dynamically typed languages variables have no types; D. In all statically typed languages each variable is associated with values of only a single type during execution.
Tap to enlarge
Your answer
Answer & solution

Answer: D under the standard polymorphic-language distinction (no official key was published)

1. Static type and runtime class are different concepts. A variable declared as a superclass reference retains that declared type while holding references to multiple subclasses. This gives a counterexample to D without implying that the compiler changes the declared type of the variable.

2. A variable in a statically typed language can have one declared static type while referring at different times to values of different compatible runtime subtypes. For example an Animal reference may refer to Dog and Cat objects. Thus D’s claim that values must have only a single runtime type in all statically typed languages is false. The other statements use the conventional distinction between declared variable types, dynamically typed values and untyped formalisms; that terminology is not uniform across every language theory.

Original paper, page 3

1 mark · MCQ
Report issue

File-system block-size tradeoff

File Systems

Question 25, GATE 2003: In the conventional comparison for a fixed-block-size file system, increasing block size leads to: A. Better disk throughput but poorer space utilization; B. Better throughput and better utilization; C. Poorer throughput but better utilization; D. Poorer throughput and poorer utilization.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Reading a larger contiguous block transfers more useful bytes per seek or setup cost for a sequential workload. But the last block of a file is allocated in full even when only partly used; increasing the allocation unit can increase this internal slack. These effects explain the conventional throughput/utilization tradeoff.

2. Larger blocks amortize per-I/O overhead across more bytes, often improving sequential disk throughput, but waste more unused space in partially occupied final blocks. Thus better throughput with poorer space utilization, A, under the conventional workload comparison. It is not a universal guarantee for every random-access workload.

Original paper, page 3

1 mark · MCQ
Report issue

Size of a flat page table

Virtual Memory & Paging

Question 26, GATE 2003: With 32-bit virtual addresses and 1 KB pages, why is a one-level page table impractical? A. Large internal fragmentation; B. Large external fragmentation; C. Large memory overhead for page tables; D. Large computation overhead in translation.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. A 1 KB page means 2¹⁰ byte offsets, so a virtual address splits into 22 page-number bits and 10 offset bits. Even a sparsely used process address space requires all 2²² slots in a flat table. Four-byte entries are an illustration, not an additional given: they would occupy 16 MiB per table.

2. A 1 KiB page uses 10 offset bits, leaving 22 virtual-page bits in a 32-bit address. A flat table therefore needs 222 entries per address space; at 4 bytes each this is 16 MiB. The large memory overhead, C, motivates multilevel or other sparse organizations.

Original paper, page 3

1 mark · MCQ
Report issue

IP source-routing capability

Routing Algorithms

Question 27, GATE 2003: Which assertion about Internet Protocol is false? A. A computer can have several IP addresses; B. Packets from the same source to the same destination can take different routes; C. A packet is discarded if it cannot reach its destination within a bounded number of hops; D. A source cannot set an outgoing packet’s route, which is determined only by router routing tables.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. A and B are compatible with multiple interfaces and datagram routing. For C, IPv4 routers decrement TTL and discard expired packets. To refute D it suffices to cite the historical source-route options; their rarity or filtering in current networks does not make the categorical protocol statement true.

2. Historical IPv 4 includes loose/strict source-route options that allow a sender to influence/specify a route. Therefore the categorical assertion that only router tables can determine the route is false, D. Multiple addresses and differing packet routes are possible, while TTL limits forwarding hops. Source routing is commonly filtered or disabled operationally, which does not erase the protocol capability considered by this historical question.

Original paper, page 3

1 mark · MCQ
Report issue

Essential transport-layer function

Transport, Congestion Control & Traffic Shaping

Question 28, GATE 2003: Which functionality must the transport protocol provide over and above network-layer service? A. Recovery from packet losses; B. Detection of duplicate packets; C. Correct-order packet delivery; D. End-to-end connectivity.
Question 28, GATE 2003: Which functionality must the transport protocol provide over and above network-layer service? A. Recovery from packet losses; B. Detection of duplicate packets; C. Correct-order packet delivery; D. End-to-end connectivity.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Network delivery addresses hosts; transport adds end-to-end communication between application endpoints, usually identified by ports. TCP implements the first three enhancements, whereas UDP provides transport service without promising any of them. Hence they cannot be universal requirements of the layer.

2. Transport supplies end-to-end process communication above network-layer host delivery, D. Reliability, duplicate suppression and in-order delivery are features of some transport protocols, notably TCP, but are not required of all: UDP does not guarantee them. End-to-end connectivity here means communication service, not necessarily a connection-oriented handshake.

Original paper, page 3

1 mark · MCQ
Report issue

Potentially unrecoverable dirty reads

Recovery & Logging

Question 29, GATE 2003: Which operation may lead to an irrecoverable database error? A. Writing an item after an uncommitted transaction reads it; B. Reading an item after an uncommitted transaction reads it; C. Reading an item written by a committed transaction; D. Reading an item written by an uncommitted transaction.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Use the concrete schedule W₁(X), R₂(X), C₂, A₁. Transaction 2 has already committed a result based on transaction 1’s value when transaction 1 aborts. Recovery would need to undo a committed dependency, which is why the schedule is nonrecoverable. The word “may” matters: a dirty read need not always lead to such a commit order.

2. If T 2 reads data written by uncommitted T 1, then T 2 commits before T 1 aborts, the schedule is nonrecoverable: a committed transaction depended on an aborted value. Thus D may lead to the stated error. A dirty read alone does not always force irrecoverability; delaying dependent commits can permit cascading rollback.

Original paper, page 4

1 mark · MCQ
Report issue

Relational algebra for select distinct

Relational Algebra & Calculus

Question 30, GATE 2003: Translate SELECT DISTINCT a₁,a₂,...,aₙ FROM r₁,r₂,...,rₘ WHERE P into classical relational algebra. Every option first applies selection σ_P and then projection π_(a₁,...,aₙ). Their innermost operation is: A. r₁×r₂×...×rₘ; B. r₁⋈r₂⋈...⋈rₘ; C. r₁∪r₂∪...∪rₘ; D. r₁∩r₂∩...∩rₘ.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. FROM first chooses every combination of one tuple from each relation. WHERE then keeps only combinations satisfying P. Finally SELECT chooses attributes, and DISTINCT removes repeated projected tuples. A natural join would additionally impose equality on common-named columns, which this arbitrary SQL query does not necessarily request.

2. The comma-separated FROM clause forms the Cartesian product of all relations, WHERE applies selection σ_P, and SELECT DISTINCT applies set projection onto the listed attributes. Thus π_attributes(σ_P(r 1×...×rm)), A, with attribute renaming/qualification as required and the classical relational-algebra interpretation.

Original paper, page 4

2 marks · MCQ
Report issue

Upward-closed truth in a partial order

Partial Orders & Lattices

Question 31, GATE 2003: A partially ordered set (S,≤) has two minimal elements a,b and a maximum c. A predicate P has P(a)=true, P(b)=false, and P(x)⇒P(y) whenever x≤y. Which cannot be true? A. P(x)=true for every x≠b; B. P(x)=false for every x distinct from a and c; C. P(x)=false whenever b≤x and x≠c; D. P(x)=false whenever both a≤x and b≤x.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Because c is a maximum, a≤c and b≤c. Propagating the true predicate upward from a forces P(c). Option D applies to c and denies that same predicate. To demonstrate the other options are possible rather than merely not contradicted, use S={a,b,c} with a,b incomparable and both below c.

2. Since a≤c and P(a) is true, monotonicity forces P(c)=true. The maximum c is above both a and b, so D would force P(c)=false, a contradiction. Thus D cannot hold. The other patterns can hold, for example in the three-element poset with incomparable a,b below c, with P true at a,c and false at b.

Original paper, page 4

2 marks · MCQ
Report issue

Universal modus ponens

Propositional & Predicate Logic

Question 32, GATE 2003: Let α(x), β(x) be first-order formulas whose only free variable is x. Which formula is logically valid? A. ((∀x α)⇒(∀x β))⇒∀x(α⇒β); B. (∀x α)⇒∃x(α∧β); C. ((∀x(α∨β))⇒(∃x α))⇒(∀x α); D. (∀x(α⇒β))⇒((∀x α)⇒(∀x β)).
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. For D, fix an arbitrary domain element a. Universal instantiation gives both α(a)⇒β(a) and α(a), hence β(a) by modus ponens. Since a was arbitrary, universal generalization proves ∀x β(x). To eliminate the other candidates, it is enough to exhibit one interpretation in which each is false, rather than attempting to prove their negations in every interpretation.

2. If every x satisfies α(x)→β(x), and every x satisfies α(x), then every x satisfies β(x). This is the valid formula in D. For A take a two-element domain with α true only at one point and β false everywhere: its premise is vacuously true but its conclusion fails. For B take α always true and β always false. For C take a two-element domain with α true at exactly one point. Then ∃xα is true, so the inner implication is true regardless of β, while ∀xα is false; the full implication fails. Thus the alternatives are not valid.

Original paper, page 4

2 marks · MCQ
Report issue

A universally false divisor characterization

Propositional & Predicate Logic

Question 33, GATE 2003: Consider α=[∀x(P(x)↔∀y(Q(x,y)↔¬Q(y,y)))]⇒[∀x ¬P(x)]. Interpretation I₁ has natural-number domain, P(x) meaning “x is prime”, and Q(x,y) meaning “y divides x”. I₂ is identical except P(x) means “x is composite”. Which satisfies α? A. I₁ only; B. I₂ only; C. Neither; D. Both.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. First evaluate the inner universal formula for a fixed x. The condition at y=1 already fails: 1 divides x and also divides itself, so Q(x,1) is true while ¬Q(1,1) is false. Thus the proposed characterization is false for every natural x. The antecedent then asserts that P is empty, contrary to the existence of a prime in I₁ or a composite in I₂.

2. Q(y,y) is true because each positive natural number divides itself. Thus Q(x,y)↔¬Q(y,y) would require Q(x,y) false for every y. Taking y=x for positive x, or y=1, makes this impossible, so the universally quantified characterization on the right of the biconditional defining P is false. Both interpretations have some P-elements (primes in I 1, composites in I 2), making the antecedent ∀x[P(x)↔that characterization] false. Hence the full implication is true in both interpretations, D.

Original paper, page 4

2 marks · MCQ
Report issue

Balls with a lower bound per bag

Combinatorics & Counting

Question 34, GATE 2003: Distribute m identical balls among n distinct bags, each containing at least k balls, where k≥1 and m≥kn. How many distributions exist? A. binomial(m−k,n−1); B. binomial(m−kn+n−1,n−1); C. binomial(m−1,n−k); D. binomial(m−kn+n+k−2,n−k). The kn terms in the blurred GFG options are read using the cleaner alternate reproduction.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. Write the bag counts as xᵢ=k+yᵢ. Then every yᵢ≥0 and their sum is M=m−kn. Encoding M identical stars and n−1 separators gives M+n−1 positions, of which n−1 are separators. If m=kn the formula becomes binomial(n−1,n−1)=1, as required.

2. Put k balls into each of the n distinct bags first. There remain m−kn identical balls to distribute freely. Stars and bars gives binomial(m−kn+n−1,n−1), B, for m≥kn.

Original paper, page 4

2 marks · MCQ
Report issue

Summing integer square-root increments

Asymptotic Analysis & Recurrences

Question 35, GATE 2003: Given T(1)=1, find T(m²) for integer m≥1. GFG prints T(n+1)=T(n)+floor(sqrt(n−1)), n≥1; GateForum instead prints floor(sqrt(n+1)). Preserve both versions. Options: A. (m/6)(21m−39)+4; B. (m/6)(4m²−3m+5); C. (m/2)(3m^(2.5)−11m+20)−5; D. (m/6)(5m³−34m²+137m−104)+5/6.
Question 35, GATE 2003: Given T(1)=1, find T(m²) for integer m≥1. GFG prints T(n+1)=T(n)+floor(sqrt(n−1)), n≥1; GateForum instead prints floor(sqrt(n+1)). Preserve both versions. Options: A. (m/6)(21m−39)+4; B. (m/6)(4m²−3m+5); C. (m/2)(3m^(2.5)−11m+20)−5; D. (m/6)(5m³−34m²+137m−104)+5/6.
Tap to enlarge
Your answer
Answer & solution

Answer: As printed (n−1) the value differs from the options; B holds for the n+1 recurrence (no official key was published)

1. In the block k²≤j<(k+1)² the value is k and the block length is 2k+1. Use sum k=(m−1)m/2 and sum k²=(m−1)m(2m−1)/6 to simplify. The shifted range omits the final terms m and m−1 and adds the initial 1, explaining the difference −2m+2.

2. For the latter, T(m²)=sum_(j=1)m²floor(sqrt(j)). Group j from k² through(k+1)²−1: for k<m there are 2 k+1 copies of k, followed by the final m. Hence sum_(k=1)m−1k(2 k+1)+m=m(4 m²−3 m+5)/6, option B. Literal the paper instead gives 1+sum_(j=0)m²−2floor(sqrt(j))=m(4 m²−3 m+5)/6−2 m+2, including m=1. These are not silently equated; original wording/key are needed to resolve the source discrepancy.

Original paper, page 4

2 marks · MCQ
Report issue

Perfect matchings on six vertices

Graph Theory

Question 36, GATE 2003: How many perfect matchings does the complete graph on six labeled vertices have? A. 15; B. 24; C. 30; D. 60.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. A perfect matching partitions all six vertices into three disjoint unordered pairs. Choose the partner of one designated vertex, remove that pair, and repeat with a designated remaining vertex. This avoids counting the same matching in different pair orders. In the factorial calculation, division by 2³ removes within-pair order and division by 3! removes pair order.

2. Pair a fixed vertex with any of 5 others; pair the smallest remaining vertex with any of 3; the final pair is forced. Thus 5×3×1=15 perfect matchings, A. Equivalently 6!/(2³·3!)=15.

Original paper, page 5

2 marks · MCQ
Report issue

Image of a preimage

Sets, Relations & Functions

Question 37, GATE 2003: An injective map f:A→B induces g:2^A→2^B by g(C)={f(x):x∈C} and h:2^B→2^A by h(D)={x∈A:f(x)∈D}. Which holds for every D⊆B? A. g(h(D))⊆D; B. g(h(D))⊇D; C. g(h(D))∩D=∅; D. g(h(D))∩(B−D)≠∅.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. An element b is in g(h(D)) exactly when b=f(a) for some a∈A whose image lies in D. This requires both b∈f(A) and b∈D, yielding D∩f(A). A value in D outside the image is never recovered, so injectivity does not justify the reverse containment.

2. h(D)=f-1(D), so g(h(D))=f(f-1(D))=D∩f(A), which is always a subset of D. Thus A. Equality need not hold because f is injective but not assumed onto B. This inclusion actually holds even without injectivity.

Original paper, page 5

2 marks · MCQ
Report issue

Solving equations from operation tables

Algebraic Structures

Question 38, GATE 2003: On {a,b,c}, binary operations + and × are specified by tables, with the left operand selecting the row and the right operand the column, columns a,b,c. Addition rows: a:(b,a,c), b:(a,b,c), c:(a,c,b). Multiplication rows: a:(a,b,c), b:(b,c,a), c:(c,c,b). How many ordered pairs (x,y) satisfy both (a×x)+(a×y)=c and (b×x)+(c×y)=c? A. 0; B. 1; C. 2; D. 3.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Use the a row of multiplication to simplify the first equation to x+y=c. Inspecting all nine addition cells reduces nine candidate pairs to three. Evaluate the second equation on only those candidates, preserving operand order because these tables are not familiar field operations. The surviving pairs are (b,c) and (c,b), since the printed entry b×b is c.

2. The first equation admits (a,c),(b,c),(c,b). For these candidates the second left side is respectively b+b=b, c+b=c, and a+c=c. Thus (b,c) and (c,b) both solve the system: the printed tables give 2 solutions, option C.

Original paper, page 5

2 marks · MCQ
Report issue

Nested prime-power encoding

Proof Techniques & Number Theory

Question 39, GATE 2003: Let Σ={a,b,c,d,e}, with g(a)=3,g(b)=5,g(c)=7,g(d)=9,g(e)=11, and let pᵢ be the ith prime (p₁=2). Encode a nonempty string s=a₁...aₙ by f(s)=product pᵢ^g(aᵢ), and a nonempty sequence of nonempty strings (s₁,...,sₘ) by h=product pᵢ^f(sᵢ). Which can be such an h? A. 2⁷3⁷5⁷; B. 2⁸3⁸5⁸; C. 2⁹3⁹5⁹; D. 2¹⁰5¹⁰7¹⁰.
Question 39, GATE 2003: Let Σ={a,b,c,d,e}, with g(a)=3,g(b)=5,g(c)=7,g(d)=9,g(e)=11, and let pᵢ be the ith prime (p₁=2). Encode a nonempty string s=a₁...aₙ by f(s)=product pᵢ^g(aᵢ), and a nonempty sequence of nonempty strings (s₁,...,sₘ) by h=product pᵢ^f(sᵢ). Which can be such an h? A. 2⁷3⁷5⁷; B. 2⁸3⁸5⁸; C. 2⁹3⁹5⁹; D. 2¹⁰5¹⁰7¹⁰.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. Prime factorization makes the outer positions and exponents uniquely recoverable. Every inner nonempty string encoding begins with at least 2³, so it is divisible by 8. Thus exponents 7,9,10 cannot encode any inner string. Conversely exponent 8 is exactly f(a), and B uses consecutive outer primes with three such exponents.

2. A string encoding f(s) uses consecutive primes starting with 2, with exponents from{3,5,7,9,11}. In particular f(a)=2³=8. Therefore 28·38·58 is the sequence encoding of(a,a,a), so B. Exponents 7 and 9 are not valid nonempty string encodings because such encodings are divisible by 8. D skips prime 3 in the outer encoding and also uses exponent 10, which is invalid.

Original paper, page 5

2 marks · MCQ
Report issue

Minimum degree from an edge bound

Graph Theory

Question 40, GATE 2003: An undirected graph G=(V,E) satisfies |E|≤3|V|−6. Its minimum degree is min over v∈V of degree(v). Which value cannot be the minimum degree? A. 3; B. 4; C. 5; D. 6.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Apply the handshake lemma: sum of vertex degrees equals twice the number of edges. If every vertex had degree at least 6, the sum would be at least 6|V|, contradicting the bound 6|V|−12. Therefore at least one vertex has degree below 6. No assumption that the graph is planar is needed.

2. The degree sum is 2|E|≤6|V|−12, so the average degree is strictly less than 6. At least one vertex therefore has degree≤5, and the minimum degree cannot equal 6, D. The argument needs an undirected graph and a nonempty vertex set satisfying the inequality, but does not require proving planarity from the edge bound.

Original paper, page 5

2 marks · MCQ
Report issue

Consistency condition for a rank-two linear system

Linear Algebra

Question 41, GATE 2003: The equations are 2x+y−4z=α, 4x+3y−12z=5, and x+2y−8z=7. The second and third coefficient columns are linearly dependent. For how many values of α are there infinitely many solutions? A. 0; B. 1; C. 2; D. Infinitely many.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. The dependence of columns suggests combining y and z, not setting either to zero. Substitute u=y−4z; the last two equations have a nonsingular 2×2 coefficient matrix and determine x,u uniquely. The first then imposes one consistency condition on α. Once it holds, every real z gives a corresponding y, hence a one-parameter infinite solution set.

2. Put u=y−4 z. The last two equations become 4 x+3 u=5 and x+2 u=7, giving x=−11/5 and u=23/5. The first equation is then consistent only for α=2 x+u=1/5. At that value z is free and y=u+4 z, giving infinitely many solutions. Thus exactly one value of α works, option B.

Original paper, page 5

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Newton iteration on a piecewise-linear graph

Numerical Methods

Question 42, GATE 2003: A piecewise-linear f has drawn vertices (0,1), (0.5,0.5), approximately (0.8,−1), (1.55,0.5), and (2.05,1), with first and last straight segments extended. Marked roots are 0.6 and 1.3. Starting points x₀, x₁, x₂ lie respectively in the first descending segment, the steep descending segment, and the final rising segment. Newton–Raphson is started separately from each. Which roots result, in that order? A. (1.3,0.6,0.6); B. (0.6,0.6,1.3); C. (1.3,1.3,0.6); D. (1.3,0.6,1.3). Source defect: the lower vertex is actually labeled (−1.0,0.8), contrary to its plotted location; use the drawn-segment interpretation explicitly rather than silently correcting the label.
Tap to enlarge
Your answer
Answer & solution

Answer: D under the plotted segments (no official key was published)

1. Newton’s formula is x_next=x−f(x)/f′(x). On a straight segment f(x)=ax+b this simplifies to −b/a, the intercept of its extended line, independent of the starting point within that segment. Consequently one must follow the segment containing each new iterate, not simply choose the visually nearest root. The first segment has equation 1−x and the last has equation x−1.05.

2. Newton iteration on a linear segment jumps to that segment’s extended x-intercept. Starting at x₀ on the leftmost segment gives x=1, which is on the rising middle segment and then gives the root 1.3. Starting at x₁ on the steep descending segment gives the root 0.6 immediately. Starting at x₂ on the rightmost segment gives 1.05, then 1.3 on the rising middle segment. Therefore the plotted-segment interpretation gives (1.3,0.6,1.3), D. The lower-vertex label appears as (−1.0,0.8) in the paper, inconsistent with its plotted position; the graph instead places it near (0.8,−1.0). The result uses the visibly drawn segments and marked roots, not that reversed coordinate label.

Original paper, page 5

2 marks · MCQ
Report issue

Largest spacing in a custom floating-point format

Data Representation & Arithmetic

Question 43, GATE 2003: A 16-bit floating-point scheme has sign s at bit 15, six-bit exponent e at bits 14–9, and nine-bit mantissa integer m at bits 8–0. Its value is (−1)^s(1+m·2^(−9))2^(e−31) if e≠111111₂, and zero otherwise. What is the maximum difference between successive representable real numbers? A. 2^(−40); B. 2^(−9); C. 2^22; D. 2^31.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Within an exponent binade, incrementing the nine-bit mantissa integer by one increments the value by 2e−40. Maximizing this requires the largest nonreserved exponent, 62. The positive/negative sign duplicates gaps by symmetry; crossing zero and crossing adjacent exponent ranges cannot exceed the largest within-binade gap.

2. There are six exponent bits and nine fractional mantissa bits. Exponent 63 is reserved for zero, so the largest usable exponent is e=62. For fixed e, adjacent significands differ by 2⁻⁹, giving spacing 2e−31−9. This is largest at e=62, namely 2²², option C. Crossing a binade boundary has the smaller binade’s spacing, and the gaps adjacent to zero are only 2⁻³¹, so neither produces a larger gap.

Original paper, page 6

2 marks · MCQ
Report issue

Minimal states for a latched count-difference detector

Finite-State Machine Design

Question 44, GATE 2003: A synchronous sequential circuit has one input and two output bits. Let zₖ,nₖ count zeros and ones in the first k input bits. Initially output is 00. When zₖ−nₖ first reaches 2, output becomes 10 forever. When nₖ−zₖ first reaches 2, output becomes 01 forever. What is the minimum number of states? A. 5; B. 6; C. 7; D. 8.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Before absorption retain only d=zₖ−nₖ. On input 0 increment d and on input 1 decrement it. Values −1,0,+1 are nonabsorbing and still output 00; reaching +2 or −2 selects different permanent outputs. Distinguish 0 from +1 by suffix 0, 0 from −1 by suffix 1, and −1 from +1 by suffix 0, proving the three transient states cannot merge.

2. Before a threshold is reached, it suffices to track d=(zeros seen)−(ones seen) in {−1,0,1}. Reaching +2 or −2 enters a separate absorbing state with output 10 or 01. Thus five states suffice. They are all distinguishable: the absorbing states have different outputs, and appropriate one-bit continuations separate each pair of the three pre-threshold states. Hence five states are necessary, option A.

Original paper, page 6

2 marks · MCQ
Report issue

Minimum literal counts from a Karnaugh map

Logic Minimization & Karnaugh Maps

Question 45, GATE 2003: Literal count counts every variable occurrence, complemented or not; for example xy+xz has four literals. Find minimum literal counts for a product-of-sums and a sum-of-products, respectively, for this four-variable Karnaugh map. Rows xy and columns zw both use Gray order 00,01,11,10. Rows are: 00:(X,1,0,1); 01:(0,1,X,0); 11:(1,X,X,0); 10:(X,0,0,X), with X a don’t-care. A. (11,9); B. (9,13); C. (9,10); D. (11,11). An independently minimized pair may be absent from these reproduced options.
Question 45, GATE 2003: Literal count counts every variable occurrence, complemented or not; for example xy+xz has four literals. Find minimum literal counts for a product-of-sums and a sum-of-products, respectively, for this four-variable Karnaugh map. Rows xy and columns zw both use Gray order 00,01,11,10. Rows are: 00:(X,1,0,1); 01:(0,1,X,0); 11:(1,X,X,0); 10:(X,0,0,X), with X a don’t-care. A. (11,9); B. (9,13); C. (9,10); D. (11,11). An independently minimized pair may be absent from these reproduced options.
Tap to enlarge
Your answer
Answer & solution

Answer: (9,8); no listed option (no official key was published)

1. For SOP, group 1 cells with optional X cells and never cover a specified 0; this yields ¬w¬y, w¬x¬z, x¬w¬z. For POS, group zeros with optional X cells, yielding factors (y∨¬x),(¬w∨¬z),(¬y∨¬z),(w∨x∨¬y). Count variable occurrences, not number of groups: SOP has 8 and POS has 9. Don’t-care choices may differ for the two minimizations. The exact-cover checker is needed to certify these are minima rather than just valid upper bounds.

2. Use row variables xy and column variables zw in the printed Gray order 00,01,11,10. A valid minimum SOP is (¬w∧¬y)∨(w∧¬x∧¬z)∨(x∧¬w∧¬z), containing 2+3+3=8 literals. A valid minimum POS is (y∨¬x)∧(¬w∨¬z)∧(¬y∨¬z)∧(w∨x∨¬y), containing 2+2+2+3=9 literals. Each matches every specified 0 and 1; the X cells may be assigned as needed separately for the two minimizations. Exhaustive enumeration of all 3⁴ Boolean cubes, excluding any cube that covers a forbidden cell, and exact minimum-cost covering of the required cells confirms these lower bounds. Thus the requested ordered pair (POS,SOP) is (9,8), absent from (11,9),(9,13),(9,10),(11,11).

Original paper, page 6

2 marks · MCQ
Report issue

Controlled XOR inputs of an adder-subtractor

Data Representation & Arithmetic

Question 46, GATE 2003: An n-bit ripple-carry ALU has a full adder at each bit. At bit i its inputs are Ai, Bi XOR K, and carry Ci; the output is Si and the next carry. K is shared by all XOR gates and C0 is the least-significant carry input. For two's-complement operands, which operations can be performed by choosing only K and C0?
A. A+B and A−B, but not A+1
B. A+B and A+1, but not A−B
C. A+B, but neither A−B nor A+1
D. A+B, A−B and A+1
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. A full-adder chain adds its two input words and the initial carry, so S=A+(B XOR K...K)+C0 modulo 2n.
2. Enumerate the controls: (0,0) produces A+B; (0,1) produces A+B+1; (1,0) produces A+complement(B)=A−B−1; (1,1) produces A−B.
3. For arbitrary B none of these cancels B entirely. In particular the extra carry in (0,1) gives A+B+1, not A+1. Thus only addition and subtraction are generally available: A.

Solution: The gates feeding the B inputs are XOR gates. For an n-bit word the circuit computes A+(B XOR K…K)+C₀ modulo 2ⁿ. Setting (K,C₀)=(0,0) gives A+B; setting (1,1) gives A+¬B+1=A−B. Neither setting can remove arbitrary B to give A+1 solely by changing those two control lines. Therefore A+B and A−B, but not general A+1, is option A.

Original paper, page 6

2 marks · MCQ
Report issue

Transitions through cascaded delayed XOR gates

Counters & Timing

Question 47, GATE 2003: Two zero-delay XOR gates are cascaded. The first receives A directly and A through a non-inverting buffer delayed by 2 ns. Its output X feeds the second XOR directly and through a non-inverting buffer delayed by 4 ns. All wires/gates except those buffers have zero delay, and every signal is initially 0. A rises from 0 to 1 at t=1 ns and stays 1. How many transitions occur at the final output B from t=0 to 10 ns?
A. 1  B. 2  C. 3  D. 4
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Before 1 ns both first-XOR inputs are 0. At 1 ns its direct input rises, but its delayed input stays 0 until 3 ns. Therefore X is 1 exactly on [1,3).
2. The 4 ns delayed copy of X is 1 on [5,7). The second XOR is high when exactly one copy is high, so B is high on those two nonoverlapping intervals.
3. List the changes: 0→1 at 1 ns, 1→0 at 3 ns, 0→1 at 5 ns, and 1→0 at 7 ns. There are four, giving D.

Solution: Let A(t) rise once at t=1 ns. The first XOR output is A(t) XOR A(t−2), a pulse on [1,3). The second output XORs this pulse with its copy delayed by 4 ns. The copies occupy [1,3) and [5,7), so they do not overlap and the output changes at 1,3,5,7 ns. There are four transitions in the stated interval, option D.

Original paper, page 6

2 marks · MCQ
Report issue

Counting set bits with carry rotations

Instructions & Addressing Modes

Question 48, GATE 2003: A, B and C are 8-bit registers in a hypothetical processor. The program is:
MOV B,#0       ; B=0
MOV C,#8       ; C=8
Z: CMP C,#0    ; compare C with zero
JZ X          ; jump if zero flag is set
SUB C,#1      ; C=C-1
RRC A,#1      ; rotate A right through carry once
JC Y          ; jump if carry is set
JMP Z
Y: ADD B,#1   ; B=B+1
JMP Z
X:
RRC transforms A=a7...a0 and carry=c into A=ca7...a1 and carry=a0. Use the instruction effects listed for this hypothetical machine.
If A initially equals A0, what is B after execution?
A. Number of 0 bits in A0
B. Number of 1 bits in A0
C. A0
D. 8
Question 48, GATE 2003: A, B and C are 8-bit registers in a hypothetical processor. The program is:
MOV B,#0       ; B=0
MOV C,#8       ; C=8
Z: CMP C,#0    ; compare C with zero
JZ X          ; jump if zero flag is set
SUB C,#1      ; C=C-1
RRC A,#1      ; rotate A right through carry once
JC Y          ; jump if carry is set
JMP Z
Y: ADD B,#1   ; B=B+1
JMP Z
X:
RRC transforms A=a7...a0 and carry=c into A=ca7...a1 and carry=a0. Use the instruction effects listed for this hypothetical machine.
If A initially equals A0, what is B after execution?
A. Number of 0 bits in A0
B. Number of 1 bits in A0
C. A0
D. 8
Question 48, GATE 2003: A, B and C are 8-bit registers in a hypothetical processor. The program is:
MOV B,#0       ; B=0
MOV C,#8       ; C=8
Z: CMP C,#0    ; compare C with zero
JZ X          ; jump if zero flag is set
SUB C,#1      ; C=C-1
RRC A,#1      ; rotate A right through carry once
JC Y          ; jump if carry is set
JMP Z
Y: ADD B,#1   ; B=B+1
JMP Z
X:
RRC transforms A=a7...a0 and carry=c into A=ca7...a1 and carry=a0. Use the instruction effects listed for this hypothetical machine.
If A initially equals A0, what is B after execution?
A. Number of 0 bits in A0
B. Number of 1 bits in A0
C. A0
D. 8
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. The C test is before the decrement: C=8,7,...,1 each enters the body, while C=0 exits. There are exactly eight rotations.
2. Write the original bits as a7...a0. The successive carry outputs are a0,a1,...,a7. Any incoming carry sits at the top and cannot emerge until a ninth rotation.
3. Only JC Y reaches ADD B,#1. Thus B increases once for every outgoing 1 and never for an outgoing 0. Starting from zero it ends at a0+...+a7, the population count: B.

Solution: The counter C starts at eight and the loop performs exactly eight one-bit right rotations through carry. The carry tested immediately after the kth rotation is the kth original low-to-high bit of A. Newly inserted carry bits cannot reach the outgoing low position during these eight iterations. B starts at zero and is incremented exactly when the outgoing bit is one, so B is the population count of the original A, option B.

Original paper, page 7

2 marks · MCQ
Report issue

Restoring an eight-bit register after through-carry rotations

Instructions & Addressing Modes

Question 49, GATE 2003: A, B and C are 8-bit registers in a hypothetical processor. The program is:
MOV B,#0       ; B=0
MOV C,#8       ; C=8
Z: CMP C,#0    ; compare C with zero
JZ X          ; jump if zero flag is set
SUB C,#1      ; C=C-1
RRC A,#1      ; rotate A right through carry once
JC Y          ; jump if carry is set
JMP Z
Y: ADD B,#1   ; B=B+1
JMP Z
X:
RRC transforms A=a7...a0 and carry=c into A=ca7...a1 and carry=a0. Use the instruction effects listed for this hypothetical machine.
Which instruction inserted at X ensures that A ends with its original value?
A. RRC A,#1
B. NOP (no operation)
C. LRC A,#1 (rotate A left through carry once)
D. ADD A,#1
Question 49, GATE 2003: A, B and C are 8-bit registers in a hypothetical processor. The program is:
MOV B,#0       ; B=0
MOV C,#8       ; C=8
Z: CMP C,#0    ; compare C with zero
JZ X          ; jump if zero flag is set
SUB C,#1      ; C=C-1
RRC A,#1      ; rotate A right through carry once
JC Y          ; jump if carry is set
JMP Z
Y: ADD B,#1   ; B=B+1
JMP Z
X:
RRC transforms A=a7...a0 and carry=c into A=ca7...a1 and carry=a0. Use the instruction effects listed for this hypothetical machine.
Which instruction inserted at X ensures that A ends with its original value?
A. RRC A,#1
B. NOP (no operation)
C. LRC A,#1 (rotate A left through carry once)
D. ADD A,#1
Question 49, GATE 2003: A, B and C are 8-bit registers in a hypothetical processor. The program is:
MOV B,#0       ; B=0
MOV C,#8       ; C=8
Z: CMP C,#0    ; compare C with zero
JZ X          ; jump if zero flag is set
SUB C,#1      ; C=C-1
RRC A,#1      ; rotate A right through carry once
JC Y          ; jump if carry is set
JMP Z
Y: ADD B,#1   ; B=B+1
JMP Z
X:
RRC transforms A=a7...a0 and carry=c into A=ca7...a1 and carry=a0. Use the instruction effects listed for this hypothetical machine.
Which instruction inserted at X ensures that A ends with its original value?
A. RRC A,#1
B. NOP (no operation)
C. LRC A,#1 (rotate A left through carry once)
D. ADD A,#1
Tap to enlarge
Your answer
Answer & solution

Answer: A under the stated instruction effects (no official key was published)

1. Include carry in the state: (c,a7,a6,...,a0) is a nine-position ring. One RRC moves this ring one position right.
2. The loop performs eight rotations, so its accumulated permutation is R8. Since R9 is the identity, another RRC restores all nine bits.
3. NOP leaves R8 unchanged; one left rotation gives R7, not identity; adding 1 is not a bit-position inverse. Hence A works under the given instruction effects. This explicitly relies on other listed instructions not modifying carry.

Solution: Treat carry and A together as a nine-bit circular register and use the instruction effects stated for this hypothetical processor. Eight right rotations leave one right rotation short of a full nine-bit cycle. Inserting RRC A,#1 at X therefore restores A, irrespective of the initial carry value, giving A. This reasoning uses carry preservation by instructions whose listed effects do not change carry; importing different flag side effects from a real ISA would require a new analysis.

Original paper, page 7

2 marks · MCQ
Report issue

Counting constrained binary strings accepted by a DFA

Finite Automata

Question 50, GATE 2003: A DFA over {0,1} has states q0 (start), q1, q2 and q3 (the only accepting state). Transitions: q0 on 1→q0 and 0→q1; q1 on 1→q0 and 0→q2; q2 on 0→q2 and 1→q3; q3 on either symbol→q3. Let S contain seven-bit strings whose first, fourth and last bits are 1. How many strings of S are accepted?
A. 1  B. 5  C. 7  D. 8
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Reaching q2 requires two consecutive zeros; after reaching q2 a later 1 enters the absorbing accepting state q3.
2. Strings of S have form 1xy1zw1, leaving four free bits and 16 total strings. Adjacent zeros can occur only as xy=00 or zw=00, because fixed 1s separate the blocks.
3. Fixing xy=00 leaves four choices for zw; fixing zw=00 leaves four choices for xy. The string 1001001 is counted twice. Inclusion–exclusion yields 4+4−1=7, so C.

Solution: The DFA accepts precisely strings that contain two consecutive zeros followed later by a one. With positions 1,4,7 fixed to one, a qualifying pair of zeros must occupy positions 2–3 or 5–6, and the following fixed one guarantees acceptance. Of the 16 assignments to the four free bits, four have the first zero pair, four have the second, and one has both. Inclusion–exclusion gives 4+4−1=7 accepted strings, option C.

Original paper, page 7

2 marks · MCQ
Report issue

Deterministic recognition of balanced brackets

Context-Free Grammars & Languages

Question 51, GATE 2003: Let G=({S},{a,b},R,S), where R is S→aSb | SS | ε. Which statement is true?
A. G is not ambiguous.
B. There exist x,y in L(G) with xy not in L(G).
C. A deterministic pushdown automaton accepts L(G).
D. A deterministic finite-state automaton accepts L(G).
Question 51, GATE 2003: Let G=({S},{a,b},R,S), where R is S→aSb | SS | ε. Which statement is true?
A. G is not ambiguous.
B. There exist x,y in L(G) with xy not in L(G).
C. A deterministic pushdown automaton accepts L(G).
D. A deterministic finite-state automaton accepts L(G).
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Interpret a as an opening bracket and b as a closing bracket. aSb encloses a balanced string, SS concatenates two balanced strings, and ε is balanced. Conversely, split any nonempty balanced string at its first matching close to obtain these productions.
2. A deterministic stack machine pushes on a, pops on b, rejects a pop from an empty stack, and accepts exactly with empty stack at end. This establishes C.
3. A is false: ε has both the direct S→ε tree and S→SS→εε. B is false because S→SS supplies closure under concatenation. D is false because intersecting with regular a*b* leaves the nonregular language {an bn:n≥0}.

Solution: The grammar generates balanced strings with a as opening bracket and b as closing bracket, including concatenations and the empty word. A deterministic pushdown automaton pushes on a, pops on b, rejects an unmatched b, and accepts at the end exactly when its stack is empty. Thus C is true. The grammar itself is ambiguous, for example ε can be produced directly or through S→SS with two empty children. Its language is closed under concatenation by S→SS and is not regular, since intersection with a*b* gives {aⁿbⁿ:n≥0}.

Original paper, page 7

2 marks · MCQ
Report issue

Decidability under a polynomial-time language isomorphism

Decidability & Computability

Question 52, GATE 2003: L1 and L2 are languages over Σ. A bijection f:Σ*→Σ* and its inverse are polynomial-time computable, and for every x, x∈L1 iff f(x)∈L2. Which cannot hold?
A. L1∈P and L2 is finite
B. L1∈NP and L2∈P
C. L1 is undecidable and L2 is decidable
D. L1 is recursively enumerable and L2 is recursive
Source caveat: GateForum drops the stars in the displayed domain/codomain; the GFG string-domain version is used here.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Suppose L2 has a decider D2. An algorithm for L1 computes f(x), which always terminates, then returns D2(f(x)). The membership equivalence makes this algorithm correct and terminating.
2. Thus decidability of L2 forces decidability of L1, contradicting C. In fact the inverse supplies the converse reduction too.
3. The other combinations are not contradictions. Take f to be identity and L1=L2=∅: the language is finite, in P and NP, recursive and recursively enumerable. This single example witnesses the possibility of A, B and D.

Solution: If L₂ is decidable, compute f(x) and run its decider; the membership equivalence decides L₁. Hence an undecidable L₁ and decidable L₂ cannot coexist, option C. The other alternatives are possible by choosing finite or otherwise polynomial-time decidable languages: P is contained in NP, and recursively enumerable does not mean nonrecursive.

Original paper, page 7

2 marks · MCQ
Report issue

Nonhalting behavior of a two-state Turing machine

Turing Machines

Question 53, GATE 2003: A single-tape Turing machine has states q0 (start), q1, tape symbols {0,1,B}, and input alphabet {0,1}; B is blank. A transition (q,s,D) means write s, move D, enter q. The table is:
q0 on 0: (q1,1,R); on 1: (q1,1,R); on B: Halt.
q1 on 0: (q1,1,R); on 1: (q0,1,L); on B: (q0,B,L).
Which is true?
A. M does not halt on any string in (0+1)+.
B. M does not halt on any string in (00+1)*.
C. M halts on all strings ending in 0.
D. M halts on all strings ending in 1.
Here + between symbols is union and superscript + means one or more repetitions.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Empty input starts with a blank under q0 and halts immediately. Since ε belongs to (00+1)*, B cannot be true.
2. On any nonempty input q0 writes a 1 and moves right into q1. q1 passes over zeros, replacing each with 1, until reaching either a preexisting 1 or the right-hand blank.
3. At this boundary q1 moves left to q0. That left cell is now 1, so q0 moves right into q1 without changing it. q1 sees the same boundary symbol and moves left again. These two configurations repeat forever.
4. This applies to every nonempty binary input, regardless of its final symbol. Hence A, not C or D.

Solution: On a nonempty input, q₀ writes 1 in the first cell and moves right in q₁. State q₁ changes any subsequent zeros to ones and moves right until it sees a 1 or the first blank. At either such boundary it moves left into q₀. The cell to its left is now 1, so q₀ moves right again to the boundary in q₁, producing a two-configuration loop. Thus every nonempty binary input diverges, option A. Empty input halts immediately, so option B, whose starred language includes ε, is false.

Original paper, page 7

2 marks · MCQ
Report issue

Tagged halting and nonhalting languages

Decidability & Computability

Question 54, GATE 2003: Define L0={⟨M,w,0⟩: M halts on w} and L1={⟨M,w,1⟩: M does not halt on w}, where M is a Turing-machine encoding, w a string and the last component a bit. Let L=L0∪L1. Which is true?
A. L is recursively enumerable but its complement is not.
B. Its complement is recursively enumerable but L is not.
C. Both L and its complement are recursive.
D. Neither L nor its complement is recursively enumerable.
Question 54, GATE 2003: Define L0={⟨M,w,0⟩: M halts on w} and L1={⟨M,w,1⟩: M does not halt on w}, where M is a Turing-machine encoding, w a string and the last component a bit. Let L=L0∪L1. Which is true?
A. L is recursively enumerable but its complement is not.
B. Its complement is recursively enumerable but L is not.
C. Both L and its complement are recursive.
D. Neither L nor its complement is recursively enumerable.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. The halting language H is recognizable, but its complement is not recognizable: recognizers for both would yield a decider by dovetailing them.
2. Map each halting-instance pair (M,w) to ⟨M,w,1⟩. It belongs to L exactly when M does not halt. Therefore a recognizer for L would recognize the complement of H, impossible.
3. Map the same pair to ⟨M,w,0⟩. It belongs to the complement of L exactly when M does not halt. A recognizer for that complement would give the same contradiction.
4. Neither tagged language is recognizable, so D. The different tags are essential; halting and nonhalting cases are not simply being unioned without a tag.

Solution: Let H be the halting language. If L were recursively enumerable, mapping (M,w) to ⟨M,w,1⟩ would make the complement of H recursively enumerable, a contradiction. If the complement of L were recursively enumerable, mapping (M,w) to ⟨M,w,0⟩ would again recognize the complement of H. Therefore neither L nor its complement is recursively enumerable, option D. The tag prevents the union from simply being the universal set.

Original paper, page 7

2 marks · MCQ
Report issue

Flipping final states in an NFA

Finite Automata

Question 55, GATE 2003: An NFA M over {0,1} has states p (start), q and r (only final). Transitions are p→q on 0 or 1; q→p on 0; q→q on 0 or 1; p→r on 1; q→r on 0; r→q on 0. There are no other transitions. Let L=L(M). M1 is obtained by making r nonfinal and p,q final, and L1=L(M1). Which statement is true?
A. L1={0,1}*−L
B. L1={0,1}*
C. L1⊆L
D. L1=L
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. Since p is final in M1, ε is accepted.
2. For any nonempty word, choose p→q on its first symbol. Then choose the 0/1 loop at q for every remaining symbol. This accepting run exists for every word.
3. Therefore L1 is the universal binary language, B. In particular ε∈L1 but ε∉L, ruling out C and D. Since 1∈L as well as L1, they are not complements, ruling out A. NFA acceptance is existential over runs, which is why simply flipping finals fails as a complement construction.

Solution: After the flip, the initial left state and the upper-right state are accepting. The empty string is accepted at the initial state. For every nonempty binary string, choose the transition from the initial state to the upper-right state on its first symbol and then use that state’s 0/1 loop for the suffix. Therefore the new language is all of {0,1}*, option B. Flipping final states complements a complete DFA, not a general NFA.

Original paper, page 8

2 marks · MCQ
Report issue

Predictive-table conflict for a dangling-else grammar

Parsing & Syntax Analysis

Question 56, GATE 2003: For the grammar S→iEtSS′ | a; S′→eS | ε; E→b, consider the usual predictive parsing table M with end marker $. What are M[S′,e] and M[S′,$], respectively?
A. {S′→eS}, {S′→ε}
B. {S′→eS}, ∅
C. {S′→ε}, {S′→ε}
D. {S′→eS,S′→ε}, {S′→ε}
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (2 parts)

1. FIRST(eS)={e}, so insert S′→eS in the e column.
2. S is the start symbol, so $∈FOLLOW(S). In S→iEtSS′, the first S is followed by nullable S′ whose nonempty FIRST is {e}; hence e∈FOLLOW(S) as well.
3. The final S′ inherits FOLLOW(S), giving FOLLOW(S′)={e,$}. For the ε production, put S′→ε in every FOLLOW column, therefore both e and $.
4. The resulting cells are {eS,ε} and {ε}, option D. The two entries in the e cell are the dangling-else conflict, so the grammar itself is not LL(1).

Solution: FIRST(eS)={e}, so the rule S′→eS enters M[S′,e]. Because S′ can be empty and follows S in S→iEtSS′, e belongs to FOLLOW(S), while $ belongs to FOLLOW(S) because S is the start symbol. The trailing S′ inherits FOLLOW(S), giving FOLLOW(S′)={e,$}. Thus S′→ε also enters both cells. The e cell contains both alternatives and the $ cell contains only ε, option D; the conflict means this grammar is not LL(1).

Original paper, page 8

2 marks · MCQ
Report issue

LL(1) classification from disjoint FIRST sets

Parsing & Syntax Analysis

Question 57, GATE 2003: Consider S→CC and C→cC | d. This grammar is:
A. LL(1)
B. SLR(1) but not LL(1)
C. LALR(1) but not SLR(1)
D. LR(1) but not LALR(1)
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Step through it (2 parts)

1. C generates zero or more c symbols followed by d. Its alternatives begin with distinct terminal symbols: FIRST(cC)={c} and FIRST(d)={d}.
2. Neither C alternative is nullable, so no FIRST/FOLLOW overlap can create a second entry in its parsing-table cells. Put C→cC under c and C→d under d.
3. S has only one production; under either c or d use S→CC. No table cell has two choices. Thus one lookahead symbol always selects a production and the grammar is LL(1), A.

Solution: For C→cC|d the alternatives have disjoint FIRST sets {c} and {d}, and neither can derive ε. S has only its single production S→CC. Therefore every predictive-table cell has at most one production and the grammar is LL(1), option A. No stronger bottom-up distinction is needed.

Original paper, page 8

2 marks · MCQ
Report issue

Output order of embedded translation actions

Semantic Analysis & Type Checking

Question 58, GATE 2003: A translation scheme is S→TR; R→+ T {print('+');} R | ε; T→num {print(num.val);}. Token num represents an integer, and num.val is its value. For input 9+5+2, what is printed?
A. 9+5+2
B. 95+2+
C. 952++
D. ++952
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step through it (19 steps)

1. Expand S→TR. The initial T consumes 9 and immediately prints 9.
2. The first R consumes + and invokes T on 5, printing 5. Its following action prints + before the recursive R begins.
3. That recursive R consumes +, invokes T on 2 and prints 2, then prints +. Its final R chooses ε and prints nothing.
4. Concatenating the actions yields 9,5,+,2,+, or 95+2+, B. Moving the plus action to after the recursive R would change the result, but that is not this scheme.

Solution: The initial T prints 9. Each R expansion reads +, processes T (which prints the next number), prints +, and only then processes the remaining R. Hence the execution order is 9,5,+,2,+, yielding 95+2+, option B. The action is before the recursive R, so it does not postpone both plus signs to the end.

Original paper, page 8

2 marks · MCQ
Report issue

Three-address code from synthesized expression locations

Intermediate Code

Question 59, GATE 2003: A syntax-directed definition uses:
S→id := E {gen(id.place '=' E.place);}
E→E1+E2 {t=newtemp(); gen(t '=' E1.place '+' E2.place); E.place=t;}
E→id {E.place=id.place;}
gen emits code and newtemp returns a fresh temporary t1,t2,... on each call. For X=Y+Z, what three-address code is generated?
A. X=Y+Z
B. t1=Y+Z; X=t1
C. t1=Y; t2=t1+Z; X=t2
D. t1=Y; t2=Z; t3=t1+t2; X=t3
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. Reduce identifier Y using E→id: set its place to Y without generating an instruction. Reduce Z the same way, with place Z.
2. At the addition node, call newtemp once to obtain t1. Emit t1=Y+Z and make the addition expression's place t1.
3. At the assignment node, use X as the destination and the completed expression place as source. Emit X=t1.
4. The ordered output is precisely B. No identifier-copy actions occur in the definition, ruling out C and D; the addition action cannot be bypassed to get A.

Solution: An identifier expression uses the identifier’s existing place and emits no copy. The addition allocates one temporary and emits t₁=Y+Z, after which its place is t₁. The assignment then emits X=t₁. Thus the two-instruction sequence in B follows directly; no temporaries are needed merely to refer to Y and Z.

Original paper, page 8

2 marks · MCQ
Report issue

Distribution of the sum of module runtimes

Probability & Statistics

Question 60, GATE 2003: A program executes two modules sequentially. Their execution times have probability densities f1(t),f2(t). Which expression gives the density of total execution time?
A. f1(t)+f2(t)
B. ∫[0,t] f1(x)f2(x) dx
C. ∫[0,t] f1(x)f2(t−x) dx
D. max{f1(t),f2(t)} [GateForum; GFG instead prints max{f1(t)+f2(t)}.]
The statement does not explicitly assert independence.
Tap to enlarge
Your answer
Answer & solution

Answer: C if the runtimes are independent; otherwise underdetermined (no official key was published)

1. Let T=T1+T2. A contribution to density near t with T1=x must have T2 near t−x, not x. Nonnegative runtimes restrict x to [0,t].
2. If T1,T2 are independent, their joint density is f1(x)f2(y). Integrating along x+y=t yields ∫[0,t]f1(x)f2(t−x)dx, C.
3. Marginal densities alone do not supply that product. For example, if both times are uniform on [0,1], independent times give a triangular sum density, whereas T2=T1 gives a uniform sum on [0,2]. Sequential execution permits either dependency.
4. Therefore C is conditional on independence; the literal problem is underdetermined. One cannot infer independence merely because the modules run one after another.

Solution: For independent nonnegative runtimes T₁,T₂, the density of T₁+T₂ is the convolution f(t)=∫₀ᵗ f₁(x)f₂(t−x) dx, option C. Sequential execution alone does not imply independence. In general the answer is ∫₀ᵗ f₁₂(x,t−x) dx using a joint density, when one exists, and marginal densities f₁,f₂ do not determine it. The same marginal distributions can give different sums under different dependencies, so C requires an extra independence assumption not stated in the paper.

Original paper, page 8

2 marks · MCQ
Report issue

Expected inversion count in a uniform permutation

Probability & Random Variables

Question 61, GATE 2003: For a permutation a1,...,an of n distinct integers, an inversion is an index pair i<j with ai>aj. All permutations of 1,...,n are equally likely. What is the expected inversion count?
A. n(n−1)/2
B. n(n−1)/4
C. n(n+1)/4
D. 2n floor(log2 n)
Question 61, GATE 2003: For a permutation a1,...,an of n distinct integers, an inversion is an index pair i<j with ai>aj. All permutations of 1,...,n are equally likely. What is the expected inversion count?
A. n(n−1)/2
B. n(n−1)/4
C. n(n+1)/4
D. 2n floor(log2 n)
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. There are choose(n,2)=n(n−1)/2 pairs of distinct positions i<j.
2. For any fixed pair, exchanging their two entries pairs every ordering ai>aj with an equally likely ordering ai<aj. Distinctness excludes equality, so the inversion probability is 1/2.
3. Let Iij be 1 for an inversion and 0 otherwise. Then E[Iij]=1/2 and total inversions I=Σi<j Iij.
4. Linearity gives E[I]=Σ E[Iij]=n(n−1)/4, B. Although different pairs' indicators may be dependent, linearity does not require independence.

Solution: For each of the n(n−1)/2 index pairs i<j, define an indicator for aᵢ>aⱼ. Symmetry gives probability 1/2 for each pair. By linearity of expectation, the expected inversion count is [n(n−1)/2]×1/2=n(n−1)/4, option B. Independence among those indicators is unnecessary.

Original paper, page 9

2 marks · MCQ
Report issue

Insertion sort on inputs with few inversions

Searching, Sorting & Selection

Question 62, GATE 2003: For a permutation a1,...,an of n distinct integers, an inversion is an index pair i<j with ai>aj. What is insertion sort's worst-case time if inputs are restricted to permutations of 1,...,n with at most n inversions?
A. Θ(n²)  B. Θ(n log n)  C. Θ(n^1.5)  D. Θ(n)
Question 62, GATE 2003: For a permutation a1,...,an of n distinct integers, an inversion is an index pair i<j with ai>aj. What is insertion sort's worst-case time if inputs are restricted to permutations of 1,...,n with at most n inversions?
A. Θ(n²)  B. Θ(n log n)  C. Θ(n^1.5)  D. Θ(n)
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. In insertion sort, a larger element shifts right exactly when it is an inversion partner of the current key. Each original inversion causes one such shift and is then removed.
2. With I inversions, the inner loops therefore make I shifts. The n−1 outer iterations and their final failed/boundary tests add Θ(n) work, so total work is Θ(n+I).
3. The restriction I≤n gives O(n+n)=O(n). Reading and processing n entries still requires Ω(n), including an already sorted input.
4. Matching the upper and lower bounds gives Θ(n), D. The unrestricted reverse-order example has Θ(n²) inversions and is excluded here.

Solution: In standard insertion sort, shifting an earlier larger element past the current key removes exactly one inversion. Total shifts equal the input inversion count I, and outer-loop work plus terminating comparisons contributes Θ(n). Hence running time is Θ(n+I). With I≤n this is O(n), while scanning the n elements requires Ω(n), so the restricted worst case is Θ(n), option D.

Original paper, page 9

2 marks · MCQ
Report issue

Ordered set supporting minimum deletion and unique insertion

Binary Search & Balanced Trees

Question 63, GATE 2003: A set of n integers must support (I) deleting its smallest element and (II) inserting an element only if it is not already present, each in O(log n) time. Which structure suffices?
A. A heap, but not a balanced binary search tree
B. A balanced binary search tree, but not a heap
C. Both a balanced binary search tree and a heap
D. Neither
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. A balanced binary search tree has height O(log n). Follow left children to the minimum and delete/rebalance in O(log n). Search for a proposed key and, if absent, insert/rebalance along one root-to-leaf path in O(log n).
2. A min-heap can delete its root and sift down in O(log n), and can insert a known-new key in O(log n).
3. However, a heap is only partially ordered. Testing whether an arbitrary key already appears can require inspecting Θ(n) positions; insertion-if-absent includes that test.
4. Thus the balanced tree alone meets both requirements, B. A heap augmented with a separate search index is not the plain heap being compared.

Solution: A balanced binary search tree supports membership search, insertion, and deletion of its minimum in O(log n) worst-case time. A plain heap supports minimum deletion and unrestricted insertion in O(log n), but checking whether an arbitrary proposed value is already present may require Θ(n) comparisons. Therefore the uniqueness requirement rules out the heap alone, leaving B. Augmenting a heap with a separate membership structure is outside the listed plain-structure comparison.

Original paper, page 9

2 marks · MCQ
Report issue

Average residence time in a push-then-pop stack

Stacks & Queues

Question 64, GATE 2003: An initially empty stack of capacity n≥1 receives pushes of 1,...,n in order, followed by n pops. Each push/pop takes X seconds; a gap of Y seconds separates the end of each operation from the start of the next. The stack-life of m is the interval from the end of push(m) to the start of the pop removing m. What is the average stack-life?
A. n(X+Y)
B. 3Y+2X
C. n(X+Y)−X
D. Y+2X
Question 64, GATE 2003: An initially empty stack of capacity n≥1 receives pushes of 1,...,n in order, followed by n pops. Each push/pop takes X seconds; a gap of Y seconds separates the end of each operation from the start of the next. The stack-life of m is the interval from the end of push(m) to the start of the pop removing m. What is the average stack-life?
A. n(X+Y)
B. 3Y+2X
C. n(X+Y)−X
D. Y+2X
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. LIFO means m is removed after the n−m elements above it. Between the two specified endpoints lie n−m later pushes and n−m earlier pops, a total of 2(n−m) complete operations.
2. There is one more gap than intervening operations, so life(m)=2(n−m)X+[2(n−m)+1]Y. The push of m and its own pop are excluded by the endpoint definition.
3. Average n−m over m=1,...,n: [0+...+(n−1)]/n=(n−1)/2. Substitution gives (n−1)X+nY=n(X+Y)−X.
4. Hence C. For n=1, life is just Y, confirming the endpoint accounting.

Solution: For item m, there are n−m later pushes and n−m earlier pops between the end of push(m) and the start of its pop. Those 2(n−m) complete intervening operations cost 2(n−m)X and the 2(n−m)+1 gaps cost [2(n−m)+1]Y. Average n−m over m=1,…,n is (n−1)/2, so the mean is (n−1)X+nY=n(X+Y)−X, option C. For n=1 it correctly reduces to the single gap Y.

Original paper, page 9

2 marks · MCQ
Report issue

Inserting a key in a 2–3–4 tree

B-Trees & Multiway Search Trees

Question 65, GATE 2003: A 2–3–4 tree (B-tree of minimum degree 2) stores letters in alphabetical order. Its root is [L,P,U], with leaf children [B,H,I], [N], [Q,T], [V,X,Z] from left to right. GateForum asks for the result of inserting G; that request is omitted in GFG. Candidate trees (children listed left to right) are:
A. Root [P]; internal children [G,L] and [U]. Their leaf children are [B],[H,I],[N] and [Q,T],[V,X,Z].
B. Root [P]; internal children [H,L] and [U]. Their leaf children are [B,G],[I],[N] and [Q,T],[V,X,Z].
C. Root [I,P,U], with leaves [B,G,H],[L,N],[Q,T],[V,X,Z].
D. None of the above.
Use standard split-before-descent insertion to select the conventional result; the statement does not explicitly specify its insertion policy.
Tap to enlarge
Your answer
Answer & solution

Answer: B under standard split-before-descent insertion (no official key was published)

1. A minimum-degree-2 node holds at most three keys. The initial root is full, so split it before descending: promote P to a new root; its children hold [L] and [U]. The old four leaves are divided two per child.
2. G<P and G<L, so descend toward [B,H,I]. This child is full too. Promote its median H into [L], giving [H,L], and replace the leaf by [B] and [I].
3. G<H, so insert it into [B] to obtain [B,G]. The other leaves stay [I],[N],[Q,T],[V,X,Z]. These are exactly the links in B.
4. This is algorithm-dependent: A can arise under a bottom-up split choice, and C under redistribution. Neither the invariants alone nor the incomplete the wording uniquely force B.

Under standard top-down B-tree insertion, first split the full root [L,P,U], promoting P and giving children [L] and [U]. Descending left, split its full child [B,H,I], promoting H into [L] to obtain [H,L] and leaves [B],[I],[N]. Insert G into [B], giving [B,G]. The result is option B, with root [P], left child [H,L] and right child [U]. A different valid insertion policy can produce another valid B-tree: A follows suitable bottom-up split choices, and C uses redistribution to a sibling. Consequently B is the conventional algorithmic answer, not a uniquely forced tree from the B-tree invariants alone.

Original paper, page 9

2 marks · MCQ
Report issue

Bit complexity of integer cube root

Asymptotic Analysis & Recurrences

Question 66, GATE 2003: The integer cube root of a natural number n is the largest natural m with m³≤n. The input n is represented in binary. Which describes its computation complexity?
A. O(n), but not O(n^0.5)
B. O(n^0.5), but not O((log n)^k) for any constant k>0
C. O((log n)^k) for some constant k>0, but not O((log log n)^m) for any constant m>0
D. O((log log n)^k) for some constant k>0.5, but not O((log log n)^0.5)
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. The input length is b=floor(log2 n)+1; complexity in n and in the bit length b must not be confused.
2. Binary search the integer interval [0,n], retaining the largest tested m with m³≤n. Halving the interval takes O(log n)=O(b) iterations.
3. Using schoolbook arithmetic, a multiplication of O(b)-bit numbers costs O(b²); two multiplications form m³. Hence this explicit algorithm costs O(b³), polynomial in log n.
4. The output cube root has about b/3 bits, so even writing it costs Ω(b), which dominates every fixed power of log b. Thus a polynomial in log log n cannot suffice in the bit model, and C follows.

Solution: Let b be the number of input bits, so b=Theta(log n). Binary search for the largest m with m³≤n needs O(b) comparisons. Schoolbook multiplication computes a b-bit cube in O(b²) bit operations, giving an explicit O(b³) algorithm. The answer itself has Theta(b) bits for growing n, so writing it already requires Omega(b) bit operations. Thus the problem is polynomial in log n, but not polynomial in log log n, option C. This is a bit-complexity statement, not a unit-cost model for arbitrarily large integers.

Original paper, page 9

2 marks · MCQ
Report issue

Detecting subgraph connectivity with zero-weight edges

Graph Algorithms

Question 67, GATE 2003: G=(V,E) is an undirected graph with subgraph G1=(V1,E1). Give an edge weight 0 if it is in E1, and 1 otherwise. Run single-source shortest paths from an arbitrary v1∈V1. Which property can always be inferred from the computed path costs?
A. Number of edges in shortest paths from v1 to every vertex of G
B. G1 is connected
C. V1 forms a clique in G
D. G1 is a tree
Interpret B as determining whether G1 is connected, not asserting connectivity on every input.
Question 67, GATE 2003: G=(V,E) is an undirected graph with subgraph G1=(V1,E1). Give an edge weight 0 if it is in E1, and 1 otherwise. Run single-source shortest paths from an arbitrary v1∈V1. Which property can always be inferred from the computed path costs?
A. Number of edges in shortest paths from v1 to every vertex of G
B. G1 is connected
C. V1 forms a clique in G
D. G1 is a tree
Interpret B as determining whether G1 is connected, not asserting connectivity on every input.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. With only weights 0 and 1, a finite path has total cost 0 precisely when all of its edges belong to E1.
2. Hence d(v1,v)=0 precisely for vertices in the G1 component of v1. Test this for every v∈V1: all distances zero means G1 is connected; any positive/infinite distance means it is not.
3. Cost does not count zero-weight edges. A zero-weight chain and a zero-weight clique on V1 can give identical distance-zero results but different edge counts and cycle structure.
4. Thus the distances determine connectivity (B), but neither clique/tree status nor shortest-path edge counts.

Solution: An edge has weight zero exactly when it belongs to E1. Consequently, for a vertex v in V1, distance(v1,v)=0 exactly when v is connected to v1 using only edges of G1. Checking whether every vertex of V1 has zero distance therefore decides whether G1 is connected, B. Zero distances do not reveal edge counts, clique structure, or acyclicity: a tree and a triangle within the reachable zero-weight component can have identical distances. B must be read as determining connectivity, not asserting that every possible input G1 is connected.

Original paper, page 9

2 marks · MCQ
Report issue

Minimum spanning tree of a weighted graph

Graph Algorithms

Question 68, GATE 2003: Find the weight of a minimum spanning tree of the undirected weighted graph with vertices a,b,c,d,e,f,g,h,i,j and edges:
ac:1; ad:2; cd:2; bg:2; ei:2; bd:3; fh:4; hi:4; ij:5; ab:6; ae:8; eh:8; gh:8; fi:9; ef:11; gi:14; dh:15; gj:19.
These edges describe the complete printed diagram; no other edges are present.
A. 29  B. 31  C. 38  D. 41
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step through it (15 steps)

1. Kruskal processes edges by nondecreasing weight, accepting an edge only when its endpoints lie in different components.
2. Accept ac(1), ad(2); reject cd(2), since a,c,d are already connected. Accept bg(2), ei(2), then bd(3), which joins {b,g} with {a,c,d}.
3. Accept fh(4), hi(4), connecting {f,h} to {e,i}; accept ij(5) to add j. Reject ab(6), whose endpoints are already in the first component.
4. The two remaining components are {a,b,c,d,g} and {e,f,h,i,j}. Any weight-8 edge ae or gh can join them; choose gh. Nine accepted edges connect all ten vertices.
5. Total=1+2+2+2+3+4+4+5+8=31, B. eh(8) is internal to the second component and is not needed.

Solution: Kruskal's algorithm can select ac(1), ad(2), bg(2), ei(2), bd(3), fh(4), hi(4), ij(5), and gh(8). These nine edges connect all ten vertices without a cycle. Their total is 1+2+2+2+3+4+4+5+8=31, option B. The other weight-2 edge cd is skipped because ac and ad already connect c and d; the final weight-8 edge joins the two remaining components. Equal-weight alternatives may produce a different MST with the same total.

Original paper, page 10

2 marks · MCQ
Report issue

Room allocation from activity endpoints

Greedy Algorithms

Question 69, GATE 2003: Activities A,...,H must each occupy a room throughout their duration. Let xs and xe denote the start and finish of X. The complete GateForum chronological sequence is:
as,bs,cs,ae,ds,ce,es,fs,be,de,gs,ee,fe,hs,ge,he.
GFG instead prints the same sequence with ce omitted. What is the minimum number of rooms?
A. 3  B. 4  C. 5  D. 6
The omission is a material source discrepancy; do not silently insert ce into the GFG version.
Tap to enlarge
Your answer
Answer & solution

Answer: None (no official key was published)

1. For the complete sequence, count a start as +1 and a finish as −1. The successive active counts are 1,2,3,2,3,2,3,4,3,2,3,2,1,2,1,0. The maximum is four, at fs with B,D,E,F simultaneously active.
2. Four rooms suffice constructively: assign room 1 to A,D,G; room 2 to B,H; room 3 to C,E; room 4 to F. Every reuse occurs after that room's previous finish.
4. Without ce, C may or may not still be running at fs, so the the paper sequence can require five rather than four. Preserve the baseline unanswered status for the defective primary version rather than guessing the missing event.

The maximum overlap is four, attained after F starts while B,D,E,F are active. The the paper omits C's finishing event. The incomplete the paper sequence cannot determine a unique answer without supplying the missing endpoint.

Original paper, page 10

2 marks · MCQ
Report issue

Max-plus Floyd recurrence and simple-path bounds

Graph Algorithms

Question 70, GATE 2003: G is a directed n-vertex graph. A path may repeat vertices; a simple path has no repeated vertex. Initialize A[j,k]=1 when edge (j,k) exists, otherwise 0. Run in-place:
for i=1,...,n:
  for j=1,...,n:
    for k=1,...,n:
      A[j,k]=max(A[j,k], A[j,i]+A[i,k])
Which is necessarily true at termination?
A. A[j,k]≤n
B. If A[j,j]≥n−1, G has a Hamiltonian cycle
C. Whenever a path j→k exists, A[j,k] is its longest-path length
D. Whenever a path j→k exists, every simple j→k path has at most A[j,k] edges
Question 70, GATE 2003: G is a directed n-vertex graph. A path may repeat vertices; a simple path has no repeated vertex. Initialize A[j,k]=1 when edge (j,k) exists, otherwise 0. Run in-place:
for i=1,...,n:
  for j=1,...,n:
    for k=1,...,n:
      A[j,k]=max(A[j,k], A[j,i]+A[i,k])
Which is necessarily true at termination?
A. A[j,k]≤n
B. If A[j,j]≥n−1, G has a Hamiltonian cycle
C. Whenever a path j→k exists, A[j,k] is its longest-path length
D. Whenever a path j→k exists, every simple j→k path has at most A[j,k] edges
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Initially every one-edge path has its length represented by A[j,k]≥1. Updates only increase entries, so established lower bounds persist.
2. For a simple path with internal vertices, take its highest-numbered internal vertex i. Splitting there gives two subpaths whose internal vertices have smaller indices. Inductively their lengths are bounded above by A[j,i] and A[i,k] before processing i.
3. The update therefore makes A[j,k] at least the sum of those lengths, the length of the original path. This proves D for every simple path.
4. This is not a correct longest-simple-path algorithm: it never checks that the joined paths are disjoint. Cycles can repeatedly inflate values, and zero is an unsafe unreachable marker for maximizing lengths. Therefore exactness, an n bound and Hamiltonian-cycle inference do not follow.

Solution: The recurrence A[j,k]=max(A[j,k],A[j,i]+A[i,k]) gives option D. Induct on the largest-index internal vertex of a simple path: direct edges start at one; splitting a path at its largest-index internal vertex combines previously established lower bounds for the two pieces. Monotone updates cannot destroy them. Thus the final A[j,k] is at least the length of every simple j-to-k path. It need not equal a longest-path length: cycles and zero values used for nonexistent edges can inflate entries, so the other claims fail. For example, a directed two-vertex cycle with an isolated third vertex can produce values larger than n and large diagonal entries although there is no Hamiltonian cycle. Neither the claimed n bound nor the exact-longest-path interpretation is justified.

Original paper, page 10

2 marks · MCQ
Report issue

Quantifying a Horn rule and an integrity constraint

Propositional & Predicate Logic

Question 71, GATE 2003: Logic program P has clauses A(x)←B(x,y),C(y) and ←B(x,x). Which first-order sentence is equivalent? All variables in clauses are universally quantified.
A. [∀x((∃y(B(x,y)∧C(y)))⇒A(x))] ∧ ¬∃x B(x,x)
B. [∀x((∀y(B(x,y)∧C(y)))⇒A(x))] ∧ ¬∃x B(x,x)
C. [∀x((∃y(B(x,y)∧C(y)))⇒A(x))] ∨ ¬∃x B(x,x)
D. [∀x((∀y(B(x,y)∧C(y)))⇒A(x))] ∧ ∃x B(x,x)
Option D above follows GateForum; GFG instead negates its final existential clause: ¬∃x B(x,x). Neither version changes the correct option A.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. The first clause means ∀x∀y((B(x,y)∧C(y))⇒A(x)). For each fixed x, a single witness y for the body is enough to force A(x).
2. Since y does not occur in A(x), move the body quantifier to obtain ∀x((∃y(B(x,y)∧C(y)))⇒A(x)). Using ∀y inside the antecedent would require every y to satisfy the body before forcing A, a weaker rule.
3. A headless clause is a constraint: B(x,x) must never hold. Thus the second clause means ∀x¬B(x,x), equivalently ¬∃x B(x,x).
4. Both clauses must hold together, requiring conjunction. These components match A exactly.

Solution: The rule says that for every x,y, B(x,y) and C(y) together imply A(x). Since A(x) does not depend on y, this is equivalent to saying for every x that the existence of such a y implies A(x). The headless clause forbids every instance of B(x,x), hence contributes not-exists x B(x,x). A program containing both clauses requires their conjunction. This is option A. Moving a universal quantifier inside the antecedent would weaken the rule; joining the clauses with OR would not enforce both.

Original paper, page 10

2 marks · MCQ
Report issue

Resolution validity and pivot assumptions

Propositional & Predicate Logic

Question 72, GATE 2003: Resolution derives P∨Q from premises P∨R and Q∨¬R. Under the ordinary pivot-free residual-clause convention, which statement is false?
A. ((P∨R)∧(Q∨¬R))⇒(P∨Q) is logically valid.
B. (P∨Q)⇒((P∨R)∨(Q∨¬R)) is logically valid. [This is GFG; GateForum replaces the middle ∨ on the right by ∧.]
C. P∨Q is satisfiable iff (P∨R)∧(Q∨¬R) is satisfiable.
D. (P∨Q)⇒FALSE iff both P and Q are unsatisfiable.
Treat R as a pivot atom not occurring in residual P or Q.
Tap to enlarge
Your answer
Answer & solution

Answer: None (no official key was published)

1. For A, if P and Q were both false, satisfying the first premise would require R=true and satisfying the second would require R=false. This contradiction proves soundness.
2. For C, soundness supplies one direction. Conversely, if P∨Q has a model, extend it with R=false when P is true, or R=true when Q is true. Both premises then hold. This extension uses the pivot-free assumption.
3. D follows because a disjunction has a model exactly when at least one disjunct has a model.
4. The paper B has R∨¬R on its right and is therefore always true. Thus none of its options is false.
5. If arbitrary residual formulas could contain R, C need not hold: P=R,Q=¬R makes the resolvent a tautology and the premises inconsistent. That is a different convention, not a silent repair of the paper.

Solution: Under the ordinary resolution convention, R is the pivot atom and neither residual clause P nor Q contains it. The conjunction of the premises entails P∨Q, so A is sound. Conversely, any satisfying assignment of P∨Q can be extended by an appropriate value of R to satisfy both premises, which establishes the satisfiability equivalence in C without claiming logical equivalence. D expresses that P∨Q is unsatisfiable exactly when both disjuncts are unsatisfiable. The paper B instead uses a disjunction on its right, which contains R∨not-R and is a tautology; under the ordinary convention no the paper option is false. If P and Q may be arbitrary formulas involving R, C also fails: set P=R and Q=not-R. Then the resolvent is a tautology but the premises reduce to R∧not-R. That broader interpretation must not be silently substituted for the conventional pivot-free reading.

Original paper, page 10

2 marks · MCQ
Report issue

Static scope with call-by-need evaluation

Runtime Environments & Parameter Passing

Question 73, GATE 2003: A hypothetical language permits globals but no nested function declarations:
global int i=100, j=5;
void P(x) {
  int i=10;
  print(x+10);
  i=200;
  j=20;
  print(x);
}
main() { P(i+j); }
If the language uses static scoping and call-by-need, what values are printed?
A. 115,220  B. 25,220  C. 25,15  D. 115,105
Question 73, GATE 2003: A hypothetical language permits globals but no nested function declarations:
global int i=100, j=5;
void P(x) {
  int i=10;
  print(x+10);
  i=200;
  j=20;
  print(x);
}
main() { P(i+j); }
If the language uses static scoping and call-by-need, what values are printed?
A. 115,220  B. 25,220  C. 25,15  D. 115,105
Question 73, GATE 2003: A hypothetical language permits globals but no nested function declarations:
global int i=100, j=5;
void P(x) {
  int i=10;
  print(x+10);
  i=200;
  j=20;
  print(x);
}
main() { P(i+j); }
If the language uses static scoping and call-by-need, what values are printed?
A. 115,220  B. 25,220  C. 25,15  D. 115,105
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Under static scope the actual expression i+j is bound to the globals visible at the call in main. P's local i does not replace that lexical binding.
2. Call-by-need postpones evaluation until first use and caches its result. At print(x+10), the actual is first demanded: global i+j=100+5=105. The first print is 105+10=115.
3. P then sets its own local i to 200 and global j to 20. Neither assignment changes the cached value 105.
4. The second print reuses that value, giving 105. Therefore D. Recomputing 100+20 would be call-by-name, not call-by-need.

Solution: Under lexical scope the delayed actual expression i+j refers to main's enclosing global bindings, initially 100 and 5. Its first demand evaluates and memoizes 105, so print(x+10) emits 115. Assigning 200 to P's local i and 20 to global j cannot change the already cached actual value. The later print(x) emits 105. Thus D, 115 followed by 105. Call by need evaluates once on first demand; it is not repeated call-by-name evaluation.

Original paper, page 11

2 marks · MCQ
Report issue

Dynamic scope with call-by-name evaluation

Runtime Environments & Parameter Passing

Question 74, GATE 2003: A hypothetical language permits globals but no nested function declarations:
global int i=100, j=5;
void P(x) {
  int i=10;
  print(x+10);
  i=200;
  j=20;
  print(x);
}
main() { P(i+j); }
If the language uses dynamic scoping and call-by-name, what values are printed?
A. 115,220  B. 25,220  C. 25,15  D. 115,105
Question 74, GATE 2003: A hypothetical language permits globals but no nested function declarations:
global int i=100, j=5;
void P(x) {
  int i=10;
  print(x+10);
  i=200;
  j=20;
  print(x);
}
main() { P(i+j); }
If the language uses dynamic scoping and call-by-name, what values are printed?
A. 115,220  B. 25,220  C. 25,15  D. 115,105
Question 74, GATE 2003: A hypothetical language permits globals but no nested function declarations:
global int i=100, j=5;
void P(x) {
  int i=10;
  print(x+10);
  i=200;
  j=20;
  print(x);
}
main() { P(i+j); }
If the language uses dynamic scoping and call-by-name, what values are printed?
A. 115,220  B. 25,220  C. 25,15  D. 115,105
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. Call-by-name reevaluates the actual expression i+j whenever x is used. Under the stipulated dynamic scope, name lookup uses the nearest active bindings.
2. During the first print, P's local i=10 is nearest, while j resolves to global 5. Thus x=15 and x+10=25.
3. The assignments make the active local i=200 and global j=20. The second use reevaluates i+j as 220, rather than retaining 15.
4. The output is 25,220, B. This is specifically the question's dynamic-name interpretation, not lexical capture of main's i.

Solution: In the question's dynamic-scoping, call-by-name model, the actual expression i+j is reevaluated at each use with the active dynamic bindings. At the first print, i is P's local 10 and j is the global 5, so x+10 is 25. P then changes its local i to 200 and global j to 20. The second evaluation of x gives 220. Hence B. This uses the stipulated dynamic-name lookup rather than lexical capture of the actual expression.

Original paper, page 11

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Dynamic dispatch after an upcast

Other Computing Topics

Question 75, GATE 2003: A hypothetical object-oriented language supports inheritance and dynamic binding; do not assume Java or C++ semantics beyond those facts.
class P { void f(int i) { print(i); } }
class Q subclass of P { void f(int i) { print(2*i); } }
Execute:
P x=new Q();
Q y=new Q();
P z=new Q();
x.f(1); ((P)y).f(1); z.f(1);
The cast (P)y changes the reference type to P. What is printed?
A. 1 2 1  B. 2 1 1  C. 2 1 2  D. 2 2 2
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Each allocation is new Q(), so all three runtime objects have class Q even where the declared reference type is P.
2. Dynamic binding selects an override from the runtime class of the receiving object. The first call therefore invokes Q.f and prints 2×1=2.
3. Casting y to P affects its static reference type, not the object's runtime class. The second call still invokes Q.f, printing 2; z likewise points to a Q and prints 2.
4. Output 2 2 2 matches D. Static binding would be a different language rule from the one expressly stipulated.

Solution: Each allocated object is an instance of Q, including those referenced through a variable or cast of type P. With the stipulated dynamic binding, each call therefore selects Q's overriding method. For argument 1 that method prints 2, giving 2 2 2, option D. An upcast changes the reference's static type, not the runtime object or dynamically selected override.

Original paper, page 11

2 marks · MCQ
Report issue

Startup cost of shared dynamic libraries

Processes, Threads & System Calls

Question 76, GATE 2003: Which is NOT an advantage of shared, dynamically linked libraries over statically linked libraries?
A. Smaller executable files
B. Lower overall page-fault rate in the system
C. Faster program startup
D. Existing programs need not be relinked to benefit from newer library versions
Question 76, GATE 2003: Which is NOT an advantage of shared, dynamically linked libraries over statically linked libraries?
A. Smaller executable files
B. Lower overall page-fault rate in the system
C. Faster program startup
D. Existing programs need not be relinked to benefit from newer library versions
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Static linking copies required library code into each executable. Dynamic linking can leave that code in a separately loaded library, reducing executable size, so A is a conventional benefit.
2. Multiple processes can map the same read-only physical library pages. This reduces duplicated resident code and can reduce total memory pressure/page faults, the intended benefit in B.
3. A compatible replacement library may be used on the next load without rebuilding each application, explaining D; compatibility remains necessary.
4. Dynamic loading and symbol relocation/resolution add work at startup or first use. Faster startup is not a general advantage, so C is the requested exception. Actual cache and page-fault behavior still depends on workload.

Solution: Dynamic linking can keep library code out of the executable, share physical library pages among processes, and permit compatible library updates without relinking each application. It also introduces runtime loading, relocation, or symbol-resolution work. Faster program startup is therefore not the characteristic advantage over static linking, option C. The other listed benefits are the conventional shared-library benefits; actual page-fault and startup measurements can depend on caching and workload.

Original paper, page 11

2 marks · MCQ
Report issue

Scheduling alternating CPU and I/O bursts

CPU Scheduling

Question 77, GATE 2003: A uniprocessor runs only two processes, created nearly simultaneously. Each alternates a 10 ms CPU burst with a 90 ms I/O burst; their I/O can proceed in parallel. Which policy gives the least long-run CPU utilization?
A. First come, first served
B. Shortest remaining time first
C. Static priority with different priorities
D. Round robin with a 5 ms quantum
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Ignore switching overhead as the statement supplies none. Under FCFS one process runs 0–10 and the other 10–20. Their I/O ends at 100 and 110, and each finishes its next CPU burst just as the other becomes ready. Thus the CPU supplies 20 ms work per 100 ms: 20% utilization. SRTF and distinct priorities have the same sustained burst staggering here.
2. Under 5 ms round robin, the initial slices are P:0–5, Q:5–10, P:10–15, Q:15–20. Their I/O begins at 15 and 20, only 5 ms apart, and ends at 105 and 110.
3. With the usual ordering when I/O completion coincides with quantum expiry, Q gets the CPU at 110, so the next completed CPU bursts are at 120 and 125. This repeats the paired pattern after 105 ms.
4. Utilization is 20/105≈19.05%, less than 20%, making D the conventional answer. The smaller separation causes more simultaneous I/O and hence more CPU idle time.

Solution: Ignoring context-switch cost, FCFS, shortest-remaining-time, and distinct static priorities run the two initial CPU bursts consecutively for 10 ms each. Their I/O completions stay offset by 10 ms, giving 20 ms of CPU work in a 100 ms steady-state period. With round robin at a 5 ms quantum, the initial bursts finish at 15 and 20 ms, so the processes enter I/O only 5 ms apart. Under the usual ready-queue ordering at simultaneous quantum expiry and I/O completion, this pattern repeats every 105 ms, giving utilization 20/105≈19.05%, below 20%. Thus D is the conventional answer: fine time slicing makes their long I/O intervals overlap more.

Original paper, page 11

2 marks · MCQ
Report issue

Translation lookaside buffer and cache access time

Memory Organization & Address Translation

Question 78, GATE 2003: A byte-addressable processor has 32-bit virtual and physical addresses and two-level page tables stored in main memory. Address bits are split 10 bits for first-level index, 10 for second-level index, and 12 for page offset. All page-table entries are 4 bytes. TLB hit rate is 96%, physical-cache hit rate 90%; TLB and cache access each take 1 ns, and main memory takes 10 ns. With no page faults, what is mean virtual-address access time, approximately to the nearest 0.5 ns?
A. 1.5 ns  B. 2 ns  C. 3 ns  D. 4 ns
The statement does not specify whether page-table reads use the cache/hit rate.
Question 78, GATE 2003: A byte-addressable processor has 32-bit virtual and physical addresses and two-level page tables stored in main memory. Address bits are split 10 bits for first-level index, 10 for second-level index, and 12 for page offset. All page-table entries are 4 bytes. TLB hit rate is 96%, physical-cache hit rate 90%; TLB and cache access each take 1 ns, and main memory takes 10 ns. With no page faults, what is mean virtual-address access time, approximately to the nearest 0.5 ns?
A. 1.5 ns  B. 2 ns  C. 3 ns  D. 4 ns
The statement does not specify whether page-table reads use the cache/hit rate.
Tap to enlarge
Your answer
Answer & solution

Answer: None (no official key was published)

1. A cache-backed physical access costs 1 ns on a hit and 1+10=11 ns on a miss. Its mean is H=0.9×1+0.1×11=2 ns.
2. Every virtual access pays the 1 ns TLB lookup and one final data access. A TLB miss occurs with probability 0.04 and additionally reads two page-table entries.
3. If those reads also use this cache and hit rate, the conditional costs are 3 ns on a TLB hit and 7 ns on a miss. E=0.96×3+0.04×7=3.16 ns, rounding to 3.0 ns (C).
4. If page-table reads bypass the cache, a miss instead costs 1+20+2=23 ns. E=0.96×3+0.04×23=3.8 ns, rounding to 4.0 ns (D).
5. Both interpretations place page tables in main memory; this phrase alone does not resolve caching. Consequently retain the baseline underdetermination instead of asserting an unconditional option.

Solution: If every physical memory reference, including page-table reads, uses the stated cache with 90% hit probability, its mean service time is H=1+0.10×10=2 ns, charging the cache probe before a miss fetch. A lookup always costs 1 ns for the TLB and one data reference; a TLB miss, probability 0.04, adds two page-table references. Thus E=1+(1+2×0.04)H=3.16 ns, which rounds to 3.0 ns, C. If the two page-table references instead bypass the cache and each costs 10 ns, E=1+0.04×20+H=3.8 ns, rounding to 4.0 ns, D. The statement that page tables reside in main memory does not itself specify whether their reads are cached or share the data-cache hit rate. C is the usual all-physical-accesses-cached interpretation, but an unconditional answer is withheld.

Original paper, page 11

2 marks · MCQ
Report issue

Memory used by sparse two-level page tables

Virtual Memory & Paging

Question 79, GATE 2003: A byte-addressable processor has 32-bit virtual and physical addresses and two-level page tables stored in main memory. Address bits are split 10 bits for first-level index, 10 for second-level index, and 12 for page offset. All page-table entries are 4 bytes. TLB hit rate is 96%, physical-cache hit rate 90%; TLB and cache access each take 1 ns, and main memory takes 10 ns. A process maps only two contiguous code pages starting at 0x00000000, two contiguous data pages starting at 0x00400000, and one stack page starting at 0xFFFFF000. How much storage is needed for its page tables?
A. 8 KB  B. 12 KB  C. 16 KB  D. 20 KB
Question 79, GATE 2003: A byte-addressable processor has 32-bit virtual and physical addresses and two-level page tables stored in main memory. Address bits are split 10 bits for first-level index, 10 for second-level index, and 12 for page offset. All page-table entries are 4 bytes. TLB hit rate is 96%, physical-cache hit rate 90%; TLB and cache access each take 1 ns, and main memory takes 10 ns. A process maps only two contiguous code pages starting at 0x00000000, two contiguous data pages starting at 0x00400000, and one stack page starting at 0xFFFFF000. How much storage is needed for its page tables?
A. 8 KB  B. 12 KB  C. 16 KB  D. 20 KB
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. A 10-bit index selects 1024 entries. At four bytes per entry each full table occupies 4096 bytes, one 4 KiB page.
2. One second-level table covers 1024 virtual pages, or 1024×4096=4 MiB. The code pages fall in the first 4 MiB region, top-level index 0. The data begins exactly at 4 MiB, index 1. The stack address has index 1023.
3. The two contiguous code pages share one second-level table, as do the two data pages. The stack needs a third second-level table. Add one top-level table: four tables total.
4. Storage=4×4096=16384 bytes=16 KiB, option C. Mapped content pages are not additional page-table storage.

Solution: Each page-table level has 210 entries of four bytes, so each allocated table uses 4096 bytes. The two code pages occupy top-level index 0; the two data pages starting at 0x00400000 occupy index 1; the stack page at 0xFFFFF000 occupies index 1023. Three second-level tables are therefore required, plus the first-level table. Total page-table storage is 4×4096=16384 bytes=16 KiB, option C. The five mapped code/data/stack pages are not themselves included in page-table storage.

Original paper, page 12

2 marks · MCQ
Report issue

Semaphores enforcing alternating output pairs

Synchronization & Concurrency

Question 80, GATE 2003: Two concurrent processes use binary semaphores S,T. Process P loops forever: W: [synchronization]; print '0'; print '0'; X: [synchronization]. Process Q loops forever: Y: [synchronization]; print '1'; print '1'; Z: [synchronization]. Synchronization can be placed only at W,X,Y,Z. P(S) means wait/decrement and V(S) means signal. Which always gives an output starting 001100110011...?
A. W=P(S), X=V(S), Y=P(T), Z=V(T); S=T=1 initially
B. W=P(S), X=V(T), Y=P(T), Z=V(S); S=1,T=0 initially
C. W=P(S), X=V(T), Y=P(T), Z=V(S); S=T=1 initially
D. W=P(S), X=V(S), Y=P(T), Z=V(T); S=1,T=0 initially
Question 80, GATE 2003: Two concurrent processes use binary semaphores S,T. Process P loops forever: W: [synchronization]; print '0'; print '0'; X: [synchronization]. Process Q loops forever: Y: [synchronization]; print '1'; print '1'; Z: [synchronization]. Synchronization can be placed only at W,X,Y,Z. P(S) means wait/decrement and V(S) means signal. Which always gives an output starting 001100110011...?
A. W=P(S), X=V(S), Y=P(T), Z=V(T); S=T=1 initially
B. W=P(S), X=V(T), Y=P(T), Z=V(S); S=1,T=0 initially
C. W=P(S), X=V(T), Y=P(T), Z=V(S); S=T=1 initially
D. W=P(S), X=V(S), Y=P(T), Z=V(T); S=1,T=0 initially
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. The required output demands both pairwise exclusion and alternation starting with P's zeros. Initially only P should have permission: S=1 and T=0.
2. P passes wait(S), prints both zeros, then signals T. Q cannot print any one until this signal; once released it consumes T, prints both ones and signals S.
3. P's next wait(S) cannot pass before Q completes its pair. Inductively the execution consists of 00,11,00,11,..., so B works.
4. In A independent locks allow arbitrary interleaving. C initially lets both processes enter, so even the first pair need not be 00. In D Q waits forever on T because no other process signals T.

Solution: Initially give P permission to run by setting S=1 and block Q with T=0. P waits on S at W, prints both zeroes, and signals T at X. Q waits on T at Y, prints both ones, and signals S at Z. Each process therefore hands permission to the other only after completing its pair, forcing 00,11,00,11,… starting with 00. This is B. Separate locks do not coordinate the processes, and initializing both cross-signalling semaphores to one would permit initial interleaving.

Original paper, page 12

2 marks · MCQ
Report issue

Preventing odd-length internal output runs

Synchronization & Concurrency

Question 81, GATE 2003: Two concurrent processes use binary semaphores S,T. Process P loops forever: W: [synchronization]; print '0'; print '0'; X: [synchronization]. Process Q loops forever: Y: [synchronization]; print '1'; print '1'; Z: [synchronization]. Synchronization can be placed only at W,X,Y,Z. P(S) means wait/decrement and V(S) means signal. Which ensures the output never contains 0 1^n 0 or 1 0^n 1 with n odd?
A. W=P(S), X=V(S), Y=P(T), Z=V(T); S=T=1
B. W=P(S), X=V(T), Y=P(T), Z=V(S); S=T=1
C. W=P(S), X=V(S), Y=P(S), Z=V(S); S=1
D. W=V(S), X=V(T), Y=P(S), Z=P(T); S=T=1
Question 81, GATE 2003: Two concurrent processes use binary semaphores S,T. Process P loops forever: W: [synchronization]; print '0'; print '0'; X: [synchronization]. Process Q loops forever: Y: [synchronization]; print '1'; print '1'; Z: [synchronization]. Synchronization can be placed only at W,X,Y,Z. P(S) means wait/decrement and V(S) means signal. Which ensures the output never contains 0 1^n 0 or 1 0^n 1 with n odd?
A. W=P(S), X=V(S), Y=P(T), Z=V(T); S=T=1
B. W=P(S), X=V(T), Y=P(T), Z=V(S); S=T=1
C. W=P(S), X=V(S), Y=P(S), Z=V(S); S=1
D. W=V(S), X=V(T), Y=P(S), Z=P(T); S=T=1
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. The forbidden patterns mean a run of ones between zeros, or zeros between ones, must have even length. It is sufficient for each process to print its identical pair atomically.
2. C uses the same initially available semaphore at both W and Y. Only one process can enter its two-print critical section, and it releases the mutex only after the pair.
3. Output is thus a concatenation of whole 00 and 11 blocks. Adjacent blocks of the same digit may merge, but their lengths remain multiples of two, proving the desired property.
4. A and B initially allow both processes inside, permitting P's first 0, Q's first 1, P's second 0: a forbidden 010. D does not make P acquire a common mutex and likewise does not ensure whole-pair exclusion. Therefore C.

Solution: Use one common binary semaphore S, initially one, as a mutex around both print statements of either process: wait(S) at W and Y, signal(S) at X and Z. Each critical section then emits either 00 or 11 without interleaving, so any run between opposite digits is a concatenation of equal pairs and has even length. That is C. For example, when independent locks or two initially available cross-signalling permissions let P emit its first zero, Q one one, and P its second zero, the forbidden substring 010 occurs. Mutual exclusion of entire pairs is the needed property, not merely exclusion within each individual process.

Original paper, page 12

2 marks · MCQ
Report issue

Subnet equality under a noncontiguous mask

IP Addressing, Fragmentation & Address Resolution

Question 82, GATE 2003: A network uses the printed subnet mask 255.255.31.0. Which pair of addresses could belong to that network?
A. 172.57.88.62 and 172.56.87.233
B. 10.35.28.2 and 10.35.29.4
C. 191.203.31.87 and 191.234.31.88 [GFG; GateForum prints 191.03.31.87 as the first address.]
D. 128.8.129.43 and 128.8.161.55
The printed mask is noncontiguous; apply its literal bitwise AND, not an assumed CIDR repair.
Question 82, GATE 2003: A network uses the printed subnet mask 255.255.31.0. Which pair of addresses could belong to that network?
A. 172.57.88.62 and 172.56.87.233
B. 10.35.28.2 and 10.35.29.4
C. 191.203.31.87 and 191.234.31.88 [GFG; GateForum prints 191.03.31.87 as the first address.]
D. 128.8.129.43 and 128.8.161.55
The printed mask is noncontiguous; apply its literal bitwise AND, not an assumed CIDR repair.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Membership under the printed mask requires address 1 AND mask = address 2 AND mask. Its first two 255 octets preserve both first octets, while the final zero octet discards the host's last octet.
2. A fails because 57≠56 in octet two; C fails because 203≠234. B's first two octets match, but 28 AND 31=28 and 29 AND 31=29, so it fails too.
3. For D, 129=10000001₂ and 161=10100001₂. AND with 31=00011111₂ gives 00000001₂ for both. Both network values are 128.8.1.0.
4. Thus the literal calculation selects D. Because 00011111 is not a contiguous prefix-mask octet, this is not a valid ordinary CIDR mask; that caveat must remain explicit.

Solution: Compare the bitwise AND of each address with the printed mask. Options A and C have unequal second octets, which are fully retained. Option B retains third octets 28 and 29 under AND 31, so they differ. For D, 129 AND 31=1 and 161 AND 31=1; both addresses therefore map to 128.8.1.0. The raw mask calculation gives D. The printed 31 octet is 00011111, so this is a noncontiguous mask and cannot be expressed as a standard CIDR prefix; it must not be silently changed to 224 or another contiguous-mask octet.

Original paper, page 12

2 marks · MCQ
Report issue

Collision-detection minimum frame transmission time

Medium Access & Ethernet

Question 83, GATE 2003: A broadcast LAN is 2 km long, has bandwidth 10^7 bits/s and uses CSMA/CD. Signals propagate along its wire at 2×10^8 m/s. What is the minimum packet size usable on the network?
A. 50 bytes  B. 100 bytes  C. 200 bytes  D. None of the above
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. In the worst case a remote transmitter starts just before hearing the first transmitter. The collision indication must travel back, requiring nearly a full round-trip propagation time.
2. One-way propagation is 2000/(2×108)=10−5 s=10 μs. Therefore a frame must last at least 20 μs for collision detection while transmission is still in progress.
3. At 107 bits/s the minimum length is 107×20×10−6=200 bits. Divide by eight to convert to bytes: 25 bytes.
4. None of the listed numerical byte sizes equals that theoretical minimum, so D. The 200 in the computation is bits, not the 200-byte option C.

Solution: The one-way propagation delay is 2000/(2×108)=10 microseconds. To detect the worst-case collision, transmission must continue for at least twice this delay, 20 microseconds. At 107 bits/s this requires 107×20×10−6=200 bits=25 bytes. Since the offered sizes are 50,100,200 bytes and none-of-the-above, the theoretical minimum is D. This calculation uses the idealized LAN parameters; it does not import Ethernet's independently standardized minimum-frame overhead.

Original paper, page 12

2 marks · MCQ
Report issue

Sliding-window throughput and bit-byte mismatch

Data Link, Framing, Error Control & ARQ

Question 84, GATE 2003: A sends data to B over a full-duplex link using a sliding-window protocol. Send and receive windows each hold five packets. Data packets are 1000 bytes and take 50 μs to transmit. ACKs travel only B→A and have negligible transmission time. One-way propagation is 200 μs. What is maximum achievable throughput?
A. 7.69×10^6 bps
B. 11.11×10^6 bps
C. 12.33×10^6 bps
D. 15.00×10^6 bps
Both reproductions print packet size in bytes and options in bits per second.
Tap to enlarge
Your answer
Answer & solution

Answer: None (no official key was published)

1. The raw link rate is 1000×8/(50×10−6)=160×106 bits/s.
2. Packet 1 finishes leaving A at 50 μs and reaches B at 250 μs. Its immediate ACK returns to A at 450 μs. Meanwhile A can send packets 1–5 during 0–250 μs and must wait before sending packet 6 at 450 μs.
3. The ACKs then space subsequent transmissions 50 μs apart, giving recurrent batches of five packets per 450 μs. Window-limited throughput=5×1000×8/(450×10−6)=88.888... Mbit/s, below the raw rate.
4. No option matches. 5000/(450 μs)=11.111... million bytes/s, numerically close to B but with the wrong unit. Accepting B would silently discard the factor eight, so the baseline unanswered status is retained.

Solution: The physical data rate is 1000×8/(50 microseconds)=160 Mbit/s. The acknowledgment for the first packet can return after one packet transmission plus two propagation delays: 50+2×200=450 microseconds. A window of five permits 5×1000×8=40000 transmitted bits during that interval, hence the achievable steady-state rate is min(160 Mbit/s,40000/450 microseconds)=88.888… Mbit/s. None of the printed options equals this. Dividing 5000 bytes by 450 microseconds gives 11.111… million bytes/s, which numerically resembles option B but is not 11.11 million bits/s. The packet size is printed in bytes and every answer is printed in bps in both sources, so B cannot be accepted without changing a unit.

Original paper, page 12

2 marks · MCQ
Report issue

Normal form from only the listed dependencies

Normalization & Decomposition

Question 85, GATE 2003: The database functional dependencies are Date_of_birth→Age; Age→Eligibility; Name→Roll_number; Roll_number→Name; Course_number→Course_name; Course_number→Instructor; (Roll_number,Course_number)→Grade. Classify relation R(Roll_number,Name,Date_of_birth,Age):
A. In 2NF but not 3NF
B. In 3NF but not BCNF
C. In BCNF
D. None of the above
Use only the listed dependencies unless an additional identifying dependency is explicitly assumed.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Project the dependencies onto R. The relevant nontrivial ones are Roll_number→Name, Name→Roll_number and Date_of_birth→Age. No listed rule determines Date_of_birth from Roll_number or Name.
2. The closure of {Roll_number,Date_of_birth} contains all four attributes, and removing either attribute loses information. Likewise {Name,Date_of_birth} is a candidate key. Roll_number and Name alone are not keys under the stated dependency set.
3. Age is nonprime and depends on Date_of_birth, a proper subset of each composite candidate key. This is a partial dependency violating 2NF. Therefore none of A–C holds; D is the literal answer.
4. If one additionally assumes Roll_number→Date_of_birth, a single-attribute identifying key results and the usual 2NF-but-not-3NF answer A follows. The source does not supply that extra dependency, so it is a separate conditional interpretation.

Solution: Restrict the listed dependencies to R(Roll_number,Name,Date_of_birth,Age). They give Roll_number→Name, Name→Roll_number, and Date_of_birth→Age. Neither Name nor Roll_number determines Date_of_birth under this stated set. The candidate keys are therefore {Roll_number,Date_of_birth} and {Name,Date_of_birth}; Age is nonprime and depends on the proper key subset Date_of_birth. This violates 2NF, so the literal listed-dependency answer is D, none of the first three choices. If one additionally assumes Roll_number→Date_of_birth because roll numbers identify complete student records, Name and Roll_number become single-attribute keys and the relation is 2NF but not 3NF owing to Date_of_birth→Age, yielding A. That extra dependency is not supplied and must be labelled as an assumption.

Original paper, page 12

2 marks · MCQ
Report issue

Existential selection in a three-relation join

SQL & Queries

Question 86, GATE 2003: Relations are Students(Roll_number,Name,Date_of_birth), Courses(Course_number,Course_name,Instructor), and Grades(Roll_number,Course_number,Grade). Interpret this query with the printed string constants rendered in SQL quotes:
SELECT DISTINCT Name
FROM Students,Courses,Grades
WHERE Students.Roll_number=Grades.Roll_number
  AND Courses.Instructor='Korth'
  AND Courses.Course_number=Grades.Course_number
  AND Grades.Grade='A';
What set is computed?
A. Students' names with A in all courses taught by Korth
B. Students' names with A in all courses
C. Students' names with A in at least one course taught by Korth
D. None of the above
Question 86, GATE 2003: Relations are Students(Roll_number,Name,Date_of_birth), Courses(Course_number,Course_name,Instructor), and Grades(Roll_number,Course_number,Grade). Interpret this query with the printed string constants rendered in SQL quotes:
SELECT DISTINCT Name
FROM Students,Courses,Grades
WHERE Students.Roll_number=Grades.Roll_number
  AND Courses.Instructor='Korth'
  AND Courses.Course_number=Grades.Course_number
  AND Grades.Grade='A';
What set is computed?
A. Students' names with A in all courses taught by Korth
B. Students' names with A in all courses
C. Students' names with A in at least one course taught by Korth
D. None of the above
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. The Roll_number equality pairs each student with that student's grade records. The Course_number equality pairs each grade with its course.
2. The two filters discard any joined row whose instructor is not Korth or whose grade is not A. Every surviving row therefore witnesses one qualifying course for that student.
3. Projection selects the name and DISTINCT removes repeated names when several qualifying rows exist. It does not test unselected rows or require every course to qualify.
4. Thus a student appears if at least one qualifying Korth-course A exists, C. Requiring all such courses would need a different universal/anti-existence/division construction.

Solution: The joins connect each student to their grade records and the corresponding courses. The filters retain records having grade A in a course taught by Korth. A student's name is produced whenever at least one such joined record exists, and DISTINCT removes duplicate names. There is no universal quantifier, division, or count comparison requiring all courses to qualify. The intended relational query therefore computes option C, names of students with an A in at least one course taught by Korth.

Original paper, page 12

2 marks · MCQ
Report issue

Serializability of a three-transaction schedule

Transactions & Concurrency Control

Question 87, GATE 2003: Three transactions act on D1,D2,D3. In chronological order the printed schedule is:
R2(D3), R2(D2), W2(D2), R3(D2), R3(D3), R1(D1), W1(D1), W3(D2), W3(D3), R2(D1), R1(D2), W1(D2), W2(D1).
Ri(D) and Wi(D) denote transaction Ti reading/writing D. Which is correct?
A. Serializable as T2,T3,T1
B. Serializable as T2,T1,T3
C. Serializable as T3,T2,T1
D. Not serializable
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (15 steps)

1. On D1, T1 writes before T2 reads and writes, forcing edge T1→T2 in the conflict graph.
2. On D2, T2 writes before T3 reads/writes, forcing T2→T3; T3 writes before T1 reads/writes, forcing T3→T1. These edges already form T1→T2→T3→T1.
3. A directed cycle means no serial ordering can preserve all conflicts, so the schedule is not conflict-serializable.
4. Even view equivalence cannot rescue it: T2's D2 read is initial, T3 reads T2's D2 write, T1 reads T3's D2 write, and T2 reads T1's D1 write. Preserving these reads requires T2<T3<T1<T2, impossible. Therefore D holds even under the broader view-serializability interpretation.

Solution: On D1, T1 writes before T2 reads/writes, imposing T1→T2. On D2, T2 writes before T3 reads/writes, and T3 writes before T1 reads/writes, imposing T2→T3→T1. This cycle rules out conflict serializability, so D. It also rules out view serializability here: T2 reads the initial D2 value, T3 reads T2's D2 value, T1 reads T3's D2 value, and T2 reads T1's D1 value. Any view-equivalent serial order would need T2 before T3 before T1 before T2, which is impossible.

Original paper, page 13

2 marks · MCQ
Report issue

Logical-OR remainder loop prints no integers

Control Flow & Loop Tracing

Question 88, GATE 2003: In this C fragment j,k,n,TwoLog_n are integers, A is an integer array and n≥3. GFG defines TwoLog_n=2 floor(log2 n); GateForum instead uses 2 ceil(log2 n).
for(k=3;k<=n;k++) A[k]=0;
for(k=2;k<=TwoLog_n;k++)
  for(j=k+1;j<=n;j++)
    A[j]=A[j] || (j%k);
for(j=3;j<=n;j++)
  if(!A[j]) printf("%d ",j);
What set is printed?
A. {m:m≤n and m=i! for some integer i}
B. {m:m≤n and m=i² for some integer i}
C. {m:m≤n and m is prime}
D. ∅
Question 88, GATE 2003: In this C fragment j,k,n,TwoLog_n are integers, A is an integer array and n≥3. GFG defines TwoLog_n=2 floor(log2 n); GateForum instead uses 2 ceil(log2 n).
for(k=3;k<=n;k++) A[k]=0;
for(k=2;k<=TwoLog_n;k++)
  for(j=k+1;j<=n;j++)
    A[j]=A[j] || (j%k);
for(j=3;j<=n;j++)
  if(!A[j]) printf("%d ",j);
What set is printed?
A. {m:m≤n and m=i! for some integer i}
B. {m:m≤n and m=i² for some integer i}
C. {m:m≤n and m is prime}
D. ∅
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Logical OR leaves A[j]=0 only if every tested remainder j%k is zero. A nonzero remainder permanently sets the entry to 1. This is divisibility by every tested k, not primality testing.
2. Let L=TwoLog_n. For 3≤j≤L+1, the iteration k=j−1 is performed and leaves remainder 1, so none of those j prints.
3. For j>L+1, all k=2,...,L are tested. A printed j would therefore have to be a multiple of M=lcm(1,...,L). The useful bound M≥2L−1 follows because each binomial coefficient C(L−1,k) divides M/L, so summing the L coefficients gives 2L−1≤M.
4. With r=floor(log2 n) and L=2r, for n≥4 we have r≥2, hence M≥22r−1≥2r+1>n. No positive multiple can lie in the printing range. For n=3, k=2 marks 3 directly.
5. Nothing prints, D. The ceiling variant has at least the same tests, so also cannot print anything.

Solution: A[j] becomes true as soon as one tested k does not divide j; this is not a sieve that marks multiples. Let L be the outer-loop limit. If 3≤j≤L+1, the tested k=j−1 leaves remainder one, so j is not printed. For j>L+1, printing requires j to be divisible by every integer from 2 through L, hence by lcm(1,…,L). Let r=floor(log2 n), L=2r. For n≥4, the standard bound lcm(1,…,L)≥2L−1=22r−1≥2r+1>n rules this out. The n=3 case is directly marked by k=2. Thus nothing is printed, D. The LCM bound can also be established from the fact that every binomial coefficient in row L−1 divides lcm(1,…,L)/L, whose row sum is 2L−1.

Original paper, page 13

2 marks · MCQ
Report issue

Local shadowing and pointer update of a global

Scope, Lifetime & Storage Classes

Question 89, GATE 2003: Consider this C-style program (print emits its integer argument followed by a space):
int x;
void Q(int z) { z+=x; print(z); }
void P(int *y) {
  int x=*y+2;
  Q(x);
  *y=x-1;
  print(x);
}
main(void) { x=5; P(&x); print(x); }
What output is produced?
A. 12 7 6  B. 22 12 11  C. 14 6 6  D. 7 6 6
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. main sets the global x to 5 and passes its address, so y inside P points to that global object.
2. P declares a different, local x and initializes it to *y+2=5+2=7. Calling Q(x) copies 7 into Q's parameter z.
3. Q has no local x, so its x denotes the global, still 5. z becomes 7+5=12 and Q prints 12; this does not alter either x.
4. Back in P, *y=x−1 uses local x=7 on the right and writes 6 to the global through y. P prints its unchanged local 7.
5. main finally prints global x=6, producing 12 7 6, A. Passing the pointer allows the global update despite P's name shadowing.

Solution: main sets global x=5 and passes its address to P. P's local x becomes *y+2=7 and shadows the global only inside P. Q receives z=7; its unqualified x is the global 5, so z becomes 12 and Q prints 12. Returning to P, *y=x−1 writes 6 to the global, but P's local remains 7 and is printed. Finally main prints the global 6. The output is 12 7 6, A.

Original paper, page 13

2 marks · MCQ
Report issue

Recursive linked-list sortedness predicate

Arrays & Linked Lists

Question 90, GATE 2003: Consider a finite, well-formed singly linked list and the function:
struct item { int data; struct item *next; };
int f(struct item *p) {
  return (p==NULL) || (p->next==NULL) ||
         ((p->data<=p->next->data) && f(p->next));
}
f returns 1 if and only if:
A. The list is empty or has exactly one element
B. List data are in nondecreasing order
C. List data are in nonincreasing order
D. Not all elements have the same data value
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. If p is NULL, the first OR operand is true; short-circuiting prevents any dereference. If p names the last node, the second operand is true and prevents accessing a nonexistent next node.
2. Otherwise both base tests are false, so success requires p.data≤p.next.data and a successful recursive check of the suffix.
3. Induct on list length. Empty/singleton lists are nondecreasing. For length at least two, the suffix is nondecreasing exactly when the recursion succeeds, and the current comparison places the first element before that sorted suffix. Thus all adjacent inequalities hold exactly when f returns true.
4. The predicate is nondecreasing order, B; equal values are allowed. Longer sorted lists refute A, and the comparison direction refutes C. Cyclic lists are outside the ordinary finite-list assumption.

Solution: The empty list and a one-node list return true. For any longer list, short-circuit evaluation checks data at the current node≤data at the next node and then recursively verifies the suffix. By induction, the result is true exactly when every adjacent pair is in nondecreasing order, option B. The initial null checks protect the pointer dereferences. This assumes the ordinary finite, well-formed, acyclic linked-list input; on a cycle recursion need not terminate.

Original paper, page 13