GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 1993

70 questions

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

03:00:00
MSQ
Report issue

Eigenvectors of a nilpotent matrix

Linear Algebra

Question 1.1, GATE 1993: For M=[[0,0,α],[0,0,0],[0,0,0]], α≠0, which listed vectors are eigenvectors: (0,0,α),(α,0,0),(0,0,1),(0,α,0)?
Tap to enlarge
Select all that apply
Answer & solution

Answer: B,D (no official key was published)

The matrix is nilpotent: M²=0, so its only eigenvalue is zero. For v=(x,y,z), Mv=(αz,0,0), which vanishes exactly when z=0. Thus every nonzero vector in the xy-plane is a zero-eigenvalue eigenvector. The second and fourth candidates satisfy this condition and are nonzero because α≠0. The first and third have nonzero z and their images are not scalar multiples of themselves. Hence B and D, not merely one option.

Original paper, page 1

MSQ
Report issue

Classifying a nonlinear differential equation

Calculus

Question 1.2, GATE 1993: Classify y″+y′+sin y=0 among linear,nonlinear,homogeneous,degree two.
Tap to enlarge
Select all that apply
Answer & solution

Answer: B under the standard linear-ODE terminology (no official key was published)

A linear differential equation contains y and its derivatives only to first powers with coefficients depending on the independent variable. The term sin y violates that requirement, making this equation nonlinear. Its order is two, but its highest derivative occurs to power one, so its differential degree is one, not two. “Homogeneous” in the standard homogeneous-linear-ODE sense is not applicable to this nonlinear equation. Merely having zero on the right is not enough to infer the linear homogeneity property; a different informal use of that word should be stated separately.

Original paper, page 1

MSQ
Not in GATE 2027 syllabusReport issue

Polynomial exactness of Simpson integration

Numerical Methods

Question 1.3, GATE 1993: For which polynomial degrees 1,2,3,4 is Simpson’s rule exact?
Tap to enlarge
Select all that apply
Answer & solution

Answer: A,B,C (no official key was published)

Simpson’s rule integrates every polynomial of degree at most three exactly. One way to see the extra cubic exactness is to center the interval: the odd cubic term integrates to zero and is canceled by the symmetric sample weights, while the rule integrates constants, linear and quadratic terms exactly. Its error involves the fourth derivative, which vanishes for degrees one through three. A general quartic has nonzero error, so degree four is not guaranteed. As a multiple-select question, all of A,B,C are required.

Original paper, page 1

MSQ
Report issue

FORTRAN77 keywords as identifiers

Lexical Analysis

Question 1.4, GATE 1993: Which fixed-form FORTRAN77 statements are valid: DO 13 I = 1; A = DIM ***7; READ = 15.0; GO TO 3 = 10?
Tap to enlarge
Select all that apply
Answer & solution

Answer: A,C,D as assignment statements (no official key was published)

FORTRAN77 does not reserve these apparent keywords, and blanks outside character constants do not distinguish tokens in fixed form. DO 13 I = 1 can therefore be an assignment to variable DO13I, not a DO loop. READ=15.0 assigns to variable READ, and GO TO 3=10 assigns to GOTO3. These names satisfy the traditional letter-first length rule. DIM***7 has an invalid triple-star operator and is not a valid exponentiation expression. The answer concerns statements placed in valid fixed-form source columns and with ordinary implicit typing, not modern free-form parsing.

Original paper, page 1

MSQ
Report issue

Sum over odd reciprocal squares

Calculus

Question 1.5, GATE 1993: Using the supplied Fourier series or otherwise, evaluate 1+1/3²+1/5²+1/7²+… among π²/4,π²/6,π²/8,π²/12.
Tap to enlarge
Select all that apply
Answer & solution

Answer: C: π²/8 (no official key was published)

Let S=Σ(n≥1)1/n²=π²/6. The even-index terms sum to Σ1/(2n)²=S/4. Subtracting them from S leaves precisely the positive odd-index terms, so the required sum is 3S/4=π²/8. This agrees with evaluating the displayed Fourier series at its endpoint using the appropriate midpoint value. The source’s piecewise interval typography is damaged, but the requested numerical series itself is explicit and determines the result independently.

Original paper, page 1

MSQ
Report issue

Convergence of improper integrals

Calculus

Question 1.6, GATE 1993: Assess integrals A ∫₀¹ sin x/(1−cos x) dx; B ∫₀∞ cos x/(1+x) dx; C ∫₀∞ x/(1+x²) dx; D ∫₀¹ (1−cos x)/(x⁵/2) dx as displayed.
Question 1.6, GATE 1993: Assess integrals A ∫₀¹ sin x/(1−cos x) dx; B ∫₀∞ cos x/(1+x) dx; C ∫₀∞ x/(1+x²) dx; D ∫₀¹ (1−cos x)/(x⁵/2) dx as displayed.
Tap to enlarge
Select all that apply
Answer & solution

Answer: B on the literal x⁵/2 reading; B,D if D intended x^(5/2) (no official key was published)

Near zero, sin x/(1−cos x) is asymptotic to 2/x, so A diverges. Integral B converges by Dirichlet’s test: an antiderivative of cos x is bounded and 1/(1+x) decreases to zero. C has antiderivative (1/2)log(1+x²), unbounded at infinity. The displayed D denominator is stacked x⁵ over 2; literally its integrand behaves as x−3, hence diverges. If the intended typography was x5/2, it behaves as (1/2)x−1/2 and converges instead. The paper retains this ambiguity, so a unique D selection is not claimed.

Original paper, page 1

MSQ
Report issue

Stationary points without extrema

Calculus

Question 1.7, GATE 1993: For f(x,y)=x²y−3xy+2y+x, determine the number of local maxima and minima.
Tap to enlarge
Select all that apply
Answer & solution

Answer: A: no local extrema (no official key was published)

The partial derivatives are fx=(2x−3)y+1 and fy=x²−3x+2=(x−1)(x−2). Stationarity therefore requires x=1,y=1 or x=2,y=−1. The Hessian has f_xx=2y, f_xy=2x−3 and f_yy=0. Its determinant is −(2x−3)²=−1 at either point, so both are saddle points. Since a differentiable function on R² can have an interior local extremum only at a stationary point, there are no local maxima or minima.

Original paper, page 2

Other
Report issue

A cancellation limit

Calculus

Question 2.1, GATE 1993: Evaluate lim(x→0)[x(e^x−1)+2(cos x−1)]/[x(1−cos x)].
Tap to enlarge
Answer & solution

Answer: 1 (no official key was published)

Expand ex−1=x+x²/2+x³/6+O(x⁴) and cos x−1=−x²/2+x⁴/24+O(x⁶). Multiplying the first by x and the second by two cancels their x² terms, leaving x³/2+O(x⁴). The denominator is x³/2+O(x⁵). Dividing gives a ratio tending to one. Keeping only first-order expansions would miss the cancellation and fail to identify the first nonzero terms.

Original paper, page 2

Other
Report issue

Radius of a factorial-coefficient series

Calculus

Question 2.2, GATE 1993: Find the radius of convergence in x of Σ(m≥0)(3m)!/(m!)³ · x^(3m).
Tap to enlarge
Answer & solution

Answer: 1/3 (no official key was published)

For successive nonzero terms, the absolute ratio is [(3m+3)(3m+2)(3m+1)/(m+1)³]|x|³, tending to 27|x|³. The ratio test gives convergence for 27|x|³<1 and divergence when it exceeds one. Therefore |x|<1/3 is the convergence interior and the radius is 1/3. Treating x³ as a new variable gives radius 1/27 in that variable, but the question asks the radius in x, requiring the cube root.

Original paper, page 2

Other
Report issue

Angular velocity from a velocity field

Calculus

Question 2.3, GATE 1993: For V=(x²y,xyz,−yz²), find local angular velocity at (1,1,−1).
Tap to enlarge
Answer & solution

Answer: −i−k under ω=(1/2)curl V (no official key was published)

The local rigid-rotation component of a velocity field has angular velocity half its curl. Compute curl V=(∂(−yz²)/∂y−∂(xyz)/∂z, ∂(x²y)/∂z−∂(−yz²)/∂x, ∂(xyz)/∂x−∂(x²y)/∂y)=(-z²−xy,0,yz−x²). At (1,1,−1) this is (−2,0,−2). Dividing by two gives (−1,0,−1). The full curl is vorticity, not angular velocity; omitting the factor one half would answer a different quantity.

Original paper, page 2

Other
Not in GATE 2027 syllabusReport issue

One second-order Runge–Kutta step

Numerical Methods

Question 2.4, GATE 1993: For y′=x−y,y(0)=0,h=0.1, compute y(0.1) to three decimal places using RK2.
Tap to enlarge
Answer & solution

Answer: 0.005 (no official key was published)

Using Heun’s RK2 form, k1=h f(0,0)=0. The endpoint predictor is y+k1=0 at x=0.1, so k2=0.1·(0.1−0)=0.01. The corrected value is y+(k1+k2)/2=0.005. The midpoint RK2 variant gives the same first step: its midpoint slope is 0.05 and h times that is 0.005. The exact value 0.1−1+e−0.1≈0.004837 also rounds to 0.005, providing a consistency check rather than replacing the requested numerical method.

Original paper, page 2

Other
Report issue

FORTRAN mixed arithmetic and integer assignment

Semantic Analysis & Type Checking

Question 2.5, GATE 1993: For X=4.0, evaluate integer I assigned −2**2+(5.0*X)/(X*3)+3/4, following the displayed fraction grouping.
Tap to enlarge
Answer & solution

Answer: −2 (no official key was published)

Exponentiation binds before unary negation, so −2**2 is −4, not +4. The middle term is real arithmetic: 20.0/12.0=5/3. The literal operands in 3/4 are integers, so FORTRAN integer division gives zero. The resulting real value is −4+5/3=−7/3. Assignment to integer I truncates toward zero, yielding −2. The printed source uses two-dimensional fractions rather than literal FORTRAN source; the grouping in the paraphrase is stated explicitly so a flattened division/multiplication expression is not silently substituted.

Original paper, page 2

Other
Report issue

A malformed iterated-integral bound

Calculus

Question 2.6, GATE 1993: The source prints ∫₀¹ ∫₀^(1/x) x/(1+y²) dx dy. Evaluate if possible without silently changing the differentials.
Tap to enlarge
Answer & solution

Answer: Literal expression unresolved; 1/2 if the inner differential is repaired to dy and the outer to dx (no official key was published)

As printed, the inner integration variable x also appears in its own upper bound 1/x, so this is not a well-defined ordinary iterated integral with fixed outer parameter y. One plausible repair is ∫₀¹∫₀1/x x/(1+y²) dy dx. That becomes ∫₀¹ x arctan(1/x) dx. Integration by parts gives [x² arctan(1/x)/2]₀¹+(1/2)∫₀¹ x²/(1+x²) dx=π/8+(1/2)(1−π/4)=1/2. This is a conditional repaired result, not a verified interpretation; another repair of the bound could change the value.

Original paper, page 2

Other
Report issue

Fourth power with four distinct eigenvalues

Linear Algebra

Question 2.7, GATE 1993: For A=[[1,0,0,1],[0,−1,0,−1],[0,0,i,i],[0,0,0,−i]], find A⁴.
Tap to enlarge
Answer & solution

Answer: I₄ (no official key was published)

The triangular matrix has diagonal eigenvalues 1,−1,i,−i, all distinct. Its characteristic polynomial is (t−1)(t+1)(t−i)(t+i)=t⁴−1. Cayley–Hamilton therefore gives A⁴−I=0 directly, including the off-diagonal entries; one cannot justify the full matrix power by looking only at the diagonal. Thus A⁴ is the 4×4 identity. The result can also be verified by multiplication, but the characteristic polynomial explains why all off-diagonal contributions cancel.

Original paper, page 3

Other
Report issue

Flux through a unit cube

Calculus

Question 2.8, GATE 1993: For V=(x cos²y,x²e^z,z sin²y), find outward flux through the surface of a unit cube with coordinate-parallel edges.
Tap to enlarge
Answer & solution

Answer: 1 (no official key was published)

Use the divergence theorem. The divergence is ∂(x cos²y)/∂x+∂(x²ez)/∂y+∂(z sin²y)/∂z=cos²y+0+sin²y=1. Integrating over the cube multiplies this constant by its volume, one, so outward flux is one. The middle component has no y dependence and contributes zero to divergence. Outward orientation is the conventional normal on a closed surface; reversing every normal would reverse the flux sign.

Original paper, page 3

Other
Report issue

Boundary values for a sine solution

Calculus

Question 2.9, GATE 1993: For y″+y=0 with y(0)=y(λ)=0, give λ allowing a nontrivial solution.
Tap to enlarge
Answer & solution

Answer: λ=kπ; k≥1 for a positive interval length (no official key was published)

The general solution is y=A cos x+B sin x. At zero, the boundary condition forces A=0. A nontrivial solution therefore requires B≠0, and the second condition becomes sin λ=0. Thus λ is an integer multiple of π. If λ denotes a positive interval length, take k=1,2,…; if the source allows λ=0 or negative endpoints, the algebraic zero condition includes those multiples too. This distinction states the usual boundary-value convention instead of inventing a range restriction.

Original paper, page 3

Other
Report issue

Laplace transform of negative half-wave pulses

Calculus

Question 2.10, GATE 1993: A 2π-periodic function is zero on (0,π) and sin t on (π,2π), repeated thereafter. Find its Laplace transform.
Tap to enlarge
Answer & solution

Answer: −1/[(s²+1)(e^(πs)−1)], Re(s)>0 (no official key was published)

For a periodic function of period T, the Laplace transform is the transform over one period divided by 1−e−sT. Here the numerator is ∫π2πe−stsin t dt=−(e−πs+e−2πs)/(s²+1). Divide by 1−e−2πs and factor the difference of squares to obtain −e−πs/[(s²+1)(1−e−πs)], the stated form. Its negative sign is consistent with every nonzero pulse lying below the axis. Boundary-point values do not affect the integral.

Original paper, page 3

2 marks · MSQ
Report issue

A four-NOR logic network

Boolean Algebra & Logic Gates

Question 6.1, GATE 1993: Let t=NOR(x,y),u=NOR(x,t),v=NOR(y,t),f=NOR(u,v). Identify the function.
Tap to enlarge
Select all that apply
Answer & solution

Answer: B: exclusive NOR (no official key was published)

The first output is t=¬x¬y. Then u=¬(x+t)=¬x·y and v=x·¬y. These are the two unequal-input cases. The final NOR complements their OR, giving f=¬(¬x·y+x·¬y)=xy+¬x¬y. Hence f is one exactly when x=y, the exclusive-NOR function. Evaluating 00,01,10,11 yields 1,0,0,1, distinguishing it from XOR and from a single NOR gate.

Original paper, page 4

2 marks · MSQ
Report issue

Stable states of a state diagram

Finite-State Machine Design

Question 6.2, GATE 1993: Recovered diagram: S1 loops for a=1 and goes to S2 for a=0; S2 loops for b=1 and goes to S1 for b=0. Which input restriction makes the machine have a stable state? A ab=1; B a+b=1; C ¬a+¬b=0; D ¬(ab)=1; E ¬(a+b)=1. Here + means Boolean OR. The section permits multiple correct alternatives.
Tap to enlarge
Select all that apply
Answer & solution

Answer: B is the exact condition; A, B and C are sufficient restrictions if read as select-all-that-apply (no official key was published)

The arrows give S1→S1 when a=1 and S1→S2 when a=0; S2→S2 when b=1 and S2→S1 when b=0. Hold the inputs constant and test each pair. At (a,b)=(0,0), both states leave themselves, so there is no fixed point. At (0,1), S2 is stable and S1 reaches it. At (1,0), S1 is stable and S2 reaches it. At (1,1), both states are stable. Thus at least one stable state exists exactly when a∨b=1, giving B as the necessary-and-sufficient, least restrictive condition. A and C both force a=b=1 and hence are also sufficient restrictions, though not necessary. Because the original section allows multiple correct alternatives and the wording does not explicitly ask for the least restrictive condition, A,B,C is defensible under a merely sufficient-condition reading. D permits (0,0), while E requires (0,0), so neither guarantees stability.

Original paper, page 4

2 marks · MSQ
Report issue

Three-stage complemented-feedback counter

Counters & Timing

Question 6.3, GATE 1993: Three common-clock JK stages use J/K as a signal and its complement; stages shift Q1→Q2→Q3, and the first receives ¬Q3. Starting at 000, what function is performed?
Tap to enlarge
Select all that apply
Answer & solution

Answer: C: modulo-6 counter (no official key was published)

With complementary J and K inputs, each JK stage copies the signal on J at the next edge. The transition is therefore (Q1,Q2,Q3)→(¬Q3,Q1,Q2). Starting at 000 gives 100,110,111,011,001,then 000. The six distinct states form the cycle, so it is a three-stage Johnson counter with modulus six. It uses shift-register structure, but its specified closed-loop function from the given initial state is the modulo-6 count; the unused states are not part of that cycle.

Original paper, page 4

2 marks · MSQ
Not in GATE 2027 syllabusReport issue

Asynchronous character throughput

Physical Layer & Transmission

Question 6.4, GATE 1993: An asynchronous serial line sends 8-bit characters at 2400 baud with two stop bits. Choose the character rate among 109,216,218,219,240.
Tap to enlarge
Select all that apply
Answer & solution

Answer: C: 218 complete characters/s under binary signaling and no parity (no official key was published)

Each frame needs one start bit, eight data bits and two stop bits, totaling eleven bits. With one bit per symbol, 2400 baud is 2400 bits/s, so the sustained rate is 2400/11≈218.18 characters/s. At most 218 whole frames fit in a one-second interval starting on a frame boundary, giving C. Ignoring the start bit would incorrectly give 240. This assumes no parity bit and binary signaling; baud is generally symbols per second, so another modulation alphabet would require additional information.

Original paper, page 5

Other
Report issue

Binary fraction to decimal

Number Systems & Computer Arithmetic

Question 6.5.a, GATE 1993: Convert (110.101)₂ to decimal.
Question 6.5.a, GATE 1993: Convert (110.101)₂ to decimal.
Tap to enlarge
Answer & solution

Answer: 6.625 (no official key was published)

Step through it (8 steps)

The integer bits have weights 4,2,1 and contribute 4+2+0=6. The fractional bits have weights 1/2,1/4,1/8 and contribute 1/2+0+1/8=0.625. Add the two parts to get 6.625. Fractional bit positions continue negative powers of the base; treating .101 as a decimal fraction would not preserve the given binary value. This is one of the two separately retained conversion subparts sharing the printed group marks.

Original paper, page 5

Other
Report issue

Decimal to hexadecimal

Number Systems & Computer Arithmetic

Question 6.5.b, GATE 1993: Convert (1118)₁₀ to base H as printed. Interpret H explicitly.
Question 6.5.b, GATE 1993: Convert (1118)₁₀ to base H as printed. Interpret H explicitly.
Tap to enlarge
Answer & solution

Answer: 45E₁₆, if H denotes hexadecimal (no official key was published)

Taking H as the conventional hexadecimal notation, divide 1118 by 16: quotient 69,remainder 14=E. Divide 69 by 16: quotient 4,remainder 5. The final quotient 4 is the leading digit, giving 45E. Verify by expansion: 4·256+5·16+14=1024+80+14=1118. The source labels the desired base H rather than the number 16, so the hexadecimal interpretation is stated. If H were instead an unspecified variable radix, a unique numeral could not be supplied.

Original paper, page 5

2 marks · Other
Report issue

ROM truth table for a multiplier

Memory Organization & Address Translation

Question 6.6, GATE 1993: A ROM multiplies two unsigned 4-bit inputs. Give M words and N bits per word.
Tap to enlarge
Answer & solution

Answer: M=256,N=8 (no official key was published)

The two operands provide eight address bits together, so the truth table has 2⁸=256 possible input pairs, requiring 256 words. The largest product is 15·15=225, which fits in eight bits but not seven. Therefore each output word needs eight bits. This direct truth-table ROM organization is 256×8; it is not a 16-entry table because both operands independently select the result.

Original paper, page 5

2 marks · Other
Not in GATE 2027 syllabusReport issue

Disk rotational delay and transfer rate

Secondary Storage

Question 6.7, GATE 1993: A one-head disk has 200 tracks,2400 rpm and 62,500 bits per track. Find average rotational latency P in ms and transfer rate Q in bits/s.
Tap to enlarge
Answer & solution

Answer: P=12.5 ms,Q=2,500,000 bits/s (no official key was published)

2400 revolutions per minute is 40 revolutions per second, so one revolution takes 25 ms. A uniformly random angular arrival waits half a revolution on average, or 12.5 ms. Reading one full track per revolution transfers 62,500·40=2,500,000 bits/s. The 200-track count affects total capacity, not the instantaneous per-head track rate or rotational delay. Seek time, controller overhead and inter-track gaps are not included in these idealized quantities.

Original paper, page 5

2 marks · Other
Report issue

CPU time retained by the main program

Input/Output, DMA & Interrupts

Question 6.8, GATE 1993: Interrupts arrive every 1 ms. The diagram shows 10 μs response delay while main code still runs, then 10 μs save,80 μs service,10 μs restore. What fraction remains for main execution?
Tap to enlarge
Answer & solution

Answer: 90% (no official key was published)

Only saving, servicing and restoring displace main-program execution: 10+80+10=100 μs per interrupt. Each arrival period is 1000 μs, leaving 900 μs for the main program, or 90%. The initial 10 μs response delay is drawn while main execution continues, so it must not be subtracted again. Doing so would give 89% and double-count time not actually lost. This assumes the depicted nonoverlapping periodic service and no extra overhead beyond the labeled intervals.

Original paper, page 5

2 marks · MSQ
Report issue

Aliased reference parameters with a shadowed local

Runtime Environments & Parameter Passing

Question 7.1, GATE 1993: Global m=0. P(var x,y:integer) has its own local m, sets that local m:=1, then x:=y+1. What is printed after P(m,m)?
Question 7.1, GATE 1993: Global m=0. P(var x,y:integer) has its own local m, sets that local m:=1, then x:=y+1. What is printed after P(m,m)?
Tap to enlarge
Select all that apply
Answer & solution

Answer: D: 1 because x and y both reference the global m (no official key was published)

Both formal reference parameters bind to the caller’s global m. The procedure’s separate local variable named m shadows the global name only for direct uses of that identifier in P; setting it to one does not change the caller’s m. Then x:=y+1 reads global m=0 through y and stores one through x. Consequently the global m printed by the caller is one. The result is not caused by the local m assignment, so the option giving that incorrect reason is not selected.

Original paper, page 6

2 marks · MSQ
Report issue

A value parameter does not modify its actual expression

Runtime Environments & Parameter Passing

Question 7.2, GATE 1993: Global n=0. Q(x:integer;var y:integer) executes x:=y+1. What is printed after Q(n*1,n)?
Question 7.2, GATE 1993: Global n=0. Q(x:integer;var y:integer) executes x:=y+1. What is printed after Q(n*1,n)?
Tap to enlarge
Select all that apply
Answer & solution

Answer: B: 0 (no official key was published)

The actual n*1 is evaluated to zero and copied into value parameter x. Parameter y is a reference to n. The assignment computes y+1=1 but writes only the local copy x; it never assigns to y. Thus n remains zero and the caller prints zero. Calling with an expression as the first actual is valid precisely because that parameter has value semantics; a reference formal would require a suitable variable location instead.

Original paper, page 6

2 marks · MSQ
Report issue

Scope and shadowing of a global name

Runtime Environments & Parameter Passing

Question 7.3, GATE 1993: Global m is declared in PARAM. P declares another local m; Q does not. Where is the global name m directly visible?
Question 7.3, GATE 1993: Global m is declared in PARAM. P declares another local m; Q does not. Where is the global name m directly visible?
Tap to enlarge
Select all that apply
Answer & solution

Answer: C: PARAM and Q (no official key was published)

Lexical lookup in P finds its local m before reaching the enclosing declaration, so unqualified m there denotes the local variable. In Q, which has no local m, lookup reaches the global declaration in PARAM. The same global name is visible in the main block itself. Hence PARAM and Q are the regions of direct visibility, C. The global object can still be accessed indirectly through P’s reference parameters; object accessibility is distinct from whether its identifier is shadowed.

Original paper, page 6

2 marks · MSQ
Report issue

Addition-subtraction swap

Other / Mixed Topics

Question 7.4, GATE 1993: What do a:=a+b; b:=a−b; a:=a−b accomplish for initialized integer variables?
Tap to enlarge
Select all that apply
Answer & solution

Answer: A: exchange a and b, assuming no overflow (no official key was published)

Let the initial values be a0,b0. After the first statement a=a0+b0. The second computes b=(a0+b0)−b0=a0. The final statement gives a=(a0+b0)−a0=b0, completing the swap without a separate temporary. This derivation assumes the intermediate sum is representable or a defined modular arithmetic model. The snippet declares variables but does not initialize them; as a standalone program it would not define starting values. Its intended transformation concerns values supplied before this segment.

Original paper, page 7

2 marks · MSQ
Report issue

Nil pointer dereference

Semantic Analysis & Type Checking

Question 7.5, GATE 1993: Pascal allocates ptr, assigns ptr:=nil, then attempts ptr^.d:=5.2 and prints the reproduced text write ln(ptr). Which error claims are justified?
Tap to enlarge
Select all that apply
Answer & solution

Answer: B, D (runtime nil dereference); as printed, A (compile-time error) also applies (no official key was published)

After new(ptr), assigning nil discards the usable pointer. Dereferencing ptr^ then attempts to access a nonexistent record, so a checked execution reports nil-pointer dereference rather than printing 5.2. This supports the intended runtime-error and nil-error choices B,D. Those issues can cause compile-time rejection before runtime. No claim that the literal program necessarily reaches the dereference is made.

Original paper, page 7

2 marks · MSQ
Not in GATE 2027 syllabusReport issue

First pass of a two-pass assembler

Compiler Phases, Linking & Loading

Question 7.6, GATE 1993: Which first-pass tasks apply: allocate literal space,compute program length,build symbol table,generate load/store machine code?
Tap to enlarge
Select all that apply
Answer & solution

Answer: A,B,C in the standard assembler model (no official key was published)

Pass one tracks the location counter and instruction/data sizes. It assigns addresses to labels, records symbol values, and determines the total layout and length. Literal-pool placement also reserves space and assigns literal addresses when the pool is processed. Final instruction encoding is normally deferred to pass two, when forward symbol references can be resolved, so generating all load/store code is not a standard first-pass task. The answer assumes the ordinary two-pass design, not a hybrid implementation that opportunistically emits some instructions early.

Original paper, page 7

2 marks · MSQ
Report issue

What software must always remain resident

Processes, Threads & System Calls

Question 7.7, GATE 1993: Which listed system software must reside in main memory under all circumstances: editor,assembler,linker,loader,or none?
Tap to enlarge
Select all that apply
Answer & solution

Answer: D in the conventional resident-loader model; E for the literal universal claim (no official key was published)

A simple textbook system keeps a resident loader or loading service available to bring executable code into memory, motivating D. Editors,assemblers and linkers can be loaded only when needed. But “under all circumstances” is too strong: a bootstrap loader can finish and release its memory; loading can be implemented by firmware or by parts of an OS rather than a permanently resident standalone loader. Therefore no listed application is universally required to remain in RAM for every architecture. The conventional answer is retained conditionally, not elevated into an architecture-independent fact.

Original paper, page 8

2 marks · MSQ
Report issue

Locating a filesystem root directory

File Systems

Question 7.8, GATE 1993: Where should the root directory be placed: (A) fixed address in main memory, (B) fixed location on its disk, (C) anywhere on its disk, (D) fixed location on the system disk, or (E) anywhere on the system disk?
Tap to enlarge
Select all that apply
Answer & solution

Answer: B for a fixed-root layout; a discoverable pointer permits arbitrary placement (no official key was published)

The filesystem must be able to locate its root from known metadata. In a simple fixed-root layout this is achieved by placing the root at a predefined disk location, giving B; each disk or filesystem can have its own root, so it need not reside on a separate system disk. Modern designs can instead store a root block or inode pointer in a discoverable superblock, allowing the root itself to be elsewhere. Thus fixed placement is one implementation convention, not a universal requirement. A fixed RAM address does not establish persistent disk organization.

Original paper, page 8

2 marks · MSQ
Report issue

Resource supply guaranteeing no deadlock

Deadlocks

Question 7.9, GATE 1993: Three processes have maximum same-resource demands 3,4,6. Among m=7,9,10,13,15,which supplies guarantee no resource deadlock?
Tap to enlarge
Select all that apply
Answer & solution

Answer: D,E: 13 and 15; exact threshold 11 (no official key was published)

If all three unfinished processes hold one less than their maxima, they can hold 2+3+5=10 units and still each request another. Thus ten units can deadlock, and smaller listed supplies can also be exhausted among unsatisfied processes. With eleven units, at least one additional unit is available whenever all processes are below their maxima, enabling some process to reach its demand, finish and release resources. Repeating resolves the rest. Therefore every supply at least eleven is safe under the standard completion model; the listed qualifying values are 13 and 15, not only the smaller of them.

Original paper, page 8

2 marks · MSQ
Report issue

Round-robin completion of p

CPU Scheduling

Question 7.10, GATE 1993: At time 0 jobs p,q,r,s,t arrive in that order with bursts 4,1,8,1,2. Quantum is 1. Find p’s completion time.
Tap to enlarge
Select all that apply
Answer & solution

Answer: C: 11 (no official key was published)

The first round executes p,q,r,s,t from time 0 to 5; q and s then finish. The second round runs p from 5–6,r from 6–7,t from 7–8, completing t. The remaining queue is p,r. They run p8–9,r9–10,p10–11. This is p’s fourth unit, so it completes at 11. Context-switch overhead is assumed zero, and the arrival order determines the initial queue. A simple burst-only count would miss the intervening slices consumed by the other ready jobs.

Original paper, page 8

2 marks · MSQ
Report issue

A connected graph with n edges

Graph Theory

Question 8.1, GATE 1993: A simple connected graph has n>2 vertices and n edges. Which hold: no cycles; every single-edge removal disconnects; at least one cycle; every two-edge removal disconnects?
Tap to enlarge
Select all that apply
Answer & solution

Answer: C,D (no official key was published)

A spanning tree uses n−1 edges, leaving one extra edge that creates a cycle, so C holds and A fails. Removing an edge on that cycle leaves the graph connected, refuting B. Removing any two distinct edges leaves only n−2 edges; no graph on n vertices with so few edges can be connected, so D holds. This edge-count argument proves D even if one of the removed edges was already a bridge, without needing to enumerate the graph’s shapes.

Original paper, page 8

2 marks · MSQ
Report issue

Simplifying a conjunction with an implication form

Propositional & Predicate Logic

Question 8.2, GATE 1993: Classify p∧(¬p∨q) among tautology,equivalent to p∧q,equivalent to p∨q,contradiction.
Tap to enlarge
Select all that apply
Answer & solution

Answer: B (no official key was published)

Distribute p over the OR: p∧(¬p∨q)=(p∧¬p)∨(p∧q). The first term is false, so the result is p∧q. It is true when both variables are true and false otherwise, hence neither a tautology nor a contradiction. It is not p∨q, which would also be true when exactly one variable is true. This establishes the equivalence algebraically and by its truth conditions.

Original paper, page 9

2 marks · MSQ
Report issue

An infinite finite union

Sets, Relations & Functions

Question 8.3, GATE 1993: An infinite set S is the union of finitely many sets S1,…,Sn. Which must hold regarding finite or infinite members?
Tap to enlarge
Select all that apply
Answer & solution

Answer: C: at least one Si is infinite (no official key was published)

If every Si were finite, the union would have cardinality at most the finite sum Σ|Si| and would be finite, contradicting the premise. Thus at least one is infinite. It is possible that all are infinite, for example each equal to S, so no finite member is required. It is also possible that several are finite and one is S, so the proposed upper limit on finite members is not a general rule. The finiteness of the number of sets is essential.

Original paper, page 9

2 marks · MSQ
Report issue

Power set of a Cartesian square

Sets, Relations & Functions

Question 8.4, GATE 1993: If |A|=n,how many elements are in P(A×A)? Compare the displayed exponential alternatives.
Tap to enlarge
Select all that apply
Answer & solution

Answer: B: 2^(n²) (no official key was published)

An ordered pair chooses its first and second coordinates independently from n possibilities, so |A×A|=n². A subset independently includes or excludes each of those n² pairs, giving 2n² subsets. This is not (2n)²=22n, which counts an ordered pair of subsets of A rather than an arbitrary relation on A. Coincidences at small n do not make those formulas identical as general functions of n.

Original paper, page 9

2 marks · MSQ
Report issue

Strict less-than and flawed order reasons

Partial Orders & Lattices

Question 8.5, GATE 1993: For < on reals,options call it a partial order because asymmetric/reflexive or antisymmetric/reflexive,or deny it because not asymmetric/not reflexive or not antisymmetric/reflexive. Which complete statement is valid?
Tap to enlarge
Select all that apply
Answer & solution

Answer: E: none of the listed reasons (no official key was published)

Strict less-than is transitive and irreflexive. It is asymmetric: x<y excludes y<x. It is also antisymmetric in the logical sense, vacuously, because the two directions never both hold. Under the usual reflexive definition it is not a non-strict partial order, but the options denying partial order give additional false reasons about asymmetry or antisymmetry. Options asserting reflexivity are false too. Under the strict-partial-order convention, < is a strict order, but again the printed reflexivity reasons fail. Thus none of the complete option statements is correct.

Original paper, page 9

2 marks · MSQ
Report issue

Counting injections

Sets, Relations & Functions

Question 8.6, GATE 1993: For finite |A|=m<|B|=n,how many injective functions A→B exist?
Tap to enlarge
Select all that apply
Answer & solution

Answer: B: nP_m=n!/(n−m)! (no official key was published)

Choose distinct images successively for the m domain elements. The first has n choices, the second n−1, and so on through n−m+1. Multiplying yields n!/(n−m)!. A binomial coefficient alone would choose only the image subset and omit the m! bijections assigning its elements to the labeled domain elements. The unrestricted function count nm also permits repeated images, so it does not enforce injectivity. The formula gives one map when m=0, as required.

Original paper, page 9

2 marks · MSQ
Report issue

Summing big-O terms in a multiple-select item

Asymptotic Analysis & Recurrences

Question 8.7, GATE 1993: Classify Σ(k=1…n)O(n) among O(n),O(n²),O(n³),O(3n²),O(1.5n²).
Tap to enlarge
Select all that apply
Answer & solution

Answer: B,C,D,E under a uniform O(n) bound (no official key was published)

If each summand has magnitude at most Cn with the same constant C, the sum has magnitude at most Cn². Thus it belongs to O(n²),and constant factors 3 or 1.5 do not change that class. O(n³) is also a valid looser upper bound,so C must be selected in a literal multiple-select reading. O(n) is not guaranteed because n terms each equal to n sum to n². The notation needs a uniform bound over k: if hidden constants depend unboundedly on k, such as terms kn, the sum can instead be Θ(n³). Big-O is an upper-bound class,not an assertion of tightness.

Original paper, page 9

5 marks · Descriptive
Report issue

Functional completeness of half adders

Combinational Circuits

Question 9, GATE 1993: Only half adders are available. Show how any binary Boolean function can be implemented using them. The source does not specify whether fixed logic inputs are allowed.
Tap to enlarge
Answer & solution

Answer: Universal with a fixed logic-1 input; false for constant-free combinational half-adder networks. (no official key was published)

A half adder on inputs x,y produces S=x XOR y and C=xy. Its carry output directly implements AND. If a fixed logic 1 is allowed as an input, its sum output on (x,1) is NOT x. Thus half adders provide the functionally complete basis {AND,NOT}. For example OR follows from De Morgan: x OR y = NOT((NOT x) AND (NOT y)). A concrete four-half-adder OR network uses H1(x,1).sum=nx, H2(y,1).sum=ny, H3(nx,ny).carry=z, H4(z,1).sum=x OR y; unused outputs may be ignored. Fan-out and tied inputs are permitted wiring operations, not additional gates.

To implement any two-input truth table f, form the minterms NOT x AND NOT y, NOT x AND y, x AND NOT y, and x AND y. OR together exactly those minterms whose truth-table rows have output 1. Each minterm uses available NOT/AND networks, and each OR uses the construction above. Empty selection gives constant 0, obtainable as H(x,x).sum; all four selected give constant 1. The same sum-of-products argument works for any finite number of Boolean inputs.

There is an essential qualification: without an independent logic-1 supply (or another non-zero-preserving primitive), the claim is false. Both half-adder outputs are 0 when both inputs are 0. By induction in topological order, every signal in a finite combinational network of such half adders is 0 when all external variables are 0. Therefore it cannot compute NOT x or the constant-1 function. Tying both inputs to the same variable gives XOR=0 and AND=x, not a source of 1. Feedback without a specified initial state is not a valid general combinational implementation. The intended universality proof consequently requires explicit permission to supply constant 1.

Original paper, page 10

Descriptive
Report issue

Operand address with PC autoincrement

Instructions & Addressing Modes

Question 10(a), GATE 1993: The CPU instruction occupies one memory word with fields OP CODE, MODE, RegR. Mode 2 uses the address in RegR to fetch the operand, then increments RegR by one. The instruction is at word address 2000 and RegR selects PC. Find the operand address.
Question 10(a), GATE 1993: The CPU instruction occupies one memory word with fields OP CODE, MODE, RegR. Mode 2 uses the address in RegR to fetch the operand, then increments RegR by one. The instruction is at word address 2000 and RegR selects PC. Find the operand address.
Tap to enlarge
Answer & solution

Answer: 2001, under conventional instruction-fetch PC advancement. (no official key was published)

Use the conventional fetch sequence for a word-addressed CPU. Before instruction fetch PC=2000. Fetching the one-word instruction into the instruction register advances PC to 2001. Decoding then selects PC as the mode-2 address register. The effective operand address is the value of PC at that point, namely 2001, so the operand is the contents of memory word M[2001]. The operand fetch subsequently increments PC again, but this later value is not the operand address.

In register-transfer notation: IR ← M[PC]; PC ← PC+1; EA ← PC; operand ← M[EA]; PC ← PC+1. The addresses 2000 and 2001 respectively hold the instruction and its following operand word. This is the usual immediate-operand idiom implemented by PC autoincrement. It assumes ordinary instruction-fetch advancement of the PC, implicit in the question's CPU convention; it does not treat PC as still 2000 during operand addressing.

Original paper, page 10

Descriptive
Report issue

PC after operand fetch

Instructions & Addressing Modes

Question 10(b), GATE 1993: The CPU instruction occupies one memory word with fields OP CODE, MODE, RegR. Mode 2 uses the address in RegR to fetch the operand, then increments RegR by one. The instruction is at word address 2000 and RegR selects PC. For a non-jump instruction, find PC after execution.
Question 10(b), GATE 1993: The CPU instruction occupies one memory word with fields OP CODE, MODE, RegR. Mode 2 uses the address in RegR to fetch the operand, then increments RegR by one. The instruction is at word address 2000 and RegR selects PC. For a non-jump instruction, find PC after execution.
Tap to enlarge
Answer & solution

Answer: 2002. (no official key was published)

There are two distinct increments. First the instruction fetch consumes the memory word at 2000 and advances PC to 2001. Next mode 2 uses the current PC as the address of the operand, reads M[2001], and increments that selected register by one. Because the selected register is PC, it becomes 2002.

The instruction is specified to be non-jumping, so no later branch-target assignment replaces this sequential address. PC=2002 therefore identifies the next instruction, after both the instruction word and its inline operand word. Do not increment a third time for execution: the next fetch has not yet happened. Conversely 2001 accounts only for instruction fetch and overlooks the addressing mode's explicit post-increment. This result uses the conventional word-addressed fetch semantics implicit in part (a).

Original paper, page 10

5 marks · Descriptive
Report issue

Average access time in three-level memory

Memory Organization & Address Translation

Question 11, GATE 1993: A hierarchy has (access time ti seconds, access probability pi, page-transfer time Ti seconds): M1=(10^-6,0.99000,0.001), M2=(10^-5,0.00998,0.1), M3=(10^-4,0.00002,no lower level). A miss at Mi transfers a page from M(i+1) to Mi, taking Ti. Calculate mean time to read one word.
Tap to enlarge
Answer & solution

Answer: 13.0918 microseconds with supplying-level access plus transfers; 13.102 microseconds if serial failed probes are separately charged. (no official key was published)

The probabilities sum to 1, so treat them as unconditional, mutually exclusive probabilities of the level supplying the requested word, rather than three conditional hit ratios. In particular the probability that a transfer into M1 is needed is p2+p3=0.01, while the probability of a transfer from M3 into M2 is p3=0.00002. A word originally at M3 requires both transfers, not just T2.

Under the convention that each case incurs the access time of the supplying level plus the required page-transfer times, the three costs are t1, t2+T1, and t3+T2+T1. Hence
E[T] = p1*t1+p2*(t2+T1)+p3*(t3+T2+T1)
     = (0.99000*10^-6+0.00998*10^-5+0.00002*10^-4)
       +(0.00998+0.00002)*0.001+0.00002*0.1
     = 0.0000010918+0.000010+0.000002
     = 0.0000130918 seconds = 13.0918 microseconds.

This is the direct probability-weighted reading of the supplied table. The transfer contributions alone are 12 microseconds; omitting them would be a serious error despite the high first-level hit probability.

The text does not explicitly say whether failed higher-level probes consume additional ti, or whether those costs are already covered in the tabulated/transfer costs. If each request first probes M1 and each M1 miss additionally probes M2, count t1 for every request, t2 for probability 0.01, and t3 for probability 0.00002. Then E[T]=t1+0.01*t2+0.00002*t3+0.01*T1+0.00002*T2=13.102 microseconds. This alternative is a different timing model, not a rounding of 13.0918. No official key is available to resolve that convention; do not silently claim the paper specifies it.

Original paper, page 10

5 marks · Descriptive
Report issue

Complete a single-loop matrix maximum

Correctness, Invariants & Design

Question 12, GATE 1993: For integer A[0..n-1,0..n-1], complete four boxes in: max:=[A]; i:=0; j:=0; while [B] do begin if A[i,j]>max then max:=A[i,j]; if [C] then j:=j+1 else begin j:=0; i:=[D] end end. Use a single loop to find the largest entry. The source's comma/semicolon punctuation is defective; boxes A–D are one coordinated question.
Tap to enlarge
Answer & solution

Answer: A=A[0,0]; B=i<n; C=j<n−1; D=i+1 (n>=1). (no official key was published)

For n>=1 choose box A=A[0,0], B=(i<n), C=(j<n-1), D=i+1. Initializing to the first entry rather than 0 is important: all entries may be negative. The fully punctuated Pascal-style segment is:

begin
  max := A[0,0];
  i := 0; j := 0;
  while i < n do
  begin
    if A[i,j] > max then max := A[i,j];
    if j < n-1 then
      j := j+1
    else
    begin
      j := 0;
      i := i+1
    end
  end
end.

The pair (i,j) moves in row-major order: (0,0),(0,1),...,(0,n-1),(1,0),..., (n-1,n-1). At a row's last column, j is reset before proceeding to the next row. After the final element the state becomes (n,0); the guard stops before any invalid A[n,0] access.

Correctness invariant: immediately before processing each cell, max is the maximum of A[0,0] and every previously visited cell. The comparison incorporates the current cell and preserves this property. The rank n*i+j increases by exactly 1 per iteration and begins at 0, so exactly n2 cells are visited. On exit the invariant gives the maximum over the entire array. For n=1 the first entry is compared with itself once and the program exits correctly. Time is Theta(n2), extra space Theta(1). The n=0 case has no maximum and must be rejected or handled outside this segment; the printed task implicitly needs a nonempty array.

Original paper, page 11

5 marks · Descriptive
Report issue

Insert before a singly linked-list node

Arrays & Linked Lists

Question 13, GATE 1993: A singly linked list contains d1,...,dn. X points to node j (1<=j<=n). A new node Y contains item d. Give an insertion algorithm without using the header. Both inspected reproductions print a desired sequence d1,...,d(j-1),dj,...,dn that omits the new d; the intended insert-before-X sequence d1,...,d(j-1),d,dj,...,dn is used below as an explicit interpretation.
Tap to enlarge
Answer & solution

Answer: Exchange X.data and Y.data, then set Y.next=X.next and X.next=Y; conditional on the intended insert-before-X interpretation and movable data. (no official key was published)

Without a predecessor pointer or access to the header, ordinary link insertion immediately before the physical node X is unavailable. But the requested data sequence can be achieved by exchanging data with the fresh node and linking that node after X. Assume X is non-null, Y is a fresh detached node distinct from all current nodes, and data fields may be copied:

procedure insert_before_by_value(X,Y):
    temp := X.data
    X.data := Y.data
    Y.data := temp
    Y.next := X.next
    X.next := Y

Initially X contains dj and Y contains d. After the exchange X contains d and Y contains dj. Y.next is then set to the former successor of X, and X.next is changed to Y. The local chain is now predecessor -> X(d) -> Y(dj) -> old successor. All nodes preceding X remain unchanged; any header already pointing to X still points to the first node. Therefore the data sequence becomes exactly the interpreted target. Saving the old successor before overwriting X.next is essential; reversing the last two operations would set Y.next=Y and create a cycle.

This also handles j=1 without changing the header, because X remains the physical first node but now carries d. For j=n, the old successor is null, so Y becomes the new last node. There are a constant number of field operations, giving O(1) time and O(1) extra space.

The method preserves value order, not node-to-value identity: an external pointer to X will now observe d, and dj moves to Y. If data cannot be moved or the physical new node Y must precede X, the supplied information is insufficient in a singly linked list, particularly when X is the head. That stronger requirement needs header/predecessor access or a changed representation. Finally, the printed sequence itself contains no d, so it cannot literally describe successful insertion; the source defect is retained rather than represented as a verified correction.

Original paper, page 11

5 marks · Descriptive
Report issue

ISAM data and multilevel index sizing

Indexing, Storage & Query Processing

Question 14, GATE 1993: An ISAM file has 16K records of 64 bytes including a 14-byte key. A block address needs 2 bytes; disk blocks are 512 bytes. Find data blocks, index blocks, and number of index-tree levels.
Tap to enlarge
Answer & solution

Answer: 2048 data blocks; 67 index blocks (64+2+1); 3 index levels, or 4 levels including data. (no official key was published)

Use K=1024, full blocks, unspanned fixed-length records, and the usual sparse ISAM index with one key-and-block-address entry per child block. Each data block holds floor(512/64)=8 records. Thus 16*1024/8=2048 data blocks are needed. The 14-byte key is already included in each 64-byte record; it must not be added again.

An index entry occupies 14+2=16 bytes, so an index block contains floor(512/16)=32 entries and can identify 32 child blocks. The lowest index level needs one entry for each of 2048 data blocks, giving ceil(2048/32)=64 index blocks. The next level indexes those 64 blocks and uses ceil(64/32)=2 blocks. A root indexes these two and fits in ceil(2/32)=1 block. Hence the total index area contains 64+2+1=67 blocks.

The hierarchy is:
root index: 1 block (2 populated entries)
    -> middle index: 2 blocks (64 entries in total)
        -> bottom index: 64 blocks (2048 entries in total)
            -> data: 2048 blocks (16384 records).

There are three index levels, excluding the data level. If all levels including data are counted, the root-to-record path spans four levels; that is a different counting convention. The data area occupies 2048*512=1,048,576 bytes, and the allocated index area occupies 67*512=34,304 bytes, including root slack. There are 2115 blocks overall. No overflow reserve, block header overhead, or occupancy factor is supplied, so none is invented. A dense record-level index would have a different size and is not the standard sparse ISAM interpretation used here.

Original paper, page 11

5 marks · Descriptive
Report issue

Comparison recurrence for recursive bubble sort

Searching, Sorting & Selection

Question 15, GATE 1993: The printed procedure loops i=1 to n−1, tests A[i]>A[i+1], swaps adjacent entries if true, and then unconditionally calls bubblesort(n−1). It has no base-case guard and prints temp : A[i] instead of a valid assignment. Let an count executions of the if test. Give a recurrence and solve it.
Question 15, GATE 1993: The printed procedure loops i=1 to n−1, tests A[i]>A[i+1], swaps adjacent entries if true, and then unconditionally calls bubblesort(n−1). It has no base-case guard and prints temp : A[i] instead of a valid assignment. Let an count executions of the if test. Give a recurrence and solve it.
Tap to enlarge
Answer & solution

Answer: With base case a1=0, an=a(n−1)+n−1, giving n(n−1)/2 comparisons (the printed recurrence has no base case) (no official key was published)

First distinguish the literal source from its conventional intended algorithm. As printed, the procedure has no terminating case and contains a malformed temp assignment. It is not a valid terminating Pascal sort. After correcting assignment punctuation and adding a guard such as "if n<=1 then return", the standard comparison-count question is well-defined.

For the repaired algorithm, one call on n>=2 performs exactly n−1 tests A[i]>A[i+1], irrespective of the data or whether the consequent swap executes. It then calls the procedure once on n−1. Therefore a1=0 and an=a(n−1)+(n−1), n>=2. Equivalently a0=0 may be used with the guard. Repeated substitution gives
an=(n−1)+(n−2)+...+1+a1=n(n−1)/2.
An induction verifies the closed form: it is 0 at n=1; if a(n−1)=(n−1)(n−2)/2, adding n−1 yields n(n−1)/2. Thus the comparison count and running time are Theta(n2), even for sorted input, because there is no early-exit flag. The swaps, unlike tests, depend on data: zero for sorted input, up to n(n−1)/2 for reverse order with distinct entries.

A complete repaired algorithm is:
procedure bubblesort(A,n):
    if n<=1: return
    for i=1,...,n-1:
        if A[i]>A[i+1]:
            temp:=A[i]
            A[i]:=A[i+1]
            A[i+1]:=temp
    bubblesort(A,n-1)

Each pass moves the largest of the first n entries to position n; recursion sorts the preceding prefix. Without the added guard the recursive calls proceed through n=1,0,−1,... (or fail because of the index type/stack), so the printed code does not successfully finish. The finite formula is explicitly for the repaired intended algorithm, not a claim that the literal program terminates.

Original paper, page 11

5 marks · Descriptive
Report issue

Leaves in a full binary tree

Trees & Connectivity

Question 16, GATE 1993: Prove by mathematical induction that a binary tree in which every non-leaf node has two descendants has one more leaf than non-leaf node. Interpret descendants here as immediate children, i.e. a finite nonempty full binary tree.
Tap to enlarge
Answer & solution

Answer: L=I+1 for every finite nonempty full binary tree. (no official key was published)

Let I be the number of internal (non-leaf) nodes and L the number of leaves. We prove L=I+1 by strong induction on I for finite nonempty full binary trees.

Base case I=0: there is only the root, and it is a leaf. Thus L=1=I+1. The empty tree is excluded: it would have L=I=0 and would not satisfy the stated formula.

Inductive hypothesis: for every full binary tree with fewer than k internal nodes, the number of leaves is one more than the number of internal nodes. Consider a tree with k>=1 internal nodes. Its root is internal and, by the full-tree condition, has exactly two children. The subtrees rooted at these children are nonempty full binary trees; call their internal and leaf counts I1,L1 and I2,L2. Each Ii<k, and k=1+I1+I2. The induction hypothesis applies to both subtrees: L1=I1+1 and L2=I2+1. Their leaves are disjoint and are exactly the leaves of the original tree, since the root is not a leaf. Hence L=L1+L2=I1+I2+2=k+1. This completes the induction.

An equivalent structural induction starts with one leaf and replaces any leaf by an internal node with two new leaf children. Every such operation increases I by one and increases L by one (remove one leaf, add two), preserving L−I=1. As an independent check, a tree with I+L vertices has I+L−1 edges; counting edges by parents gives 2I, so 2I=I+L−1. The immediate-child interpretation matters: general binary trees permitting a single child need not obey the formula.

Original paper, page 12

5 marks · Descriptive
Report issue

Food-preference counts and missing union information

Combinatorics & Counting

Question 17, GATE 1993: Among 21 persons, 9 eat vegetables, 10 fish, 7 eggs, and 5 all three. How many eat at least two of the three? The statement does not say that every person eats one of them.
Tap to enlarge
Answer & solution

Answer: Underdetermined: at least-two may be any integer 5–10. Requiring all 21 to eat one dish is inconsistent. (no official key was published)

Let x1,x2,x3 count persons eating exactly one, exactly two, and exactly three dishes. Here x3=5. Counting memberships across the three sets yields x1+2x2+3*5=9+10+7=26, hence x1+2x2=11. Let x0 count persons eating none. The group total gives x0+x1+x2+5=21. Eliminating x1 shows x0=5+x2. Thus the requested count x2+x3=x2+5 is not fixed by the given data; equivalently it equals x0. The union size is 16−x2.

The individual set totals do impose bounds. After removing the five triple-eaters, the residual vegetable, fish, and egg memberships are respectively 4,5,2. If a,b,c count exactly vegetable/fish, vegetable/egg, fish/egg, then a+b<=4, a+c<=5, b+c<=2. Their sum x2 is nonnegative and 2x2<=4+5+2=11, so x2<=5. Both extremes are feasible. For x2=0, take only-vegetable=4, only-fish=5, only-eggs=2, all-three=5, none=5: all totals match and at least-two=5. For x2=5, take exactly-VF=3, exactly-VE=1, exactly-FE=1, only-fish=1, all-three=5, none=10, with other single-only counts zero. This again matches all totals, but at least-two=10. Intermediate x2 values are feasible too (for x2<=4 use only VF pairs, and use the preceding construction for 5). Therefore the possible answer is any integer from 5 through 10, not a unique number.

Do not assume all 21 eat at least one. With union=21, inclusion-exclusion gives sum of pairwise intersection sizes=26+5−21=10. But the five triple-eaters alone contribute 15 to that sum, a contradiction. Equivalently x0=0 would require x2=−5. Consequently adding that common implicit assumption does not rescue a unique answer; it makes the data inconsistent. No official correction or key is verified.

Original paper, page 12

5 marks · Descriptive
Report issue

Truth-table proof of logical consequence

Propositional & Predicate Logic

Question 18, GATE 1993: Using a truth table, prove that C follows logically from F=A AND (A implies (B OR C)) AND (B implies NOT A).
Tap to enlarge
Answer & solution

Answer: F entails C; F is true only on (A,B,C)=(1,0,1). (no official key was published)

A logical consequence requires that every valuation making the premises true also makes C true. It does not require C to be true on every valuation. Evaluate the two material implications using P implies Q = (NOT P) OR Q. The complete truth table is:

A B C | B∨C | A→(B∨C) | ¬A | B→¬A | F | F→C
0 0 0 |  0  |     1    |  1 |   1   | 0 |  1
0 0 1 |  1  |     1    |  1 |   1   | 0 |  1
0 1 0 |  1  |     1    |  1 |   1   | 0 |  1
0 1 1 |  1  |     1    |  1 |   1   | 0 |  1
1 0 0 |  0  |     0    |  0 |   1   | 0 |  1
1 0 1 |  1  |     1    |  0 |   1   | 1 |  1
1 1 0 |  1  |     1    |  0 |   0   | 0 |  1
1 1 1 |  1  |     1    |  0 |   0   | 0 |  1

The only row with F=1 is A=1,B=0,C=1; in that row C=1. Equivalently the final column F→C consists entirely of 1s, so F entails C. This is a non-vacuous consequence because F does have a satisfying assignment.

For an additional reasoning check, F includes A, forcing A=true. Its last conjunct B→¬A then forces B=false, because ¬A is false. With A true, the middle conjunct forces B∨C=true, so C must be true. In fact F is equivalent to A AND NOT B AND C. The table, rather than this shorter argument alone, supplies the proof format requested by the question.

Original paper, page 12

5 marks · Descriptive
Report issue

NAND controller transition table

Finite-State Machine Design

Question 19, GATE 1993: Two common-clock D flip-flops hold A,B. The two NAND inputs to the final NAND for D_A are NAND(¬A,B), NAND(¬A,¬P); those for D_B are NAND(P,¬B), NAND(¬P,A). Derive the state transition table.
Tap to enlarge
Answer & solution

Answer: AB,P → A⁺B⁺: 00,0→10; 00,1→01; 01,0→10; 01,1→10; 10,0→01; 10,1→01; 11,0→01; 11,1→00. (no official key was published)

Read the feedback labels and output inversion bubbles before simplifying: the upper two first-stage gates share ¬A, and the bottom gate uses A and ¬P. A NAND of two NAND outputs implements an OR of their underlying products. Therefore D_A=¬A·B+¬A·¬P=¬A(B+¬P), and D_B=P·¬B+¬P·A. On a clock edge the new states are these D values evaluated from the old A,B and sampled P, not from a newly updated flip-flop.

For P=0 the equations become A⁺=¬A and B⁺=A, so old states with A=0 go to 10 and those with A=1 go to 01. For P=1 they become A⁺=¬A·B and B⁺=¬B. Evaluating 00,01,10,11 gives 01,10,01,00 respectively.

Complete table (old AB: next for P=0 / next for P=1):
00: 10 / 01
01: 10 / 10
10: 01 / 01
11: 01 / 00.
This table includes all eight state/input combinations. Crossing wires without junction dots are not additional connections. Both source diagrams agree on the labelled feedback paths.

Original paper, page 12

Descriptive
Report issue

Five-byte input transfer

Instructions & Addressing Modes

Question 20(a), GATE 1993: Identify the function of this 8085 segment: LHLD 5000; MVI B,5; GET: IN 20; MOV M,A; INX H; DCR B; JNZ GET.
Question 20(a), GATE 1993: Identify the function of this 8085 segment: LHLD 5000; MVI B,5; GET: IN 20; MOV M,A; INX H; DCR B; JNZ GET.
Question 20(a), GATE 1993: Identify the function of this 8085 segment: LHLD 5000; MVI B,5; GET: IN 20; MOV M,A; INX H; DCR B; JNZ GET.
Tap to enlarge
Answer & solution

Answer: Read five bytes from input port 20 into consecutive memory cells starting at the address stored at 5000/5001. (no official key was published)

LHLD is a direct memory load of a register pair, not an immediate-address load: it loads L from memory[5000] and H from memory[5001]. Let the resulting 16-bit pointer be h. MVI initializes counter B to five. Each iteration reads one byte from the designated input port into accumulator A, and MOV M,A writes it to the memory location addressed by HL.

INX H advances the pointer by one. DCR B decreases the loop count and sets the zero flag. JNZ returns to GET while that count is nonzero. Thus the five iteration-start counts are 5,4,3,2,1, and exactly five input operations occur. The writes target h,h+1,…,h+4; afterward B=0 and HL=h+5, modulo the 16-bit address space.

The numeric radix of bare literals is not explicitly supplied; using customary hexadecimal assembly notation makes the pointer cells 5000H/5001H and port 20H. The transfer structure is unchanged under another assembler's radix convention. No input-ready polling or handshaking is implemented; the program assumes each IN yields a usable byte.

Original paper, page 13

Descriptive
Report issue

Register and address roles

Instructions & Addressing Modes

Question 20(b), GATE 1993: List the registers and addressed locations used by: LHLD 5000; MVI B,5; GET: IN 20; MOV M,A; INX H; DCR B; JNZ GET.
Question 20(b), GATE 1993: List the registers and addressed locations used by: LHLD 5000; MVI B,5; GET: IN 20; MOV M,A; INX H; DCR B; JNZ GET.
Question 20(b), GATE 1993: List the registers and addressed locations used by: LHLD 5000; MVI B,5; GET: IN 20; MOV M,A; INX H; DCR B; JNZ GET.
Tap to enlarge
Answer & solution

Answer: HL destination pointer; B count; A input byte; cells 5000/5001 hold pointer; 20 is input-port address; GET is a code label. (no official key was published)

L and H jointly form a 16-bit destination pointer, with L the low byte. LHLD fetches its initial low and high bytes from consecutive memory cells 5000 and 5001; it does not set HL to the literal 5000. The symbol M in MOV M,A denotes memory addressed indirectly by HL and is not another physical register.

A is the accumulator carrying the latest byte returned by IN. B is an 8-bit down-counter initialized to five; DCR B updates the zero condition used by JNZ. INX H changes the register-pair pointer, so successive MOV operations reach consecutive destination addresses. The zero flag is tested after decrement, ensuring five iterations.

The operand 20 designates an I/O port in the separate 8085 port-address space, whereas 5000 and 5001 are memory addresses. GET labels the IN instruction in code and is the branch destination. At completion the original pointer storage cells need not change, B is zero, A contains the last input value, and HL points one location beyond the five-byte output block, subject to address wraparound.

Original paper, page 13

Descriptive
Report issue

LRU page-fault trace

Virtual Memory & Paging

Question 21(a), GATE 1993: Four initially empty page frames receive [1, 2, 3, 4, 1, 3, 5, 2, 1, 5, 4, 3, 2, 3]. Identify each page fault under LRU.
Question 21(a), GATE 1993: Four initially empty page frames receive [1, 2, 3, 4, 1, 3, 5, 2, 1, 5, 4, 3, 2, 3]. Identify each page fault under LRU.
Question 21(a), GATE 1993: Four initially empty page frames receive [1, 2, 3, 4, 1, 3, 5, 2, 1, 5, 4, 3, 2, 3]. Identify each page fault under LRU.
Tap to enlarge
Answer & solution

Answer: 9 faults, at reference positions 1,2,3,4,7,8,11,12,13. (no official key was published)

Step through it (16 steps)

The first four distinct references each fault and fill the four frames. On a later miss, evict the oldest entry in the policy order below. For LRU that means least recently used; for FIFO it means earliest loaded. LRU moves a referenced resident page to most-recent position even on a hit. Thus after references 5 and 6 the order is 2,4,1,3, and page 2 is evicted for page 5 at reference 7.

The full trace lists reference position, requested page, result, and policy order from eviction candidate to newest:
1: page 1, fault, order 1
2: page 2, fault, order 1,2
3: page 3, fault, order 1,2,3
4: page 4, fault, order 1,2,3,4
5: page 1, hit, order 2,3,4,1
6: page 3, hit, order 2,4,1,3
7: page 5, fault, order 4,1,3,5
8: page 2, fault, order 1,3,5,2
9: page 1, hit, order 3,5,2,1
10: page 5, hit, order 3,2,1,5
11: page 4, fault, order 2,1,5,4
12: page 3, fault, order 1,5,4,3
13: page 2, fault, order 5,4,3,2
14: page 3, hit, order 5,4,2,3

There are 9 faults. Positions are reported rather than only page values because the same page can fault more than once. Initially empty frames cause compulsory faults too; omitting them would undercount.

Original paper, page 13

Descriptive
Report issue

FIFO page-fault trace

Virtual Memory & Paging

Question 21(b), GATE 1993: Four initially empty page frames receive [1, 2, 3, 4, 1, 3, 5, 2, 1, 5, 4, 3, 2, 3]. Identify each page fault under FIFO.
Question 21(b), GATE 1993: Four initially empty page frames receive [1, 2, 3, 4, 1, 3, 5, 2, 1, 5, 4, 3, 2, 3]. Identify each page fault under FIFO.
Question 21(b), GATE 1993: Four initially empty page frames receive [1, 2, 3, 4, 1, 3, 5, 2, 1, 5, 4, 3, 2, 3]. Identify each page fault under FIFO.
Tap to enlarge
Answer & solution

Answer: 8 faults, at reference positions 1,2,3,4,7,9,13,14. (no official key was published)

Step through it (16 steps)

The first four distinct references each fault and fill the four frames. On a later miss, evict the oldest entry in the policy order below. For LRU that means least recently used; for FIFO it means earliest loaded. FIFO changes its insertion order only on a fault. Hits at references 5 and 6 do not refresh pages 1 and 3. Therefore page 1, the oldest arrival, is evicted for page 5 at reference 7.

The full trace lists reference position, requested page, result, and policy order from eviction candidate to newest:
1: page 1, fault, order 1
2: page 2, fault, order 1,2
3: page 3, fault, order 1,2,3
4: page 4, fault, order 1,2,3,4
5: page 1, hit, order 1,2,3,4
6: page 3, hit, order 1,2,3,4
7: page 5, fault, order 2,3,4,5
8: page 2, hit, order 2,3,4,5
9: page 1, fault, order 3,4,5,1
10: page 5, hit, order 3,4,5,1
11: page 4, hit, order 3,4,5,1
12: page 3, hit, order 3,4,5,1
13: page 2, fault, order 4,5,1,2
14: page 3, fault, order 5,1,2,3

There are 8 faults. Positions are reported rather than only page values because the same page can fault more than once. Initially empty frames cause compulsory faults too; omitting them would undercount.

Original paper, page 13

5 marks · Descriptive
Report issue

Semaphore precedence implementation

Synchronization & Concurrency

Question 22, GATE 1993: Implement DAG edges S1→S2,S1→S3,S2→S4,S2→S5,S3→S5,S6→S4,S6→S5 using parbegin/parend and semaphores. Note S6 is a source, not a sink.
Tap to enlarge
Answer & solution

Answer: One zero-initialized semaphore per edge; each task waits on incoming edges and signals outgoing edges. (no official key was published)

Use semaphores e12,e13,e24,e25,e35,e64,e65, each initialized to zero. P(e) waits and decrements atomically; V(e) signals. Run these six branches in one parbegin/parend block:

begin S1; V(e12); V(e13) end
begin P(e12); S2; V(e24); V(e25) end
begin P(e13); S3; V(e35) end
begin P(e24); P(e64); S4 end
begin P(e25); P(e35); P(e65); S5 end
begin S6; V(e64); V(e65) end

For each edge u→v, its semaphore can be signalled only after Su finishes, and Sv cannot start until its wait succeeds. Hence every required precedence is enforced. Distinct edge semaphores prevent one successor from consuming another's notification. They also allow a signal to arrive before its matching wait without being lost.

Only S1 and S6 have no predecessors, so they can begin concurrently. S4 awaits S2 and S6, while S5 awaits S2,S3,S6. In particular, the arrows drawn upward from S6 end at S4 and S5; reversing them would implement a different graph. No extra ordering is imposed between incomparable task executions, although a blocked wait can hold a branch until all its own predecessors finish. With terminating tasks and fair scheduling this acyclic dependency system has no synchronization deadlock.

Original paper, page 13

5 marks · Descriptive
Report issue

Students taught by Ramesh

SQL & Queries

Question 23, GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Retrieve roll number and name of students with grade A in at least one course taught by a teacher named Ramesh.
Question 23, GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Retrieve roll number and name of students with grade A in at least one course taught by a teacher named Ramesh.
Question 23, GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Retrieve roll number and name of students with grade A in at least one course taught by a teacher named Ramesh.
Tap to enlarge
Answer & solution

Answer: Use EXISTS to correlate enrollment and teaching to each student. (no official key was published)

A student qualifies if some enrollment has their roll number and grade A, and some teaching row for that enrollment's course has tname='Ramesh'. The course number is the join between ENROLL and TEACH; names need not be unique teacher identifiers.

SELECT s.rollno, s.sname
FROM STUDENTS AS s
WHERE EXISTS (
  SELECT 1 FROM ENROLL AS e
  JOIN TEACH AS t ON t.cno=e.cno
  WHERE e.rollno=s.rollno
    AND e.grade='A' AND t.tname='Ramesh'
);

EXISTS yields one truth value for each outer student, so several qualifying courses or several teachers named Ramesh do not duplicate the output. A plain join version would need DISTINCT for that purpose. The COURSES relation is unnecessary because the query does not request a course name or another condition on it. No requirement says the student must have an A in every Ramesh-taught course; replacing EXISTS with universal division would answer a stronger question.

The source TEACH attribute is printed cao but described as course number cno, and its FD list prints sdaddr for saddr. These obvious naming inconsistencies are explicitly normalized in the query rather than treated as extra attributes.

Original paper, page 14

Descriptive
Report issue

Third-normal-form diagnosis

Normalization & Decomposition

Question 24(a), GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Is this database in 3NF?
Question 24(a), GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Is this database in 3NF?
Question 24(a), GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Is this database in 3NF?
Question 24(a), GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Is this database in 3NF?
Tap to enlarge
Answer & solution

Answer: No: TEACH violates 3NF through tno→tname. (no official key was published)

Step through it (4 parts)

Treat each listed relation separately and use the supplied FDs as the schema constraints. In STUDENTS, rollno is a key and determines the other attributes; COURSES likewise has key cno. ENROLL's determinant (rollno,cno) is its key. These three relations therefore satisfy BCNF, and in particular 3NF, under the stated dependencies.

TEACH has declared composite key (tno,cno). The dependency tno→tname is nontrivial, but tno alone does not determine cno, so it is not a superkey. The dependent attribute tname is not a member of the candidate key and is nonprime. This violates the 3NF test that every nontrivial FD have a superkey determinant or prime right-side attribute. Indeed it is already a partial dependency of a nonprime attribute on part of the composite key, violating 2NF.

Do not infer that tno is a key simply because it identifies a teacher: a teacher can occur in several teaching rows, one per course. No additional FD tno→cno is supplied. If such a different constraint were imposed the answer could change, but it is not part of this schema.

Original paper, page 14

Descriptive
Report issue

Normalize the teaching relation

Normalization & Decomposition

Question 24(b), GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Normalize the relations to 3NF if needed.
Question 24(b), GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Normalize the relations to 3NF if needed.
Question 24(b), GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Normalize the relations to 3NF if needed.
Question 24(b), GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Normalize the relations to 3NF if needed.
Question 24(b), GATE 1993: STUDENTS(rollno key,sname,saddr), COURSES(cno key,cname), ENROLL(rollno,cno composite key,grade), TEACH(tno,cno composite key,tname). FDs: rollno→sname,saddr; cno→cname; tno→tname; rollno,cno→grade. The reproduced cao/sdaddr spellings are interpreted as cno/saddr. Normalize the relations to 3NF if needed.
Tap to enlarge
Answer & solution

Answer: Keep STUDENTS,COURSES,ENROLL; replace TEACH with TEACHER(tno key,tname) and TEACHES(tno,cno composite key). (no official key was published)

Separate teacher facts from teaching assignments. Use TEACHER(tno,tname) with primary key tno, and TEACHES(tno,cno) with primary key (tno,cno). Retain the other three relations unchanged. The dependency tno→tname now has a key determinant in TEACHER; no supplied nontrivial non-key dependency remains in TEACHES. Thus both components are BCNF, stronger than the requested 3NF.

This decomposition is lossless under the given FD. Its intersection is {tno}, which determines all of TEACHER. More concretely, every teaching pair joins to its unique teacher name, and rows sharing a teacher number cannot acquire different names because of the FD. Projecting a valid original TEACH relation and joining the projections therefore reconstructs it without spurious combinations of teacher names and assignments.

It also preserves the relevant dependency locally in TEACHER. Separating tname into a relation with only cno instead would attach a teacher name to a course rather than its determining teacher number, and would not preserve the intended dependency. Identical names across different teacher numbers remain permitted.

Original paper, page 14

Descriptive
Report issue

Grammar for small Pascal statements

Parsing & Syntax Analysis

Question 25(a), GATE 1993: Construct an ordinary CFG for assignment id:=expression, for id:=expression to expression do statement, and begin statement;…;statement end. expression is already defined. Do not use EBNF optional brackets or star.
Question 25(a), GATE 1993: Construct an ordinary CFG for assignment id:=expression, for id:=expression to expression do statement, and begin statement;…;statement end. expression is already defined. Do not use EBNF optional brackets or star.
Tap to enlarge
Answer & solution

Answer: S→id := E | for id := E to E do S | begin L end; L→S | S ; L. (no official key was published)

Let S denote a statement, L a nonempty statement list, E the given expression nonterminal, and id an identifier token. Use:
S → id := E
S → for id := E to E do S
S → begin L end
L → S
L → S ; L

The first production recognizes assignments. The second has a statement as its body, permitting either a single assignment, another loop, or a block. The third encloses a list in begin/end. The two L productions generate exactly one or more statements separated by semicolons, without a trailing semicolon. They replace the informal ellipsis with ordinary CFG recursion; no repetition operator or optional metasyntax is used.

For any finite list length k≥1, apply L→S;L exactly k−1 times and finish with L→S. Conversely each derivation has precisely that separator structure. An empty block is not explicitly requested; if the language separately permits begin end, add an epsilon-list production as an explicit extension rather than silently changing the language. Expression syntax is delegated to the provided E grammar.

Original paper, page 14

Descriptive
Report issue

Parse a for-loop block

Parsing & Syntax Analysis

Question 25(b), GATE 1993: Using S→id:=E | for id:=E to E do S | begin L end and L→S | S;L, draw the parse tree for: for j:=2 to 10 do begin x:=expr1; y:=expr2 end.
Question 25(b), GATE 1993: Using S→id:=E | for id:=E to E do S | begin L end and L→S | S;L, draw the parse tree for: for j:=2 to 10 do begin x:=expr1; y:=expr2 end.
Question 25(b), GATE 1993: Using S→id:=E | for id:=E to E do S | begin L end and L→S | S;L, draw the parse tree for: for j:=2 to 10 do begin x:=expr1; y:=expr2 end.
Tap to enlarge
Answer & solution

Answer: Root loop S, body block S, two assignment statements linked by L→S;L. (no official key was published)

The outermost construct is the for production, not a sequencing block. Its body is one statement S expanded as begin L end. Inside that block the list has two assignments, so its first L uses S;L and its final L uses S.

S
├─for
├─id(j)
├─:=
├─E(2)
├─to
├─E(10)
├─do
└─S
  ├─begin
  ├─L
  │ ├─S
  │ │ ├─id(x)
  │ │ ├─:=
  │ │ └─E(expr1)
  │ ├─;
  │ └─L
  │   └─S
  │     ├─id(y)
  │     ├─:=
  │     └─E(expr2)
  └─end

Reading leaves left to right gives exactly the requested token sequence. The E subtrees are abbreviated because the expression grammar was stipulated as already defined; 2 and 10 are constant expressions and expr1/expr2 stand for their expression subtrees. The semicolon separates the two assignments, while begin/end make both assignments part of a single loop body.

Original paper, page 14

Descriptive
Report issue

Passing reference and value parameters

Runtime Environments & Parameter Passing

Question 26(a), GATE 1993: Procedure P(var x:integer; y:integer) is called as P(a,b). What is pushed on the argument stack for a and b?
Question 26(a), GATE 1993: Procedure P(var x:integer; y:integer) is called as P(a,b). What is pushed on the argument stack for a and b?
Tap to enlarge
Answer & solution

Answer: Address of a for x; current integer value of b for y. (no official key was published)

The var qualifier gives x reference semantics: P must be able to access and modify the caller's actual variable a. Therefore pass a's storage address, not merely its current contents. The unqualified integer y is a value parameter, so evaluate b and push a copy of its current integer value.

After entry, assigning to x changes a because x denotes a through the supplied reference. Assigning to y changes only the callee's copy, leaving b unchanged. Passing the address of b for y would instead implement reference semantics; passing only a's value for x would lose the required alias to the caller's variable.

The question concerns argument payloads, not a complete activation-record layout. Return addresses, saved links and registers may also occupy the stack, but their presence does not change these two payloads. Argument order and stack growth direction depend on the calling convention and are not specified, so no particular push order or numeric offsets should be invented.

Original paper, page 14

Descriptive
Report issue

Addressing formal parameters

Runtime Environments & Parameter Passing

Question 26(b), GATE 1993: Procedure P(var x:integer; y:integer) receives the address of actual a and value of actual b on its stack. How does generated addressing for x differ from y?
Question 26(b), GATE 1993: Procedure P(var x:integer; y:integer) receives the address of actual a and value of actual b on its stack. How does generated addressing for x differ from y?
Question 26(b), GATE 1993: Procedure P(var x:integer; y:integer) receives the address of actual a and value of actual b on its stack. How does generated addressing for x differ from y?
Tap to enlarge
Answer & solution

Answer: x uses an indirect load/store through its pointer slot; y uses its own value slot directly. (no official key was published)

With a frame pointer FP and symbolic offsets ox,oy, the slot at FP+ox contains an address, whereas the slot at FP+oy contains an integer. To read x, first load ptr:=memory[FP+ox], then load memory[ptr]. To assign x:=v, store v into memory[ptr]. These operations reach the caller's a.

To read y, load memory[FP+oy] directly. To assign y:=v, store v into that same local argument slot. This changes the callee's copied value, not b. Thus reference-parameter access has one extra level of indirection relative to a direct stack-slot value parameter, even if a machine's addressing modes combine the micro-operations in one instruction.

The offsets remain symbolic because the source specifies neither stack layout nor saved control fields. If the compiler caches a parameter in a register, it must preserve the same observable aliasing behavior; such optimization does not change the semantic distinction being asked about.

Original paper, page 14

5 marks · Descriptive
Report issue

DFA excluding three consecutive b characters

Finite Automata

Question 27, GATE 1993: Draw a DFA over {a,b} accepting exactly strings with no substring bbb.
Tap to enlarge
Answer & solution

Answer: States q0,q1,q2 accepting, qD rejecting; start q0; a resets q0 before death; b advances q0→q1→q2→qD; qD loops. (no official key was published)

Step through it (2 parts)

While no forbidden substring has appeared, only the length of the trailing run of b characters matters. State q0 means zero trailing b's, q1 one, and q2 two. A third consecutive b makes the input permanently unacceptable, represented by rejecting sink qD.

Transition diagram as a complete edge list:
q0 --a--> q0; q0 --b--> q1
q1 --a--> q0; q1 --b--> q2
q2 --a--> q0; q2 --b--> qD
qD --a,b--> qD.
Start at q0; accepting states are q0,q1,q2. In particular epsilon is accepted, and bb is accepted but bbb is not.

Induct on the processed prefix: before a forbidden block occurs, the named state records its trailing b count; an a resets that count and a b increments it. Upon reaching three, qD is entered and can never be escaped, so later a's cannot erase an earlier violation. This invariant proves both acceptance of every valid string and rejection of every invalid one. Four states are also minimal: qD differs from all accepting states on epsilon, and q0,q1,q2 can be distinguished by appending b or bb as appropriate.

Original paper, page 15

Descriptive
Report issue

Commuting products in a two-element semigroup

Algebraic Structures

Question 28(a), GATE 1993: In semigroup ({p,q},*) with p*p=q, prove p*q=q*p.
Question 28(a), GATE 1993: In semigroup ({p,q},*) with p*p=q, prove p*q=q*p.
Tap to enlarge
Answer & solution

Answer: Associativity gives p*(p*p)=(p*p)*p. (no official key was published)

A semigroup operation is associative. Substitute q=p*p into the left product: p*q=p*(p*p). Associativity permits regrouping this as (p*p)*p, and replacing p*p by q yields q*p. Thus the two mixed products coincide.

This argument does not assume that every semigroup is commutative; that is generally false. It works here because q is a power of p, and the two products are simply two parenthesizations of p*p*p. Their common value need not be determined to establish equality. In the two-element set it is either p or q, a fact used in the next part, but not needed for this equality itself.

Original paper, page 15

Descriptive
Report issue

Idempotence of the second semigroup element

Algebraic Structures

Question 28(b), GATE 1993: In semigroup ({p,q},*) with p*p=q, prove q*q=q. You may use p*q=q*p.
Question 28(b), GATE 1993: In semigroup ({p,q},*) with p*p=q, prove q*q=q. You may use p*q=q*p.
Question 28(b), GATE 1993: In semigroup ({p,q},*) with p*p=q, prove q*q=q. You may use p*q=q*p.
Tap to enlarge
Answer & solution

Answer: Closure and associativity, splitting cases p*q=p or p*q=q, give q*q=q. (no official key was published)

By closure, the common mixed product r=p*q=q*p is one of the two elements p,q. If r=p, then q*q=(p*p)*q=p*(p*q)=p*p=q. Every regrouping is justified by associativity.

If r=q, then again q*q=(p*p)*q=p*(p*q)=p*q=q. Thus both possible values of r yield the same required result. The argument uses the two-element universe: in a larger semigroup, p²=q need not force q²=q. For example the positive integers under addition give p=1,q=2 but q+q=4≠2.

The two resulting multiplication tables are consistent possibilities: with r=p the table is pp=q,pq=qp=p,qq=q; with r=q it is pp=pq=qp=qq=q. The proof establishes idempotence without selecting one of these possible semigroups.

Original paper, page 15