GATE / CS ARCHIVE

PAPER / ORIGINAL ORDER

GATE 2005

90 questions

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

03:00:00
1 mark · MCQ
Report issue

Reading a function-pointer declaration

Structures & Declarations

Question 1, GATE 2005: Interpret C declaration int (*f)(int *). A function taking int* and returning int; B function taking int and returning int*; C pointer to function taking int* and returning int; D function taking int* and returning a function pointer.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

In int (*f)(int *), the parentheses make f a pointer. Its target is a function taking one int-pointer argument and returning int. Thus C; it is not a function returning a pointer.

Read outward from f. The parentheses bind *f before the following parameter list, so f is a pointer. Its pointed-to object is a function whose parameter is int* and whose return type, written at the left, is int. Without parentheses, int *f(int*) would instead declare a function returning int*. That binding distinction gives C.

Original paper, page 1

1 mark · MCQ
Report issue

Abstract data type interface

Other / Mixed Topics

Question 2, GATE 2005: An abstract data type is: A an abstract class; B a type that cannot be instantiated; C a type used through its defined operations rather than arbitrary representation operations; D all of these.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

An ADT specifies values and the operations permitted on them while hiding representation. Clients use its defined interface, C. It is not identical to an abstract class and does not imply that values/instances cannot be created.

An ADT defines permitted values and operations independently of how data is stored. A stack, for example, offers push/pop without letting clients depend on array indices or linked-node layout. It can have instances and can be implemented in many languages, including languages without classes. Thus C describes abstraction; A and B confuse separate language mechanisms with the abstract specification.

Original paper, page 1

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Declarative programming paradigms

Other Computing Topics

Question 3, GATE 2005: Common property of logic and functional languages? A procedural; B based on lambda calculus; C declarative; D use Horn clauses.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Logic programming states logical relations, while functional programming expresses computations through functions rather than imperative state-changing instruction sequences. Both are conventionally classified as declarative, C. Lambda calculus is the usual basis for functional programming; Horn clauses are associated with logic programming, not both paradigms.

Logic programs describe facts/rules and functional programs compose function expressions. Both conventionally emphasize what result or relation is specified rather than a sequence of mutable-state commands, hence declarative. Functional foundations commonly use lambda calculus; Horn clauses are associated with logic programming. Neither foundation is common to both simply because both are declarative.

Original paper, page 1

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Object-oriented language features

Other Computing Topics

Question 4, GATE 2005: Which are essential conventional OOP features? I abstraction/encapsulation; II strict typing; III type safety with subtype rule; IV polymorphism with inheritance. A I/II; B I/IV; C I/II/IV; D I/III/IV.
Tap to enlarge
Your answer
Answer & solution

Answer: B under the conventional classification (no official key was published)

Abstraction/encapsulation and subtype polymorphism with inheritance are standard object-oriented features, statements i and iv. Object-oriented languages can be dynamically typed and need not enforce the particular strict typing/type-safety requirements in ii and iii. Thus B. This is the conventional feature taxonomy, not a theorem that every language called object-oriented must use class inheritance.

Encapsulation groups state with operations and hides representation, while polymorphism allows a common interface to have different implementations. These are I and IV in the question’s conventional taxonomy. Dynamic object-oriented languages show that strict static typing is not required; the specific type-safety/subtyping rule is also not universal. The classification is pedagogical, not a mathematical definition excluding prototype-based OOP.

Original paper, page 1

1 mark · MCQ
Report issue

Counting scores above fifty

Arrays & Linked Lists

Question 5, GATE 2005: Read 500 integer scores in [0, 100] and print frequencies of scores above 50. Best frequency storage? A array of 50 numbers; B array of 100; C array of 500; D dynamically allocated array of 550.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Only scores 51 through 100 need counts, exactly 50 possible values. Maintain a 50-entry array initialized to zero and increment index score−51 whenever score>50. All 500 observations can be streamed without storage, so A.

The only reported scores are 51, 52,…, 100, exactly 50 possibilities. Allocate one counter for each and map a qualifying score s to index s−51. Increment its counter while reading; scores at most 50 need no stored frequency for the requested output. The program need not retain all 500 observations. This distinguishes number of possible output categories from number of input records.

Original paper, page 1

1 mark · MCQ
Report issue

Spanning trees of a complete unit graph

Trees & Connectivity

Question 6, GATE 2005: An undirected n-vertex graph has adjacency matrix with zero diagonal and all other entries 1. Which MST claim? A none; B unique with cost n−1; C multiple distinct MSTs each cost n−1; D multiple spanning trees with differing costs. The n≥3 assumption for C is not explicitly printed.
Tap to enlarge
Your answer
Answer & solution

Answer: C for n≥3 (no official key was published)

The adjacency matrix describes Kn with unit edge weights. Every spanning tree has n−1 edges and therefore cost n−1. For n≥3 there are multiple spanning trees (indeed nn−2), giving C. The prompt does not restrict n: K1 and K2 each have a unique spanning tree, so the multiple-tree assertion requires the nontrivial n≥3 convention.

The matrix describes a complete graph Kn. Interpreting all edges with unit weight, any spanning tree has n−1 edges and thus equal cost n−1. When n≥3, different trees exist, so C is intended. But n=1 or 2 gives a unique tree, which is why the unprinted size restriction must stay explicit. Neither a different tree shape nor a different traversal order changes total cost here.

Original paper, page 1

1 mark · MCQ
Report issue

Computing transitive closure

Graph Algorithms

Question 7, GATE 2005: A known bound for computing transitive closure of an n-element relation is: A O(n); B O(n log n); C O(n^(3/2)); D O(n³).
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Warshall’s algorithm considers each possible intermediate vertex k and updates reachability R[i, j]←R[i, j]∨(R[i, k]∧R[k, j]) for every i, j. Its three nested loops take O(n³), D. Faster algebraic algorithms exist; the question asks a known upper bound, not a tight lower bound. The other listed bounds are subquadratic and cannot explicitly output every entry of an arbitrary n×n closure matrix.

Warshall’s algorithm loops over intermediate vertex k and every ordered pair(i, j), updating reachability using i→k→j. There are n choices in each loop, giving O(n³). This is a known upper bound, not a proof that faster algebraic methods are impossible. An explicitly written arbitrary n×n closure has quadratic output size, so the three listed subquadratic alternatives cannot generally output the full matrix.

Original paper, page 1

1 mark · MCQ
Report issue

Nested set differences

Sets, Relations & Functions

Question 8, GATE 2005: For nonempty sets A, B, C, let X=(A−B)−C and Y=(A−C)−(B−C). Choose A X=Y; B X is a proper subset of Y; C Y is a proper subset of X; D none.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

X=(A∖B)∖C=A∩Bᶜ∩Cᶜ. In Y=(A∖C)∖(B∖C), an element already outside C is removed exactly when it belongs to B. Hence Y=A∩Bᶜ∩Cᶜ=X, A.

Membership in X means being in A but neither B nor C. For Y, first exclude C from A. On those remaining elements, membership in B−C is exactly membership in B because C has already been excluded. Removing B−C therefore removes precisely the B-members, leaving the same A∩Bᶜ∩Cᶜ as X. Hence A, even though the original sets need not be disjoint.

Original paper, page 1

1 mark · MCQ
Report issue

Five-element nondistributive lattice

Partial Orders & Lattices

Question 9, GATE 2005: Hasse diagram has top a, bottom e, and three mutually incomparable middle elements b, c, d. Cover edges e<b, e<c, e<d and b<a, c<a, d<a. Classify: A not a lattice; B lattice but nondistributive; C distributive but not Boolean; D Boolean algebra.
Question 9, GATE 2005: Hasse diagram has top a, bottom e, and three mutually incomparable middle elements b, c, d. Cover edges e<b, e<c, e<d and b<a, c<a, d<a. Classify: A not a lattice; B lattice but nondistributive; C distributive but not Boolean; D Boolean algebra.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

The diagram has bottom e, top a, and three incomparable middle elements b, c, d. Every pair has a meet and join, so it is a lattice. But b∧(c∨d)=b∧a=b, whereas(b∧c)∨(b∧d)=e∨e=e. Thus it is not distributive, B.

Every pair of distinct middle elements has meet e and join a, so joins/meets exist and this is a lattice. Test distributivity using b, c, d: b∧(c∨d)=b∧a=b, but (b∧c)∨(b∧d)=e∨e=e. Since b≠e, distributivity fails. Thus B; the existence of a top and bottom alone does not make a lattice distributive or Boolean.

Original paper, page 1

1 mark · MCQ
Report issue

Faces in a connected planar embedding

Graph Theory

Question 10, GATE 2005: A simple connected planar graph has 13 vertices and 19 edges. Number of faces including outer face? A6; B8; C9; D13.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Euler’s formula V−E+F=2 includes the unbounded face. With V=13 and E=19, F=2−13+19=8, B.

Euler’s formula for a connected planar embedding is V−E+F=2, where F includes the unbounded outside region. Substituting 13 and 19 gives F=2−13+19=8. Seven would count only bounded regions; forgetting the outside face causes that common off-by-one error. Answer B.

Original paper, page 2

1 mark · MCQ
Report issue

Vertex cover and independence duality

Graph Theory

Question 11, GATE 2005: A simple graph with 20 vertices and 100 edges has minimum vertex cover size 8. Maximum independent-set size? A12; B8; C below 8; D above 12.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

A vertex set is a cover exactly when its complement is independent. Consequently the minimum-cover size plus maximum-independent-set size equals the number of vertices. Here α=20−8=12, A; the 100-edge count is not needed.

A vertex set is a cover exactly when its complement is independent: an uncovered edge would have both endpoints in that complement. Taking a smallest cover therefore gives a largest independent set, so α(G)+τ(G)=|V|. The answer is 20−8=12. The edge count is not needed once the minimum cover size is given.

Original paper, page 2

1 mark · MCQ
Report issue

Integrating a continuous density

Probability & Statistics

Question 12, GATE 2005: For continuous probability density f of X, express P(a<X≤b): A f(b−a); B f(b)−f(a); C ∫_a^b f(x)dx; D ∫_a^b x f(x)dx.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

For a≤b, probability P(a<X≤b)=∫_ab f(x)dx, C. Individual endpoints have probability zero for a continuous distribution. The integral of xf(x) instead contributes to an expectation.

A density is integrated over an interval to obtain probability, so P(a<X≤b)=∫_ab f(x)dx. A single point has probability zero for a continuous density, making endpoint inclusion immaterial here. The expression f(b)−f(a) uses density values rather than cumulative probabilities; multiplying by x would instead compute a truncated first moment. Hence C.

Original paper, page 2

1 mark · MCQ
Report issue

Multiplicative inverses modulo fifteen

Algebraic Structures

Question 13, GATE 2005: The units {1, 2, 4, 7, 8, 11, 13, 14} form a group under multiplication modulo 15. Inverses of 4 and 7? A3, 13; B2, 11; C4, 13; D8, 14.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

4×4=16≡1 modulo 15 and 7×13=91≡1 modulo 15. Thus the inverses are 4 and 13, respectively, C. Both belong to the displayed unit group.

An inverse x of a satisfies ax≡1 modulo 15. For 4, 4·4=16≡1. For 7, 7·13=91≡1. Both proposed inverses belong to the given unit group. Therefore C. These are modular inverses, not ordinary real-number reciprocals.

Original paper, page 2

1 mark · MCQ
Report issue

Predictive parsing and two grammar defects

Parsing & Syntax Analysis

Question 14, GATE 2005: Grammar A→AA|(A)|ε is unsuitable for predictive parsing because it is: A ambiguous; B left-recursive; C right-recursive; D an operator grammar. Assess the nonunique objections rather than forcing one choice.
Tap to enlarge
Your answer
Answer & solution

Answer: Both A and B are valid objections (no official key was published)

The production A→AA is directly left-recursive, so a naive predictive recursive-descent parser can recur indefinitely before consuming input; this is B. The same grammar is also ambiguous: ε has the distinct derivations A→ε and A→AA→εA→ε, giving different parse trees. An ambiguous grammar cannot be LL(1), so A is also a valid reason. Therefore the single-choice wording does not uniquely distinguish these two objections. Right recursion alone is not a barrier to predictive parsing.

The production A→AA begins with the same nonterminal, so direct predictive expansion can recurse without consuming input. Independently, ε has distinct parse trees A⇒ε and A⇒AA⇒εε, demonstrating ambiguity. A grammar with these properties cannot be LL(1), making both A and B valid reasons in the literal single-choice wording. Right recursion alone is not an objection to predictive parsing, and adjacent nonterminals also prevent the standard operator-grammar restriction.

Original paper, page 2

1 mark · MCQ
Report issue

Redundant input in a NAND network

Boolean Algebra & Logic Gates

Question 15, GATE 2005: Circuit: top gate is NAND of X and complemented Y; bottom gate is AND of Y and Z; output f is NAND of those two results. Which variable is redundant? A X; B Y; C Z; D none.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

The upper NAND output is ¬(X¬Y)=¬X+Y; the lower AND output is YZ. The final NAND is ¬[(¬X+Y)YZ]=¬(YZ), because Y(¬X+Y)=Y. Thus X is irrelevant and f depends only on Y, Z, A.

Let top output t=¬(X¬Y), bottom u=YZ, and f=¬(tu). If Y=0, u=0 and f=1 regardless of X, Z. If Y=1, the top output is 1 and f=¬Z. Together these cases give f=¬Y∨¬Z=¬(YZ), independent of X. This also follows algebraically because Y·¬Y=0 cancels the X-dependent product. Thus A.

Original paper, page 2

1 mark · MCQ
Report issue

Twos-complement integer range

Number Systems & Computer Arithmetic

Question 16, GATE 2005: Representable n-bit two’s-complement range? A −2^(n−1) through 2^(n−1)−1; B −(2^(n−1)−1) through 2^(n−1)−1; C −2^(n−1) through 2^(n−1); D −(2^(n−1)+1) through 2^(n−1)−1.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

The most significant bit has weight−2n−1 and the remaining bits sum from 0 to 2n−1−1. Thus the represented range is−2n−1 through 2n−1−1, A.

The most significant bit has weight−2n−1, while lower bits contribute from 0 through 2n−1−1. Setting only the sign bit gives the minimum; setting all lower bits and clearing the sign bit gives the maximum. There are exactly 2n values in the asymmetric interval, including zero once, so A.

Original paper, page 2

1 mark · MCQ
Report issue

Octal to hexadecimal conversion

Number Systems & Computer Arithmetic

Question 17, GATE 2005: Convert octal 657 to hexadecimal: A 1AF; B D78; C D71; D 32F. Clearer GateForum source confirms option A.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Step through it (9 steps)

657 in octal is 6×64+5×8+7=431. Dividing into hexadecimal digits gives 1×256+10×16+15=1AF, A. Equivalently, octal bits 110101111 regroup as 0001 1010 1111.

Convert via place values:6·8²+5·8+7=384+40+7=431. In hexadecimal 431=1·256+10·16+15, giving 1AF. Equivalently octal digit triples 110101111 become 0001 1010 1111. The answer is A, spelling 1AF; the clearer alternate confirms the faint final glyph in that choice.

Original paper, page 2

1 mark · MCQ
Report issue

Matching a sum of minterms

Logic Minimization & Karnaugh Maps

Question 18, GATE 2005: Minimize f(A, B, C, D)=Σ(1, 4, 5, 9, 11, 12). Options: A BC′D′+A′C′D+AB′D; B ABC′+ACD+B′C′D; C ACD′+A′BC′+AC′D′; D A′BD+ACD′+BCD′.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Step through it (13 steps)

BC′D′ covers minterms 4, 12; A′C′D covers 1, 5; AB′D covers 9, 11. Their union is exactly{1, 4, 5, 9, 11, 12}, so A matches the function.

Each product in a valid SOP must cover only required minterms, and all six required minterms must be covered by at least one product. A four-variable Karnaugh map or direct 16-row evaluation makes this test mechanical. For A, BC′D′ covers 4 and 12, A′C′D covers 1 and 5, and AB′D covers 9 and 11. Their union is exactly the required six minterms with no extras. A single added or lost prime would alter these pairs, so the options were cross-checked against the clearer alternate.

Original paper, page 2

1 mark · MCQ
Report issue

Shared interrupt request and grant lines

Input/Output, DMA & Interrupts

Question 19, GATE 2005: A CPU has one interrupt-request and one interrupt-grant line. What is possible? A neither vectored interrupts nor multiple devices; B multiple devices but no vectors; C both; D vectors but only one device.
Question 19, GATE 2005: A CPU has one interrupt-request and one interrupt-grant line. What is possible? A neither vectored interrupts nor multiple devices; B multiple devices but no vectors; C both; D vectors but only one device.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Multiple devices can share an interrupt-request line and arbitrate using a daisy-chained grant or an interrupt controller. The selected device can then place its vector on the data bus. Therefore both multiple devices and vectored interrupts are possible, C; one request wire does not require a single interrupt source.

A request wire signals that some device needs service; it need not encode which one. Arbitration through a controller or daisy-chain grant selects one requester, which can then supply an interrupt vector over another bus. Thus one shared request/grant pair does not limit the system to one device or one fixed service routine. C is possible; actual priority/fairness depends on the arbitration design.

Original paper, page 2

1 mark · MCQ
Report issue

Protecting memory-mapped input output

I/O & Disk Scheduling

Question 20, GATE 2005: With memory-mapped I/O and no separate privileged I/O opcodes, what enforces device-access protection? A OS routines alone; B hardware trap; C system configuration alone; D protection impossible.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Map device registers into protected address ranges/pages and have the processor’s memory-protection hardware trap unauthorized user-mode loads or stores. Thus the immediate enforcement is a hardware trap, B, although the operating system configures the permissions and handles the exception. Ordinary unprivileged load/store opcodes do not bypass address protection.

Memory-mapped device registers occupy addresses just like memory. The OS configures access permissions, but hardware checks each user access and raises a protection exception if forbidden. This immediate trap prevents bypassing the OS merely by issuing a load/store instruction. A software routine alone cannot intercept an unchecked direct memory access, so B names enforcement, while configuration establishes policy.

Original paper, page 3

1 mark · MCQ
Report issue

Purpose of swap space

Virtual Memory & Paging

Question 21, GATE 2005: What is disk swap space for? A temporary HTML; B process data; C filesystem superblock; D device drivers.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Swap space stores process memory contents that have been evicted from RAM and may later be paged back in. Thus saving process data, B, rather than caching HTML pages or storing filesystem superblocks.

A process may have memory pages that cannot all remain in physical RAM. Swap space provides backing storage for evicted process contents, allowing them to be brought back when needed. Thus B. It is distinct from a browser cache, filesystem metadata and the ordinary files holding drivers, even though all may reside on the same physical disk.

Original paper, page 3

1 mark · MCQ
Report issue

Why additional RAM can improve performance

Virtual Memory & Paging

Question 22, GATE 2005: Why does increasing RAM typically help? A more virtual memory; B larger chips are intrinsically faster; C fewer page faults; D fewer segmentation faults.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

More physical memory can retain a larger working set, reducing expensive page faults and disk paging, C. Capacity does not inherently make memory chips faster, nor does it repair illegal accesses that cause segmentation faults. Improvement depends on the workload being memory-constrained.

When working sets exceed physical memory, pages are repeatedly fetched from much slower secondary storage. Additional RAM can hold more of those pages and reduce paging, hence C. It does not automatically enlarge the architecture’s virtual address width, accelerate each DRAM access, or make an illegal address valid. The performance benefit is workload-dependent rather than guaranteed for every program.

Original paper, page 3

1 mark · MCQ
Report issue

Routes for packets in a session

Transport, Congestion Control & Traffic Shaping

Question 23, GATE 2005: Packets in one session may take different routes under: A TCP only; B TCP and UDP; C UDP only; D neither.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Both TCP segments and UDP datagrams are carried by IP, whose routing decisions can vary over time or across paths. TCP’s connection and ordering guarantees do not reserve one network route. Thus packets may take different paths for both, B.

TCP and UDP are transport protocols carried by IP. IP forwarding can change routes between packets, independent of whether the transport maintains a connection. TCP reconstructs ordering and retransmits as needed; those guarantees do not reserve a physical path. UDP likewise imposes no route consistency. Therefore both may traverse different paths, B.

Original paper, page 3

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Address resolution protocol

IP Addressing, Fragmentation & Address Resolution

Question 24, GATE 2005: ARP is used to find: A IP address from DNS; B default gateway IP; C IP corresponding to a MAC; D MAC corresponding to an IP.
Question 24, GATE 2005: ARP is used to find: A IP address from DNS; B default gateway IP; C IP corresponding to a MAC; D MAC corresponding to an IP.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

On an IPv4 local link, ARP resolves a known next-hop IPv4 address to the corresponding link-layer/MAC address, D. It does not perform DNS name resolution or discover the default gateway’s IP configuration.

To send a local-link Ethernet frame, the sender needs a destination MAC address. Given the next-hop IPv4 address, ARP requests who owns it and learns the corresponding MAC, D. Name-to-IP lookup is DNS; determining which gateway to use comes from routing/configuration; reverse resolution is a different function. For a remote destination, the resolved MAC normally belongs to its next-hop router.

Original paper, page 3

1 mark · MCQ
Report issue

Selective-repeat sequence space

Data Link, Framing, Error Control & ARQ

Question 25, GATE 2005: Maximum selective-repeat/reject window with n-bit sequence numbers? A 2^n; B 2^(n−1); C 2^n−1; D 2^(n−2).
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

With n sequence bits there are 2n labels. To prevent a delayed old frame from being confused with a new frame after wraparound, equal sender/receiver windows must occupy at most half the label space. Hence W≤2n−1, B, under the standard selective-repeat model.

There are 2n distinct labels. In selective repeat, receivers may accept out-of-order frames, so old and new receive windows must not overlap after sequence wrap. With equal window sizes W, the standard safety condition is 2W≤2n, hence W≤2n−1. The half-space restriction distinguishes this protocol from the different Go-Back-N bound.

Original paper, page 3

1 mark · MCQ
Report issue

Purpose of a bridge spanning tree

Network Layers & Devices

Question 26, GATE 2005: Why use spanning tree among LAN bridges? A shortest paths; B avoid forwarding loops; C fault tolerance; D minimize collisions.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

A spanning tree leaves a connected forwarding topology without cycles. This prevents frames, especially flooded broadcasts/unknown unicasts, from circulating indefinitely and being duplicated. Thus B; spanning-tree forwarding does not promise pairwise shortest routes.

Flooded frames do not have an IP-style hop limit at the bridging layer. A forwarding cycle can therefore cause copies to circulate and multiply. The spanning-tree protocol disables redundant paths to leave a connected acyclic active topology, preventing that loop. It can reconfigure after faults, but the question’s direct purpose is B; pairwise routes need not be shortest.

Original paper, page 3

1 mark · MCQ
Report issue

Sixty-four subnets of a class B network

IP Addressing, Fragmentation & Address Resolution

Question 27, GATE 2005: A class-B network needs 64 departmental subnets. Mask? A255.255.0.0; B255.255.64.0; C255.255.128.0; D255.255.252.0.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (3 steps)

Starting with a /16 class-B network, borrow 6 bits to obtain 26=64 subnets. The /22 mask is 255.255.252.0, D. This uses all subnet numbers; the obsolete convention excluding all-zero/all-one subnets would require a different count and is not applied.

A class-B prefix starts with 16 network bits. Six additional subnet bits give 64 patterns, leaving 10 host bits. The resulting prefix length 22 has mask 11111111.11111111.11111100.00000000, or 255.255.252.0. This uses all 64 subnet numbers under the modern convention, rather than subtracting two obsolete reserved subnet patterns.

Original paper, page 3

1 mark · MCQ
Report issue

Why B-plus trees suit database indexes

Indexing, Storage & Query Processing

Question 28, GATE 2005: Key reason to prefer B+ trees over binary search trees for database indexes? A many records; B relations sorted on primary key; C always lower memory; D disk transfers occur in blocks.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Disk I/O transfers whole blocks. A high-fanout B+ tree packs many keys/pointers into each block, reducing tree height and therefore block reads relative to an ordinary pointer-based binary search tree. Thus D is the key storage-system reason.

The expensive unit is usually a disk block read. A B+ node can contain many separators and pointers in one block, providing much higher branching factor than a binary node. Higher branching factor reduces the number of blocks on a root-to-leaf search. Thus D identifies the storage-aware reason, not a universal claim that B+ trees use fewer bytes or require the underlying relation to be sorted.

Original paper, page 3

1 mark · MCQ
Report issue

Normalization guarantees

Normalization & Decomposition

Question 29, GATE 2005: Which normal-form statement is false? A BCNF stricter than 3NF; B lossless dependency-preserving 3NF decomposition always possible; C lossless dependency-preserving BCNF decomposition always possible; D any two-attribute relation is BCNF. Preserve the empty-determinant qualification for D.
Question 29, GATE 2005: Which normal-form statement is false? A BCNF stricter than 3NF; B lossless dependency-preserving 3NF decomposition always possible; C lossless dependency-preserving BCNF decomposition always possible; D any two-attribute relation is BCNF. Preserve the empty-determinant qualification for D.
Tap to enlarge
Your answer
Answer & solution

Answer: C under the usual nonempty-determinant convention (no official key was published)

A lossless dependency-preserving 3NF decomposition always exists, whereas achieving BCNF can sacrifice dependency preservation. For example R(A, B, C) with AB→C and C→B has a BCNF violation C→B; decomposition into CB and AC loses the ability to enforce AB→C locally. Thus C is false. The separate assertion that every two-attribute schema is BCNF assumes no nontrivial empty-determinant dependencies: with ∅→A but A not determining B, R(A, B) is a counterexample to that assertion. Under literal unrestricted FDs both C and D can fail; the conventional answer excludes constant-column FDs.

A3NF synthesis can preserve every dependency and be lossless, whereas BCNF decomposition can force some dependencies to require a join for checking. For AB→C, C→B, splitting off CB removes the BCNF violation but leaves AB→C unenforceable within either component alone. Hence C is the conventional false assertion. Constant-column dependencies∅→A supply the explicitly retained counterexample to D under unrestricted definitions; the source’s unique-choice answer requires excluding that case.

Original paper, page 3

1 mark · MCQ
Report issue

Lossy projection and natural join

Normalization & Decomposition

Question 30, GATE 2005: For instance r(A, B, C, D), project r1=π_ABC(r), r2=π_AD(r) and rejoin s=r1⋈r2. The decomposition is lossy. Which is true? A s⊂r; B r∪s=r; C r⊂s; D r⋈s=s.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Each original tuple contributes matching projections to r1 and r2, so r⊆r1⋈r2=s. A lossy decomposition creates spurious joined tuples; for the stated lossy instance the containment is strict, r⊂s, C. A natural join here does not discard any original tuple.

Projection cannot lose an original tuple when its two projections are rejoined: they still agree on their shared A value. The join may combine components from different original tuples, adding spurious tuples. A lossy instance therefore gives strict inclusion r⊂s. Since r and s have identical schemas, their natural join is their intersection, namely r, not s. Thus only C states the proper direction.

Original paper, page 4

2 marks · MCQ
Report issue

Recursive digit printing with value parameters

Recursion

Question 31, GATE 2005: void foo(int n, int sum){int k=0, j=0;if(n==0)return;k=n%10;j=n/10;sum=sum+k;foo(j, sum);printf("%d,", k);} main sets a=2048, sum=0; calls foo(a, sum); prints sum with newline. Output? A8, 4, 0, 2, 14; B8, 4, 0, 2, 0; C2, 0, 4, 8, 14; D2, 0, 4, 8, 0.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (13 steps)

Calls peel off digits 8, 4, 0, 2, but each prints only after its recursive child returns. Thus the visible digits are 2, 0, 4, 8. The sum parameter is passed by value, so main’s sum stays 0. Assuming the usual stdio declaration, the output is 2, 0, 4, 8, 0 followed by a newline, option D; the commas come from the inner printf format.

Each call stores its own last digit k before recursively processing the remaining prefix. Because printing occurs after the child returns, digits appear from most significant to least:2, 0, 4, 8. The sum variable is a by-value local parameter, so changes do not propagate back into main’s sum. Main consequently appends 0, giving D. This question combines recursive output order with parameter passing, not a digit-sum algorithm that returns its result.

Original paper, page 4

2 marks · MCQ
Report issue

Removing a function prototype

Structures & Declarations

Question 32, GATE 2005: Program declares double foo(double) before main. main declares double da, db, obtains da through omitted input code, and assigns db=foo(da). Later definition double foo(double a){return a;}. If the initial declaration is removed, choose A no diagnostic; B harmless warnings; C type-mismatch warnings with unintended results; D compile errors. Distinguish standard-required diagnostic from implementation severity.
Question 32, GATE 2005: Program declares double foo(double) before main. main declares double da, db, obtains da through omitted input code, and assigns db=foo(da). Later definition double foo(double a){return a;}. If the initial declaration is removed, choose A no diagnostic; B harmless warnings; C type-mismatch warnings with unintended results; D compile errors. Distinguish standard-required diagnostic from implementation severity.
Tap to enlarge
Your answer
Answer & solution

Answer: D in ordinary C compilation (no official key was published)

Without the declaration, foo is called before its type is known. Modern C requires a declaration; historical implicit-int rules would assume an int-returning function, which conflicts with the later double-returning definition. A diagnostic is therefore required, and conventional compilers reject the conflicting types, D. C specifies required diagnostics rather than an absolute distinction between a warning and a fatal error, so exact compiler behavior depends on mode/extensions. The commented input of da is understood as omitted input code, as the prompt intends.

The early declaration tells the compiler that the call returns double. Removing it means a modern C compiler encounters an undeclared function call; older implicit-int conventions instead assume int, which conflicts with the later double definition. A diagnostic is required, and ordinary compiler modes reject the conflicting types, making D the conventional choice. The standard does not mandate the user-interface label warning versus error, so that distinction remains qualified.

Original paper, page 4

2 marks · MCQ
Report issue

Inorder traversal of a binary search tree

Binary Search & Balanced Trees

Question 33, GATE 2005: BST postorder is 10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29. Candidate inorder A9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95; B9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29; C29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95; D95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Inorder traversal of a BST with distinct keys lists them in increasing order. Sorting the displayed key set gives 9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95, option A. No full reconstruction from postorder is necessary.

For distinct keys in a BST, inorder visits every smaller key before the root and every larger key afterward, recursively producing the sorted key list. Sorting the supplied set gives A. There is no need to reconstruct the full shape from postorder unless the task asks for structure; postorder here merely specifies which keys are present.

Original paper, page 4

2 marks · MCQ
Report issue

Inserting into a max heap

Heaps & Priority Queues

Question 34, GATE 2005: Max-heap level order 10, 8, 5, 3, 2 receives 1 then 7. New level order? A10, 8, 7, 5, 3, 2, 1; B10, 8, 7, 2, 3, 1, 5; C10, 8, 7, 1, 2, 3, 5; D10, 8, 7, 3, 2, 1, 5.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (5 steps)

Append 1 as the sixth element; its parent 5 is larger, so no swap occurs. Append 7 as the seventh element; swap it with parent 5, but stop below root 10. The resulting level order is 10, 8, 7, 3, 2, 1, 5, D.

Appending 1 puts it under parent 5 and requires no upward swap. Appending 7 puts it as the other child of 5;7 exceeds 5, so swap them. Its new parent is 10, which is larger, ending the repair. Other nodes remain where they were, yielding 10, 8, 7, 3, 2, 1, 5. A heap is not a sorted array; sorting the level order would unnecessarily rearrange nodes.

Original paper, page 4

2 marks · MCQ
Report issue

Binary search trees on four keys

Binary Search & Balanced Trees

Question 35, GATE 2005: How many BSTs can be formed from four distinct keys? A5; B14; C24; D42.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

For distinct ordered keys, the number of BST shapes is the Catalan number C4. With C0=1, C1=1, C2=2, C3=5, the root split gives C4=1×5+1×2+2×1+5×1=14, B.

Choose each possible root rank and multiply the independent choices for left and right subtrees. Catalan recurrence C_n=Σ C_i C_(n−1−i), with C0=1, gives C1=1, C2=2, C3=5 and C4=5+2+2+5=14. This counts BST shapes with the sorted keys forced into inorder order, not arbitrary permutations of labels, so 4!=24 is not the answer.

Original paper, page 4

2 marks · MCQ
Report issue

Leaves in a full k-ary tree

Tree Properties & Traversals

Question 36, GATE 2005: A finite full k-ary tree has n internal nodes, each with exactly k children. Number of leaves? A nk; B(n−1)k+1; C n(k−1)+1; D n(k−1).
Question 36, GATE 2005: A finite full k-ary tree has n internal nodes, each with exactly k children. Number of leaves? A nk; B(n−1)k+1; C n(k−1)+1; D n(k−1).
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

If there are n internal nodes and L leaves, the number of parent-child edges is kn. Any finite tree also has n+L−1 edges. Equating gives L=n(k−1)+1, C. The premise is that every internal node has exactly k children, not merely at most k.

Count the same edges in two ways. Every internal node contributes k outgoing parent-child edges, for kn. Any tree on n+L total nodes has n+L−1 edges. Equating and solving yields L=kn−n+1=n(k−1)+1. This method does not require every leaf to have the same depth; the exact-k-child premise is what matters.

Original paper, page 4

2 marks · MCQ
Report issue

False bound for a divide-and-conquer recurrence

Asymptotic Analysis & Recurrences

Question 37, GATE 2005: T(n)=2T(n/2)+n, with T(0)=T(1)=1. Which claim is false? A O(n²); B Θ(n log n); C Ω(n²); D O(n log n).
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

For n=2k, dividing by n gives T(n)/n=T(n/2)/(n/2)+1, so T(n)=n(1+log2 n). Standard rounding of subproblem sizes preserves Θ(n log n). Therefore O(n²), Θ(n log n), and O(n log n) hold, but Ω(n²) does not, C, since(n log n)/n²→0.

For powers of two, each recursion level contributes n and there are log₂n nontrivial levels plus linear total base cost. Thus T(n)=n(1+log₂n), giving Θ(n log n). This is bounded above by n² but not below by a positive constant times n², since log n/n tends to zero. Hence the false bound is C. A loose upper bound can still be true even when it is not tight.

Original paper, page 5

2 marks · MCQ
Report issue

Dijkstra with a binary heap

Graph Algorithms

Question 38, GATE 2005: Dijkstra on positive-weight undirected G(V, E), using adjacency lists and a binary heap, has standard bound: A O(V²); B O(E+V log V); C O(V log V); D O((E+V)log V).
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Using adjacency lists, up to V extract-min operations and O(E) decrease-key operations each cost O(log V) with a binary heap. Including initialization gives O((E+V)log V), D. The O(E+V log V) bound requires different amortized heap operations, such as a Fibonacci heap, not a standard binary heap.

Dijkstra extracts each vertex once and may relax each edge. A binary heap takes logarithmic time for extract-min and decrease-key, producing V log V plus E log V. The sum is O((V+E)log V). The tempting E+V log V bound uses an amortized heap with cheaper decrease-key, not the specified ordinary binary heap. Positive weights ensure the settled-distance greedy step is valid.

Original paper, page 5

2 marks · MCQ
Report issue

Merging logarithmically many sorted lists

Searching, Sorting & Selection

Question 39, GATE 2005: Merge roughly log n sorted lists, each containing roughly n/log n elements, using a heap. Options include A O(n log log n), B Θ(n log n), C Ω(n log n), D Ω(n^(3/2)). Find the intended efficient merge bound.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Keep the smallest remaining item from each of k=Θ(log n) lists in a min-heap. Repeatedly extract the minimum and replace it by the next item from the same list. There are Θ(n) items, each costing O(log k)=O(log log n), so the merge costs O(n log log n), A. The comparison lower bound for arbitrary interleavings of equally sized lists is Ω(n log k), so this is also the worst-case asymptotic order.

The heap needs one current head per list, only Θ(log n) elements. Removing the smallest head and inserting its successor costs O(log log n), not O(log n), because heap height depends on list count. Repeating for Θ(n) output elements gives O(n log log n). The lists are already internally sorted, so sorting their whole union from scratch would waste that available order.

Original paper, page 5

2 marks · MCQ
Report issue

Implication between two propositional formulas

Propositional & Predicate Logic

Question 40, GATE 2005: Let X=((P∨Q)→R), Y=((P→R)∨(Q→R)). Which is a tautology? A X↔Y; B X→Y; C Y→X; D ¬Y→X.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Let U=P→R and V=Q→R. Then X=(P∨Q)→R equals U∧V, while Y=U∨V. Therefore X→Y is a tautology, B. Taking P=true, Q=false, R=false makes X=false, Y=true, disproving equivalence and Y→X. Taking P=Q=true, R=false makes both false and disproves ¬Y→X.

Distribute implication over the disjunctive antecedent: X=(¬P∨R)∧(¬Q∨R). Y is the OR of those same two factors. If both factors hold, at least one holds, proving X→Y. Conversely one factor may be true while the other false, so Y→X and equivalence fail. A counterexample with P=Q=true, R=false makes Y false and X false, refuting ¬Y→X.

Original paper, page 5

2 marks · MCQ
Report issue

Quantifier order for teachers and students

Propositional & Predicate Logic

Question 41, GATE 2005: Formalize “Every teacher is liked by some student.” A ∀x(teacher(x)→∃y(student(y)→likes(y, x))); B ∀x(teacher(x)→∃y(student(y)∧likes(y, x))); C ∃y∀x(teacher(x)→(student(y)∧likes(y, x))); D ∀x(teacher(x)∧∃y(student(y)→likes(y, x))).
Question 41, GATE 2005: Formalize “Every teacher is liked by some student.” A ∀x(teacher(x)→∃y(student(y)→likes(y, x))); B ∀x(teacher(x)→∃y(student(y)∧likes(y, x))); C ∃y∀x(teacher(x)→(student(y)∧likes(y, x))); D ∀x(teacher(x)∧∃y(student(y)→likes(y, x))).
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

For each individual x, if x is a teacher, there must exist a y such that y is a student AND likes x: ∀x(teacher(x) → ∃y(student(y) ∧ likes(y, x))). The student may depend on the teacher. Option B has exactly this form; implication within the existential would admit a non-student witness.

The universal quantifier ranges over possible teachers. Conditional on teacher(x), require a witness y satisfying both student(y) and likes(y, x), which is B. A’s inner implication could be satisfied by a non-student who likes nobody. C demands one common student for every teacher, stronger than the original. D asserts every domain object is a teacher instead of restricting the obligation to teachers.

Original paper, page 5

2 marks · MCQ
Report issue

Intersection of equivalence relations

Sets, Relations & Functions

Question 42, GATE 2005: R, S are equivalence relations on nonempty A. Which is guaranteed? A both union/intersection equivalent; B union; C intersection; D neither.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

R∩S is reflexive and symmetric because both relations are; if x(R∩S)y and y(R∩S)z, both transitivity rules give x(R∩S)z. Union need not be transitive: partitions {1, 2}|{3} and {1}|{2, 3} yield 1 related to 2 and 2 to 3 in the union but not 1 to 3. Thus only intersection is guaranteed, C.

Intersection preserves each defining property because a related pair must belong to both relations. Reflexivity and symmetry pass through immediately; chaining two intersection pairs permits transitivity in both R and S, hence in their intersection. Union can chain one edge from R and another from S without containing the resulting third edge. The three-element partition counterexample above shows why B/A are not guaranteed.

Original paper, page 5

2 marks · MCQ
Report issue

Surjectivity of a composition

Sets, Relations & Functions

Question 43, GATE 2005: Functions f:B→C, g:A→B have onto composite f∘g. Choose A both must be onto; B f must but g need not; C g must but f need not; D neither must.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Since f(g(A))=C and g(A)⊆B, f(B)=C, so f is onto. But g need not cover all of B: take A={a}, B={b1, b2}, C={c}, g(a)=b1 and f(b1)=f(b2)=c. Hence B.

For every c in C, surjectivity of the composite provides an a with f(g(a))=c. Since g(a) is some element of B, this proves f is onto C. It does not require reaching all elements of B; unused B-elements may map to already-covered outputs. The one-element A and two-element B counterexample above proves g need not be onto, selecting B.

Original paper, page 5

2 marks · MCQ
Report issue

Pigeonhole principle on residue pairs

Combinatorics & Counting

Question 44, GATE 2005: Minimum ordered pairs of nonnegative “numbers” guaranteeing two(a, b),(c, d) with a≡c mod 3 and b≡d mod 5? A4; B6; C16; D24. Explain necessary integer-domain convention.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Under the intended nonnegative-INTEGER interpretation, (a mod 3, b mod 5) has 3×5=15 classes. Sixteen pairs force a repeated class, while the fifteen representatives (i, j), 0≤i<3 and 0≤j<5, do not. Thus 16 (C). The paper say numbers rather than integers; arbitrary real numbers do not give fifteen residue classes, so the integer domain assumption is necessary.

Integer residues split the first coordinate into 3 classes and the second into 5, yielding 15 joint classes. Choosing 16 pairs forces a repeated class by pigeonhole; taking one representative from each class shows 15 is insufficient. This establishes exact minimality, not merely a sufficient bound. For arbitrary real numbers, residues are not limited to those 15 possibilities, so the source’s loose word “numbers” must be interpreted as integers.

Original paper, page 5

2 marks · MCQ
Report issue

Reduction direction and undecidability

Decidability & Computability

Question 45, GATE 2005: P1 is decidable, P2 undecidable. Which is true? A P3 decidable if P1 reduces to P3; B P3 undecidable if P3 reduces to P2; C P3 undecidable if P2 reduces to P3; D P3 decidable if P3 reduces to its complement.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

If undecidable P2 reduces effectively to P3, a decider for P3 would decide P2 by applying the reduction first. Therefore P3 is undecidable (C). Reducing a decidable problem to P3 says nothing about P3; reducing P3 to an undecidable target also gives no such conclusion.

A reduction converts an instance of its source problem into a target instance while preserving the yes/no answer. If undecidable P2 reduces to P3 and P3 had a decider, their composition would decide P2, a contradiction. Thus C. Reduction direction matters: mapping an easy problem into a hard one does not make the easy problem hard, nor does it make the target easy.

Original paper, page 5

2 marks · MCQ
Report issue

Group of invertible triangular matrices

Algebraic Structures

Question 46, GATE 2005: H consists of all real upper-triangular matrices [[a, f, e],[0, b, d],[0, 0, c]] with abc≠0. Under matrix multiplication is H: A a group; B a monoid but not a group; C a semigroup but not a monoid; D none of these?
Question 46, GATE 2005: H consists of all real upper-triangular matrices [[a, f, e],[0, b, d],[0, 0, c]] with abc≠0. Under matrix multiplication is H: A a group; B a monoid but not a group; C a semigroup but not a monoid; D none of these?
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

These are all invertible upper-triangular real 3×3 matrices, since determinant abc≠0. Products remain upper triangular with nonzero diagonal, multiplication is associative, the identity belongs to H, and the inverse of each invertible upper-triangular matrix is upper triangular with diagonal 1/a, 1/b, 1/c. Hence H is a group (A). Matrix continues on physical page 6.

Verify all group axioms rather than just invertibility. Multiplication of upper-triangular matrices is upper triangular, and its diagonal is the pairwise product of the two diagonals, hence nonzero. Associativity comes from ordinary matrix multiplication. The identity matrix satisfies the constraints. Back substitution constructs an upper-triangular inverse with reciprocal diagonal entries. Thus closure, associativity, identity and inverses all hold. Commutativity is not required for a group.

Original paper, page 5

2 marks · MCQ
Report issue

Recognizing a nonplanar graph

Graph Theory

Question 47, GATE 2005: Choose the nonplanar graph among four drawings. G1 is a six-cycle with all three opposite-vertex chords. G2 is a triangular prism (GFG additionally draws a diagonal in each of two distinct rectangular faces). G3 is K4 with an extra vertex joined to the endpoints of one edge. G4 is K5 with one edge removed. A G1; B G2; C G3; D G4. These adjacency descriptions replace drawing layout, not graph structure.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Label G1 cyclically around its six outer vertices. Its hexagon plus the three opposite-vertex chords is K3, 3, with bipartition the alternating vertices; it is nonplanar. The paper adds two diagonals across two distinct rectangular faces of that prism; those edges can each be embedded within its face, so it remains planar. G3 is K4 with a fifth vertex joined to endpoints of one edge; it is planar. G4 is K5 minus the edge between the two upper side vertices; it is planar (a triangular bipyramid). Thus G1, A, in the paper despite the G2 drawing difference.

Planarity is invariant under redrawing. The alternating vertices of G1 form two sets of three, and each vertex meets all three vertices across the partition, giving exactly K3, 3. Its bipartite planar bound m≤2v−4 would require 9≤8, impossible. For each remaining graph the indicated construction gives a planar embedding: prism faces accommodate the added diagonals separately; an extra vertex can be placed next to an edge of a planar K4 embedding; K5 minus one edge is a triangular bipyramid. Therefore only G1 fails.

Original paper, page 6

2 marks · MCQ
Report issue

Nonsingularity of a three-variable system

Linear Algebra

Question 48, GATE 2005: Determine the solution count of 2x1−x2−3x3=1, 3x1+2x2+5x3=2, −x1+4x2+x3=3: A no solution; B unique; C more than one but finitely many; D infinitely many. The alternate reproduction changes the first −3x3 to +3x3.
Question 48, GATE 2005: Determine the solution count of 2x1−x2−3x3=1, 3x1+2x2+5x3=2, −x1+4x2+x3=3: A no solution; B unique; C more than one but finitely many; D infinitely many. The alternate reproduction changes the first −3x3 to +3x3.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

The paper prints the first equation as 2x1−x2−3x3=1; the other rows are (3, 2, 5) and (−1, 4, 1). Its coefficient determinant is −70, so the solution is unique (B), specifically (37/70, 67/70,−3/10).

For a square linear system, a nonzero determinant means the coefficient map is invertible, so every right-hand side has exactly one preimage. Expanding the the paper determinant gives 2(2−20)+1(3+5)−3(12+2)=−70. This proves uniqueness without needing the actual solution. Substituting the stated triple checks the arithmetic. Replacing −3 by +3 changes the determinant to 14, still nonzero, so the alternative source gives the same choice but different numeric coordinates.

Original paper, page 6

2 marks · MCQ
Report issue

Eigenvalues from a quadratic characteristic polynomial

Linear Algebra

Question 49, GATE 2005: Find the eigenvalues of [[2,−1],[−4, 5]]. A −1, 1; B 1, 6; C 2, 5; D 4,−1.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

det(λI−A)=(λ−2)(λ−5)−4=λ²−7λ+6=(λ−1)(λ−6). The eigenvalues are 1 and 6, option B.

An eigenvalue λ makes A−λI singular. The characteristic polynomial is (2−λ)(5−λ)−4, since the off-diagonal product is positive 4. Expanding yields λ²−7λ+6=(λ−1)(λ−6). The sum 7 equals the trace and product 6 equals the determinant, providing two quick independent checks. Reading the diagonal 2, 5 as eigenvalues would only be valid for triangular matrices, not this matrix.

Original paper, page 6

2 marks · MCQ
Report issue

Coefficients of a squared geometric series

Recurrences & Generating Functions

Question 50, GATE 2005: The ordinary generating function of g(i), i≥0, is 1/(1−x)². Find g(i). GateForum options: A i; B i+1; C 2i; D 2^i. GFG inserts a constant-1 line before these and labels the five entries A 1; B i; C i+1; D 2i; E 2^i. Explain the coefficient rather than relying on a universal letter.
Tap to enlarge
Your answer
Answer & solution

Answer: C: i+1 (no official key was published)

Differentiate ∑(j≥0)xj=1/(1−x) for |x|<1: 1/(1−x)²=∑(j≥1)j xj−1=∑(i≥0)(i+1)xi. Thus g(i)=i+1. Preserve the mathematical answer, not a purported universal letter.

The geometric-series identity is valid as a formal power series, so differentiate coefficient by coefficient. The derivative of xj is jxj−1, and relabeling i=j−1 gives coefficient i+1. Alternatively multiplying two copies of Σxj shows that xi can be formed in i+1 ways, from pairs(0, i),(1, i−1),…,(i, 0). Both arguments yield the same coefficient and avoid the inconsistent option lettering.

Original paper, page 6

2 marks · MCQ
Report issue

Bayesian selection of an urn

Probability & Random Variables

Question 51, GATE 2005: Bag P has two red and three blue balls; bag Q has three red and one blue. Select P with probability 1/3 and Q with probability 2/3, then draw uniformly from that bag. Given a red ball, probability bag P was selected? A4/19; B5/19; C2/9; D19/30. The alternate omits the color of Q’s three balls; use the explicit GFG wording.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Using the the paper statement that Q has 3 RED and 1 blue ball, P(P∩red)=(1/3)(2/5)=2/15 and P(Q∩red)=(2/3)(3/4)=1/2. Bayes gives (2/15)/(2/15+1/2)=4/19, A.

Bayes reverses the conditioning: the question asks P(P|red), not P(red|P). First weight each red probability by how often that bag is selected. P contributes 2/15 and Q contributes 1/2, so total red probability is 19/30. Divide 2/15 by 19/30 to get 4/19. The larger posterior weight of Q is consistent with its being chosen more often and containing a larger red fraction.

Original paper, page 6

2 marks · MCQ
Report issue

Probability that random strings differ

Probability & Random Variables

Question 52, GATE 2005: Construct each of two n-bit binary strings using fair coin tosses. Assuming independent tosses for both strings, probability the strings differ? A2^(−n); B1−1/n; C1/n!; D1−2^(−n).
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Assuming the two constructions use independent fair tosses, each bit of the second string matches the corresponding first bit with probability 1/2. The full strings match with probability 2−n, so they differ with probability 1−2−n, option D.

Condition on any fixed first string. Each independent second-string bit matches with probability 1/2, and all n positions match with probability(1/2)n. The event “different strings” means at least one mismatch, the complement of matching in every position, not mismatching in every position. Therefore the requested probability is 1−2−n. Correlation between the two constructions would invalidate this calculation, hence independence is explicit.

Original paper, page 6

2 marks · MCQ
Report issue

Language of a DFA

Finite Automata

Question 53, GATE 2005: A deterministic machine over {a, b} starts at nonfinal q0. It has q0−b→q0, q0−a→q1, q1−b→q2, q2−b→q3, with final q3, q3−b→q3 and q3−a→q1; omitted transitions reject. Identify its language. Offered B describes every a being followed by at least two b symbols. Determine whether that wording is exact, including empty and b-only strings. Other choices: A every a followed by exactly two b symbols; C strings containing abb; D strings not containing aa.
Question 53, GATE 2005: A deterministic machine over {a, b} starts at nonfinal q0. It has q0−b→q0, q0−a→q1, q1−b→q2, q2−b→q3, with final q3, q3−b→q3 and q3−a→q1; omitted transitions reject. Identify its language. Offered B describes every a being followed by at least two b symbols. Determine whether that wording is exact, including empty and b-only strings. Other choices: A every a followed by exactly two b symbols; C strings containing abb; D strings not containing aa.
Tap to enlarge
Your answer
Answer & solution

Answer: No exact option; B if at least one a is required (no official key was published)

The start state has a b-loop but is not accepting. An a starts a required pair of b transitions, after which the accepting state permits more b symbols or another a followed by at least two b symbols. Hence the exact language is b*(abb b*)+ = b*(ab{2,})+. All words have at least one a, and every a is followed by at least two consecutive b symbols. Option B omits the at-least-one-a condition and therefore includes ε and every b-only word by vacuous truth, all rejected by the depicted machine. The paper shows the nonaccepting start state. B describes the intended restriction only if the domain excludes b*; there is no literally exact offered answer. Diagram and options continue on page 7.

Trace complete trips from the start to the final state. Initial b symbols can be arbitrary, but they never reach a final state. The first a must be followed by two b transitions to enter q3; additional b symbols may follow, and each later a begins another mandatory two-b segment. Thus at least one ab{2,} block is required. Checking ε or b provides immediate counterexamples to the broad offered description: its universal condition is vacuously true while the machine rejects. Do not silently mark the intended option as an exact language equality.

Original paper, page 6

2 marks · MCQ
Report issue

Determinism in finite and pushdown automata

Pushdown Automata

Question 54, GATE 2005: Let Df, Nf, Dp, Np denote languages accepted by deterministic finite, nondeterministic finite, deterministic pushdown and nondeterministic pushdown automata. Determine the equality/proper-inclusion relationships. The intended option D is Df=Nf and Dp properly contained in Np. Other options: A both inclusions proper; B Df proper subset Nf and Dp=Np; C both pairs equal.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Subset construction converts any NFA into a DFA, so Df=Nf. A DPDA is a restricted NPDA, and the inclusion Dp⊊Np is strict, for example unmarked even palindromes require nondeterministic midpoint choice. Thus D. The printed subset symbol is interpreted as proper inclusion.

For finite automata, a DFA state can represent the full subset of possible NFA states after each prefix, so nondeterminism does not increase language expressive power. For pushdown automata, deterministic computation cannot generally guess an unmarked midpoint while preserving the necessary stack comparison. Every deterministic machine is a special nondeterministic one, but some CFLs such as unmarked even palindromes are not deterministic CFLs. Hence the first pair is equal and the second inclusion is strict.

Original paper, page 7

2 marks · MCQ
Report issue

Intersection of two context-free languages

Closure Properties & Language Hierarchy

Question 55, GATE 2005: L1={a^n b^n c^m:n, m>0}, L2={a^n b^m c^m:n, m>0}. Identify the false claim among: A their intersection is context-free; B their union is context-free; C both individual languages are context-free; D their intersection is context-sensitive.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

L1={an bn cm:n, m>0} and L2={an bm cm:n, m>0} each need only one stack comparison, hence are CFLs. CFLs are closed under union. Their intersection is {ak bk ck:k>0}, which is not context-free (standard CFL pumping argument) but is context-sensitive by linear-space counting. The false assertion is A.

Each individual language compares only two adjacent block counts and allows the remaining block freely, which a PDA can handle. Closure under union proves the union claim. In the intersection, the first language forces #a=#b and the second forces #b=#c, hence all three counts coincide. The standard pumping argument prevents a single stack from enforcing these three blocks: a short pumped region cannot cover all three, so pumping changes only one or two counts or disrupts the block order. Linear-space checking still recognizes the intersection, establishing context sensitivity.

Original paper, page 7

2 marks · MCQ
Report issue

Complements of recursive and enumerable languages

Closure Properties & Language Hierarchy

Question 56, GATE 2005: L1 is recursive; L2 is recursively enumerable but not recursive. Which is true of their complements? A complement L1 recursive and complement L2 RE; B complement L1 recursive and complement L2 not RE; C both complements RE; D complement L1 RE and complement L2 recursive.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

A recursive language has a halting decider, whose accept/reject outputs can be swapped to decide its complement. If both L2 and its complement were recursively enumerable, dovetailing their recognizers would decide L2, contradicting its nonrecursive premise. Thus complement(L1) is recursive and complement(L2) is not recursively enumerable, B.

A decider always halts, so swapping its accept/reject outcomes gives a complement decider. A recognizer need not halt on nonmembers, so that swap does not work for an arbitrary RE language. If both L2 and its complement had recognizers, run them in alternating steps on any input. Exactly one must eventually accept, deciding which side the input belongs to. That would contradict the given nonrecursive status. Thus B, with the nonhalting possibility explaining the distinction.

Original paper, page 7

2 marks · MCQ
Report issue

Marked palindromes versus copying

Pushdown Automata

Question 57, GATE 2005: For binary w, L1={wwᴿ}, L2={w#wᴿ} with special delimiter#, L3={ww}. Which is true? A L1 deterministic CFL; B L2 deterministic CFL; C L3 CFL but not deterministic; D L3 deterministic CFL.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

For L2={w#wR}, a DPDA pushes before # and then deterministically pops and compares after #; it accepts exactly upon a complete match. L1={wwR} has no delimiter and is context-free but not deterministic context-free. L3={ww} is not context-free. Therefore B.

For the delimited language, # tells the PDA exactly when to switch from pushing to comparing/popping. Every decision is determined by current input and stack top, so the recognizer is deterministic. Without the delimiter, a palindrome PDA must in general choose the midpoint nondeterministically. The duplicated-word language requires preserving the same order twice, not the reverse stack order, and is not CFL. These distinctions are about whole language classes, not whether some individual examples can be recognized.

Original paper, page 7

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Fixed-size independent-set decision problems

Computational Complexity

Question 58, GATE 2005: Two undirected-graph decision problems: α asks for an independent set of size |V|−4; β asks for an independent set of size 5. A α in P, β NP-complete; B α NP-complete, β in P; C both NP-complete; D both in P. The source says independent set, not clique, for β.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

For α, an independent set of |V|−4 vertices exists exactly when some four-vertex complement covers all edges (handle |V|<4 separately). Enumerate O(n4) complements and check the remaining edges. For β, enumerate O(n5) five-vertex subsets and test that all ten vertex pairs are nonedges. Both are polynomial-time because 4 and 5 are constants, so D.

An independent set leaves no edge with both endpoints inside it. For α, enumerate every possible four-vertex excluded set and test the remaining induced graph for an edge; O(n⁴(n+m)) is polynomial. For β, enumerate every five-vertex set and test its ten pairs for the absence of edges; O(n⁵) suffices with adjacency lookup. Unlike the NP-complete general independent-set problem, the relevant size or complement size here is a fixed constant, not part of the input. Hence both are in P.

Original paper, page 7

2 marks · MCQ
Report issue

Handles in an expression reduction

Parsing & Syntax Analysis

Question 59, GATE 2005: Grammar E→E+n | E×n | n generates n+n×n. List the handles in bottom-up reduction order. A n, E+n, E+n×n; B n, E+n, E+E×n; C n, n+n, n+n×n; D n, E+n, E×n.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (10 steps)

The rightmost derivation is E ⇒ E×n ⇒ E+n×n ⇒ n+n×n. Reversing it reduces the leftmost n first, then E+n, then E×n. These handles are n, E+n, E×n, option D. The fixed terminal n on the right of each operator means this is not the usual ambiguous E→E+E|E×E grammar.

A handle is the RHS whose reduction undoes one step of a rightmost derivation, not an arbitrary matching substring. Reverse the displayed derivation: n+n×n→E+n×n→E×n→E. The successive reduced RHS strings are n, E+n and E×n. Reducing the rightmost terminal n first would not reverse this rightmost derivation. The grammar’s fixed terminal right operands force the association, unlike E→E+E.

Original paper, page 7

2 marks · MCQ
Report issue

SLR canonical LR and LALR state counts

Parsing & Syntax Analysis

Question 60, GATE 2005: For S→(S)|a, let n1, n2, n3 count SLR(1), canonical LR(1), LALR(1) states. In GFG: A n1<n2<n3; B n1=n3<n2; C n1=n2=n3; D n1=n3=n2 (duplicated equality as reproduced). Determine the actual counts independently; alternate distractor ordering differs.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

For augmented S′→S and S→(S)|a, LR(0) has six states with kernels S′→·S, S′→S·, S→(·S), S→a·, S→(S·), and S→(S)· (including closures). Canonical LR(1) separates the inner/non-inner versions with lookaheads ) and $, yielding ten states. Merging identical LR(0) cores gives six LALR states again. Therefore n1=n3<n2, B.

SLR states are LR(0) item-set states, so its FOLLOW-based action construction does not add states. The six cores are listed in the baseline derivation. Canonical LR(1) retains context: an expression enclosed by parentheses must expect a closing parenthesis, whereas the outer expression expects end-of-input, creating extra versions of cores and ten states. LALR merges versions sharing the same LR(0) core, restoring six. Therefore 6=6<10 in the order n1, n3, n2.

Original paper, page 7

2 marks · MCQ
Report issue

Misspelled keyword that is a legal identifier

Functions & Parameter Passing

Question 61, GATE 2005: Line 3 of historical C code is fro(I=0, I<N, I++); inside int main(){int I, N; ...}. During object-module creation is the response A no compilation error; B lexical error only; C syntactic error only; D both? Preserve the printed identifier fro and comma-separated expressions, not a repaired for loop.
Question 61, GATE 2005: Line 3 of historical C code is fro(I=0, I<N, I++); inside int main(){int I, N; ...}. During object-module creation is the response A no compilation error; B lexical error only; C syntactic error only; D both? Preserve the printed identifier fro and comma-separated expressions, not a repaired for loop.
Tap to enlarge
Your answer
Answer & solution

Answer: A under C90; modern C needs a diagnostic (no official key was published)

The printed line is fro(I=0, I<N, I++); with commas, not semicolons. Lexically fro is a valid identifier, and syntactically this is a function call with three arguments, not a for statement. Under the historical C90 implicit-function-declaration rule, an object module can be produced, so A is the intended compilation-stage answer; a missing definition may fail at link time. In C99 and later the undeclared function requires a diagnostic, but this is not a lexical or grammar error of the kind offered. The argument side effects also give undefined runtime behavior under C90 because I is modified more than once without an intervening sequence point; no runtime result is asserted. The paper preserve fro and commas.

The lexer accepts fro as an ordinary identifier. The grammar accepts the following parentheses as a function call whose three arguments are I=0, I<N, I++. Thus misspelling for does not by itself create a lexical or grammar error. Older C allowed an implicit function declaration; an undefined fro may be discovered later by the linker. Modern C requires a diagnostic for the undeclared function, and runtime side effects are separately problematic. The intended old compilation-stage answer must not be presented as portable modern C.

Original paper, page 7

2 marks · MCQ
Report issue

Clocked load-or-toggle circuit

Flip-Flops, Registers & Sequential Circuits

Question 62, GATE 2005: Positive-edge D flip-flop has D=A·X+Q′·X′ and output Y=Q. Before successive rising edges X=1, 1, 0, 1, 1; A takes A0, A1, A2, A3, A4. The source draws X changes exactly at some edges. Output over periods 1–5: A A0, A1, A1′, A3, A4; B A0, A1, A2′, A3, A4; C A1, A2, A2′, A3, A4; D A1, A2, A3, A4, A5. Explain the ideal sampling assumption.
Tap to enlarge
Your answer
Answer & solution

Answer: A under pre-edge sampling convention (no official key was published)

The combinational input is D=AX+Q′X′. Thus X=1 loads A and X=0 toggles the previous output. Sampling the values just BEFORE each rising edge, X is 1, 1, 0, 1, 1 and the available A values are A0, A1, A2, A3, A4. The outputs for periods 1–5 are therefore A0, A1, A1′, A3, A4, option A. Both drawings put X transitions exactly on rising edges; an actual device would require setup/hold timing to determine the result reliably. The answer uses the conventional idealized pre-edge interpretation rather than claiming that coincident physical transitions are well-defined.

Evaluate the next-state equation before each clock edge. With X=1 the second product vanishes, so D=A and the register loads that sample. With X=0 the first product vanishes, so D=¬Q and it toggles its previously stored value. The third edge therefore stores ¬A1 rather than an independent A2. This produces option A under pre-edge sampling. A real setup/hold violation at a coincident transition cannot be resolved solely from an ideal Boolean drawing.

Original paper, page 8

2 marks · MCQ
Report issue

Serial two’s-complement transducer

Finite-State Machine Design

Question 63, GATE 2005: A binary transducer reads least-significant bit first. Initial Q0 loops on 0/output 0 and changes to Q1 on 1/output 1; Q1 loops on 0/output 1 and 1/output 0. Does it compute A ones complement; B twos complement; C increment; D decrement?
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Read from the least significant end: Q0 copies all initial zeros and copies the first 1, then Q1 complements every remaining bit. Keeping the least-significant 1 and all lower zeros while complementing higher bits is exactly fixed-width two’s-complement negation. The all-zero input remains zero. Thus B.

Subtracting a fixed-width binary word from zero leaves its trailing zeros unchanged, leaves the first 1 unchanged, and complements all higher bits. The state change happens at precisely that first 1. For example input word 010100 read from the right yields output 101100, its negation modulo 64. Zero never leaves Q0 and stays zero. A ones-complement machine would flip the trailing zeros too, so A is not the same operation.

Original paper, page 8

2 marks · MCQ
Report issue

Two flip-flop state sequence

Flip-Flops, Registers & Sequential Circuits

Question 64, GATE 2005: Two positive-edge D flip-flops start at Q0Q1=00. Wiring gives D0=¬Q0 and D1=Q0 XOR ¬Q1. Which repeating cycle? A00→11→01→00; B00→11→00; C00→10→01→11→00; D00→11→01→10→00.
Question 64, GATE 2005: Two positive-edge D flip-flops start at Q0Q1=00. Wiring gives D0=¬Q0 and D1=Q0 XOR ¬Q1. Which repeating cycle? A00→11→01→00; B00→11→00; C00→10→01→11→00; D00→11→01→10→00.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Read the wires as Q0(next)=Q0′ and Q1(next)=Q0 XOR Q1′. Simultaneous updates from 00 give 11; from 11 give 01; from 01 give 10; and from 10 return to 00. Thus the cycle is 00→11→01→10→00, D. Both source diagrams agree.

Both registers sample old values simultaneously. At 00, D0=1 and D1=0 XOR 1=1, producing 11. At 11, D0=0 and D1=1 XOR 0=1, producing 01. At 01, D0=1 and D1=0 XOR 0=0, producing 10. At 10, D0=0 and D1=1 XOR 1=0, returning 00. Do not update Q0 first and reuse its new value in the Q1 equation; that would describe different asynchronous behavior.

Original paper, page 8

2 marks · MCQ
Report issue

Memory cycles for indexed and indirect addition

Instructions & Addressing Modes

Question 65, GATE 2005: Three-word ADD A[R0],@B uses destination indexed address A+R0 and source memory-indirect address M[B]. Opcode/modes are word 1, A and B are words 2/3. How many memory cycles in execution? A3; B4; C5; D6. Distinguish opcode-only fetch boundary from fetching all instruction words before execution.
Tap to enlarge
Your answer
Answer & solution

Answer: D if operand words fetched in execution; B if all three instruction words already fetched (no official key was published)

After fetching the opcode word, execution reads instruction word A and instruction word B (two cycles), reads destination M[A+R0] (one), reads the indirect pointer M[B] and then source M[M[B]] (two), and writes the sum to M[A+R0] (one). This totals six, D. If the phrase execution cycle instead excludes fetching ALL three instruction words, only the four operand accesses remain, B. The paper lack an explicit fetch-cycle boundary; the six-cycle answer uses the conventional opcode-only initial fetch assumed by this style of question. The total including all instruction words is seven memory accesses, with no overlap or cache effects specified.

Separate instruction-word reads from operand-addressing reads. After an opcode-only fetch, two more reads retrieve A and B. Indexed destination contributes one read of its old value; indirect source contributes one read for the pointer and one for its pointed-to value. Finally one write stores the sum. That is 2+1+2+1=6. If all three instruction words were already fetched, only four accesses remain; the missing boundary definition is therefore material, not a computational error.

Original paper, page 8

2 marks · MCQ
Report issue

Natural addressing modes

Instructions & Addressing Modes

Question 66, GATE 2005: Match 1 A[I]=B[J]; 2 while(*A++); 3 int temp=*x; to (a)indirect,(b)indexed,(c)autoincrement addressing. A (1, c),(2, b),(3, a); B (1, a),(2, c),(3, b); C (1, b),(2, c),(3, a); D (1, b),(2, b),(3, c). GFG D begins (1, b); GateForum D begins (1, a).
Question 66, GATE 2005: Match 1 A[I]=B[J]; 2 while(*A++); 3 int temp=*x; to (a)indirect,(b)indexed,(c)autoincrement addressing. A (1, c),(2, b),(3, a); B (1, a),(2, c),(3, b); C (1, b),(2, c),(3, a); D (1, b),(2, b),(3, c). GFG D begins (1, b); GateForum D begins (1, a).
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Array indexing A[I]=B[J] naturally uses indexed addressing; walking a pointer with *A++ uses autoincrement; dereferencing *x uses indirect addressing. The matching is (1, b),(2, c),(3, a), option C.

Indexed addressing adds a scaled index to an array base, matching 1. Autoincrement supplies the current pointer address and advances the pointer, matching 2. Plain dereference uses an address stored in a register or variable without an index, matching 3. Thus the mapping is 1b2c3a. These are natural implementation correspondences, not claims that a compiler must choose exactly these machine instructions.

Original paper, page 8

2 marks · MCQ
Report issue

Direct-mapped cache index and tag

Cache Memory

Question 67, GATE 2005: Direct-mapped cache data capacity 32 KB, block 32 bytes, CPU 32-bit byte addresses. Required(index bits, tag bits): A(10, 17); B(10, 22); C(15, 17); D(5, 17). Use binary capacity units.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Step through it (6 steps)

The cache contains 32 KiB/32 bytes =1024 lines, so its index needs 10 bits. A block offset needs log2(32)=5 bits. Of the 32 address bits, 32−10−5=17 remain for the tag. Thus (10, 17), option A.

First divide data capacity by block size to obtain 1024 distinct cache positions. Choosing one needs 10 bits. Choosing a byte within 32-byte block needs 5 low-order bits. The tag identifies which memory block is currently occupying that position, using the remaining 32−10−5=17 bits. Check 10+17+5=32. The cache’s total number of bytes is not the number of line indices.

Original paper, page 9

2 marks · MCQ
Report issue

Load-use dependencies in a five-stage pipeline

Pipelining & Hazards

Question 68, GATE 2005: Five one-cycle stages IF instruction fetch, RD decode/register read, EX ALU/address, MA data memory (stores use data read in RD), WB register write. Instructions I1:R0←M[loc1], I2:R0←R0+R0, I3:R2←R2−R0. Total cycles from first fetch through final completion? A8; B10; C12; D15. The source does not explicitly state forwarding.
Tap to enlarge
Your answer
Answer & solution

Answer: A, conditional on forwarding (no official key was published)

With ordinary EX forwarding, the load-use dependency requires one bubble: I1 follows IF1, RD2, EX3, MA4, WB5; I2 follows IF2, RD3 (held through cycle 4), EX5, MA6, WB7; I3 follows IF3 (held), RD5, EX6, MA7, WB8. The add result forwards to the subtract without another bubble. Total 5+2+1=8 cycles, option A. Forwarding is not explicitly stated in the paper, so 8 is conditional, not a uniquely established result from the written stage definitions alone. Without forwarding, with register write/read in opposite halves of one cycle, the two RAW dependencies instead add four bubbles, producing 11 cycles, absent from the choices.

With forwarding, the memory-loaded value appears only after I1’s MA stage, so I2 cannot consume it in EX at cycle 4; stall one cycle. Its ALU result can then forward directly to I3’s EX, adding no second bubble. An unstalled three-instruction/five-stage pipeline would take 7 cycles, so the one bubble makes 8. If forwarding is absent, register availability imposes further waits; the question’s stage list alone does not justify treating 8 as universal.

Original paper, page 9

2 marks · MCQ
Report issue

Interrupt overhead versus polling

Input/Output, DMA & Interrupts

Question 69, GATE 2005: A10 KB/s device transfers bytes individually. Interrupt overhead 4 microseconds; byte-transfer time to CPU/memory negligible. Minimum intended performance gain using interrupts rather than program-controlled polling? A15; B25; C35; D45. Interpret as CPU occupation ratio and state unit convention.
Question 69, GATE 2005: A10 KB/s device transfers bytes individually. Interrupt overhead 4 microseconds; byte-transfer time to CPU/memory negligible. Minimum intended performance gain using interrupts rather than program-controlled polling? A15; B25; C35; D45. Interpret as CPU occupation ratio and state unit convention.
Tap to enlarge
Your answer
Answer & solution

Answer: B, approximately 25 (no official key was published)

Polling occupies the CPU throughout the interval between consecutive bytes. Using the decimal convention 10 KB/s=10000 bytes/s, this interval is 100 microseconds, whereas interrupt servicing costs 4 microseconds. CPU-time cost ratio is 100/4=25, option B. This compares CPU occupation, not device throughput, which is unchanged. With binary KB the exact ratio is 1/(10240×4×10−6)=24.4140625; 25 is the intended rounded/conventional option.

At 10000 bytes/s a byte arrives every 100 microseconds. Polling continually tests readiness and occupies the CPU for that whole interval. Interrupt service instead occupies only 4 microseconds per byte; the rest can run unrelated work. Their CPU cost ratio is 100/4=25. This is not a 25-fold faster physical device. Binary KB changes the exact ratio, hence the declared convention matters.

Original paper, page 9

2 marks · MCQ
Report issue

Cycle-stealing DMA blocking fraction

Input/Output, DMA & Interrupts

Question 70, GATE 2005: Disk:16 surfaces, 512 tracks/surface, 512 sectors/track, 1 KB/sector, 3000 rpm. DMA steals a 40 ns memory cycle for each four-byte word. Maximum CPU-blocked percentage: A10; B25; C40; D50. Check exact units rather than assuming one option is exact.
Tap to enlarge
Your answer
Answer & solution

Answer: B, approximate only (no official key was published)

One track passes the head per revolution; surfaces and tracks determine capacity, not a multiplier of simultaneous transfer rate. Rotation rate is 3000/60=50 revolutions/s. With binary KiB, the transfer rate is 512×1024×50 bytes/s. At four bytes per stolen cycle, memory is occupied for (512×1024×50/4)×40×10−9=0.262144 of the time, or 26.2144%. The nearest option is B (25%), but no option equals the exact result. Decimal KB gives 25.6%, still not exactly 25%; B requires approximate arithmetic.

Compute the streaming rate for the track under one active head:50 revolutions/s times 512 sectors/revolution times 1024 bytes/sector. Divide by 4 to obtain stolen cycles/s, then multiply by 40 ns/cycle. This dimensional chain yields 0.262144 seconds blocked per second. Multiplying by surfaces or total tracks would incorrectly assume simultaneous transfer from all disk positions. B is nearest, but 26.2144% is not exactly 25%.

Original paper, page 9

2 marks · MCQ
Report issue

Sufficient condition preventing resource deadlock

Deadlocks

Question 71, GATE 2005: n processes share m identical reusable units, acquired/released one at a time. Process i has positive maximum need s_i. Which is sufficient to avoid resource deadlock? A every s_i<m; B every s_i<n; C Σs_i<m+n; D Σs_i<m·n.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

If no process can finish, every process can hold at most si−1 units while still needing another unit. Thus at most sum(si−1)=sum(si)−n units can be held in an all-unfinished configuration. If sum(si)<m+n, this total is less than m, so at least one resource is free; allocating available units eventually lets a process reach its maximum and finish. Release its resources and repeat. Equivalently m>sum(si−1) guarantees progress for the single resource type. This is option C.

Suppose every unfinished process is blocked below its maximum claim. It can hold at most si−1 units, so together they can hold at mostΣ(si−1). If m exceeds that bound, some units remain available and can be allocated until at least one process finishes; its release only improves the position. Rearranging m>Σsi−n gives option C. Individual small claims alone do not prevent circular waiting among multiple processes.

Original paper, page 9

2 marks · MCQ
Report issue

Forked values and virtual addresses

Processes, Threads & System Calls

Question 72, GATE 2005: Code: if(fork()==0){a=a+5;printf("%d,%d\n", a,&a);}else{a=a−5;printf("%d,%d\n", a,&a);}. Parent prints u, v and child x, y. A u=x+10, v=y; B u=x+10, v≠y; C u+10=x, v=y; D u+10=x, v≠y. Address formatting is reproduced literally and requires a portability qualification.
Question 72, GATE 2005: Code: if(fork()==0){a=a+5;printf("%d,%d\n", a,&a);}else{a=a−5;printf("%d,%d\n", a,&a);}. Parent prints u, v and child x, y. A u=x+10, v=y; B u=x+10, v≠y; C u+10=x, v=y; D u+10=x, v≠y. Address formatting is reproduced literally and requires a portability qualification.
Tap to enlarge
Your answer
Answer & solution

Answer: C, under intended address-printing semantics (no official key was published)

Let a initially equal a 0. The child executes the zero-return branch and obtains x=a 0+5; the parent obtains u=a 0−5. Therefore u+10=x. fork preserves the virtual address of a, so its address has the same numeric value in each process even though the memory is logically separate: v=y. Hence C under the intended OS model. Strictly, the printed printf uses %d for &a; that variadic type mismatch is undefined behavior in ISO C, so literal portable-C output is not guaranteed. Using %p with (void *)&a expresses the intended comparison.

fork duplicates the address-space state. The child and parent modify separate copies starting from the same initial a 0: child a 0+5, parent a 0−5, hence a difference 10. Their virtual addresses retain equal numerical locations despite distinct physical memory. This supports C as the intended OS result. The actual %d address argument is type-incorrect; use %p and a void* cast to state the intended comparison in portable C.

Original paper, page 9

2 marks · MCQ
Report issue

Optimal packet size on three links

Physical Layer & Transmission

Question 73, GATE 2005: A24-byte message traverses a single packet-switched path with two intermediate nodes (three equal-rate store-and-forward links). Every packet has a 3-byte header. Optimum total packet size: A4; B6; C7; D9 bytes. Use equal payload segments and neglect packet-independent propagation.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Let payload size be p bytes, so each packet has size p+3 and there are 24/p packets. Across three equal-rate store-and-forward links the serialization makespan, apart from constant propagation terms, is (24/p+2)(p+3)=30+2p+72/p byte-times. Its derivative is 2−72/p², giving p=6 bytes. This divides 24 exactly, and the total packet size is 6+3=9 bytes, option D. Packet size includes the header; six is only the payload.

For k packets of lengthp+3, a three-link pipeline needs k+2 packet transmission times: three for the first packet, one for each later packet. Substituting k=24/p gives 30+2p+72/p. Its derivative vanishes atp=6 and the second derivative 144/p³ is positive. Payload 6 divides 24, so no unequal final packet is needed. Adding its 3-byte header gives total 9, distinguishing the asked packet size from payload size.

Original paper, page 10

2 marks · MCQ
Report issue

Ethernet collision slot length

Medium Access & Ethernet

Question 74, GATE 2005: A10 Mbps Ethernet has round-trip propagation 46.4 microseconds and 48-bit jam allowance. Intended minimum frame size in bits: A94; B416; C464; D512.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

The round-trip propagation delay corresponds to 10×106×46.4×10−6=464 bit-times. Including the stated 48-bit jam allowance gives 464+48=512 bits, or 64 bytes, option D. This uses the question’s intended collision-slot budgeting convention; the jam is collision handling, not an extra field appended to every successful frame.

At 10 million bits/s, propagation 46.4 microseconds spans 464 bit times. Under the supplied collision-slot convention, add 48 bit times for jamming, giving 512 bits. Dividing by 8 gives 64 bytes, but the choices are in bits. The jam is not an ordinary payload/header field to append to every successful Ethernet frame; it belongs to the stated collision handling budget.

Original paper, page 10

2 marks · MCQ
Report issue

Tables for two entity relationships

Database Models, Architecture & ER Diagrams

Question 75, GATE 2005: Two ER entities E1, E2 have simple single-valued attributes and two relationships between them: R1 one-to-many and R2 many-to-many, neither with attributes. Minimum relational tables: A2; B3; C4; D5.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Use one table for each entity set. The one-to-many relationship is represented by placing the one-side key as a foreign key in the many-side table, so it needs no separate table. The many-to-many relationship needs a third junction table containing the two entity keys. Minimum: three tables, option B.

Represent each entity type by a table, giving two. The many side of R1 can store the one-side primary key, since each many-side instance relates to at most one one-side instance; no junction table is necessary. R2 needs a junction table because either side can have several partners. Its pair of foreign keys records each pair, bringing the minimum to three.

Original paper, page 10

2 marks · MCQ
Report issue

Transitive cascading deletion

Database Models, Architecture & ER Diagrams

Question 76, GATE 2005: Table(A, C), primary key A, C references A ON DELETE CASCADE, contains (2, 4),(3, 4),(4, 3),(5, 2),(7, 2),(9, 5),(6, 4). Besides(2, 4), which rows must be deleted when it is removed? A(3, 4),(6, 4); B(5, 2),(7, 2); C(5, 2),(7, 2),(9, 5); D(3, 4),(4, 3),(6, 4).
Question 76, GATE 2005: Table(A, C), primary key A, C references A ON DELETE CASCADE, contains (2, 4),(3, 4),(4, 3),(5, 2),(7, 2),(9, 5),(6, 4). Besides(2, 4), which rows must be deleted when it is removed? A(3, 4),(6, 4); B(5, 2),(7, 2); C(5, 2),(7, 2),(9, 5); D(3, 4),(4, 3),(6, 4).
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Deleting key A=2 directly deletes the referencing rows (5, 2) and (7, 2). Deleting A=5 in turn deletes (9, 5). Nothing points to 7 or 9 in the displayed instance. Rows (3, 4),(4, 3),(6, 4) do not depend on key 2 and remain. The additional deletion set is {(5, 2),(7, 2),(9, 5)}, option C.

Follow references toward deleted primary-key values, not outward along the deleted row’s own foreign key. Removing key 2 first removes rows with C=2, namely 5 and 7. Removing key 5 then removes row 9. No remaining row points to 7 or 9. The cycle 3↔4 and row 6→4 are unrelated to deletion of 2, so they survive. Cascades must be followed transitively, which is why choice B is incomplete.

Original paper, page 10

2 marks · MCQ
Report issue

Correlated count of more expensive books

SQL & Queries

Question 77, GATE 2005: book(title, price) has distinct prices. Query SELECT title FROM book B WHERE (SELECT COUNT(*) FROM book T WHERE T.price>B.price)<5. A four most expensive titles; B fifth cheapest; C fifth most expensive; D five most expensive titles. Examine NULL prices separately.
Tap to enlarge
Your answer
Answer & solution

Answer: D, assuming non-NULL prices (no official key was published)

For each B the subquery counts books with a strictly higher price. The predicate count<5 selects ranks 1 through 5 in descending price order, because they have respectively 0 through 4 more expensive books. Distinct prices rule out ties. The result is the titles of the five most expensive books (or all books if fewer than five), option D. This intended interpretation additionally assumes prices are non-NULL. Distinct prices alone does not establish a NOT NULL constraint: for a row B with NULL price, every T.price>B.price comparison is UNKNOWN, so the subquery counts zero and that NULL-priced row is included regardless of the five highest non-NULL prices.

For a book with descending rank r and a non-NULL unique price, exactly r−1 rows are more expensive. The predicate r−1<5 is r≤5, yielding the top five, not merely the fifth. COUNT(*) counts qualifying rows, never the current book because comparison is strict. If B.price is NULL, every comparison is UNKNOWN and no row qualifies, so count is 0 and that book also passes. Distinctness alone must not be silently upgraded to NOT NULL.

Original paper, page 10

2 marks · MCQ
Report issue

Candidate keys with two mandatory attributes

Functional Dependencies & Keys

Question 78, GATE 2005: R(A, B, C, D, E, H), FDs A→B, BC→D, E→C, D→A. Candidate-key sets: A AE, BE; B AE, BE, DE; C AEH, BEH, BCH; D AEH, BEH, DEH. Option C uses the clearer GateForum BEH; GFG appears to print BEE in that position.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (6 steps)

Neither E nor H appears on any dependency right-hand side, so every key contains both. E supplies C. Adding A yields B then D through BC→D; adding B yields D then A; adding D yields A then B. Thus AEH, BEH, DEH each determine all six attributes. EH alone cannot determine A, B, D, and adding only C gives nothing new, so these are precisely the minimal keys, option D.

Attributes absent from all FD right sides cannot be manufactured by closure, so every key includes E, H. With them C becomes available. Add A: obtain B, then D. Add B: combine with C to obtain D, then A. Add D: obtain A then B. Thus all three listed triples are superkeys. Removing their third attribute leaves EH with only E, H, C, proving minimality; adding C instead cannot unlock A, B, D. This also proves there are no omitted minimal keys.

Original paper, page 10

2 marks · MCQ
Report issue

Single-bus register addition

Datapath & Control Unit

Question 79, GATE 2005: Single-bus CPU: MAR, MDR, IR, PC, general registers and ALU input latches S, T share the bus; ALU output returns directly to it. All widths equal; increments must use ALU. Memory read takes two cycles: address→MAR then memory→MDR. After instruction fetch, execute ADD R0, R1 meaning R0←R0+R1. Minimum execution cycles A2; B3; C4; D5.
Question 79, GATE 2005: Single-bus CPU: MAR, MDR, IR, PC, general registers and ALU input latches S, T share the bus; ALU output returns directly to it. All widths equal; increments must use ALU. Memory read takes two cycles: address→MAR then memory→MDR. After instruction fetch, execute ADD R0, R1 meaning R0←R0+R1. Minimum execution cycles A2; B3; C4; D5.
Question 79, GATE 2005: Single-bus CPU: MAR, MDR, IR, PC, general registers and ALU input latches S, T share the bus; ALU output returns directly to it. All widths equal; increments must use ALU. Memory read takes two cycles: address→MAR then memory→MDR. After instruction fetch, execute ADD R0, R1 meaning R0←R0+R1. Minimum execution cycles A2; B3; C4; D5.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

The diagram has separate S and T input latches and a combinational ALU output returning directly to the bus. Cycle 1 transfers R0 to S; cycle 2 transfers R1 to T; cycle 3 transfers ALU(S+T) through the bus to R0. The single bus cannot carry both distinct operands in one cycle, and the result is latched after the two operands are ready. Three execution cycles are necessary and sufficient, option B; instruction fetch is excluded.

A single bus transports only one independently selected register value each cycle. Load S from R0 and T from R1 in separate cycles. Only after both inputs are latched can the combinational sum be selected onto the bus and captured in R0, using a third cycle. This supplies both a feasible schedule and a lower bound: two operand transfers plus a later result transfer cannot fit in two cycles.

Original paper, page 11

2 marks · MCQ
Report issue

Single-bus subroutine call

Datapath & Control Unit

Question 80, GATE 2005: Single-bus CPU: MAR, MDR, IR, PC, general registers and ALU input latches S, T share the bus; ALU output returns directly to it. All widths equal; increments must use ALU. Memory read takes two cycles: address→MAR then memory→MDR. Two-word CALL Rn, sub: opcode fetch already increments PC to second word. Execute Rn←PC+1 and PC←M[PC]. Minimum execution cycles A2; B3; C4; D5.
Question 80, GATE 2005: Single-bus CPU: MAR, MDR, IR, PC, general registers and ALU input latches S, T share the bus; ALU output returns directly to it. All widths equal; increments must use ALU. Memory read takes two cycles: address→MAR then memory→MDR. Two-word CALL Rn, sub: opcode fetch already increments PC to second word. Execute Rn←PC+1 and PC←M[PC]. Minimum execution cycles A2; B3; C4; D5.
Question 80, GATE 2005: Single-bus CPU: MAR, MDR, IR, PC, general registers and ALU input latches S, T share the bus; ALU output returns directly to it. All widths equal; increments must use ALU. Memory read takes two cycles: address→MAR then memory→MDR. Two-word CALL Rn, sub: opcode fetch already increments PC to second word. Execute Rn←PC+1 and PC←M[PC]. Minimum execution cycles A2; B3; C4; D5.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

At execution start PC addresses the second instruction word. A four-cycle schedule is: (1) broadcast PC to MAR and S; (2) read M[MAR] into MDR while loading the increment operand 1 into T; (3) send ALU(S+T) to Rn; (4) send MDR to PC. The external memory read does not occupy the internal bus carrying 1 in cycle 2. Three bus transfers of PC, return address, and target plus preparation of the increment require four cycles in this latched-input datapath. Thus C (4), assuming the usual constant-one ALU input/control needed for the specified increment operation, which the schematic does not explicitly draw.

Two different results must be preserved: the incremented return address and the target stored in memory. Broadcast PC to MAR and S together in the first cycle, since both need the same value. In the second, memory fills MDR while the internal bus supplies the increment constant to T. The third transfers S+T to Rn; the fourth transfers MDR to PC. Memory’s external transfer can overlap internal-bus work; counting it as another serialized internal transfer would overestimate. The constant input is a conventional control assumption explicitly identified.

Original paper, page 11

2 marks · MCQ
Report issue

Space used by repeated recursive calls

Asymptotic Analysis & Recurrences

Question 81a, GATE 2005: double foo(int n){int i;double sum;if(n==0)return 1.0;sum=0.0;for(i=0;i<n;i++)sum+=foo(i);return sum;} Printed 81(a): maximum auxiliary space of foo(n)? A O(1); B O(n); C O(n!); D O(n^n). Seek intended tight order, not merely any loose upper bound.
Question 81a, GATE 2005: double foo(int n){int i;double sum;if(n==0)return 1.0;sum=0.0;for(i=0;i<n;i++)sum+=foo(i);return sum;} Printed 81(a): maximum auxiliary space of foo(n)? A O(1); B O(n); C O(n!); D O(n^n). Seek intended tight order, not merely any loose upper bound.
Question 81a, GATE 2005: double foo(int n){int i;double sum;if(n==0)return 1.0;sum=0.0;for(i=0;i<n;i++)sum+=foo(i);return sum;} Printed 81(a): maximum auxiliary space of foo(n)? A O(1); B O(n); C O(n!); D O(n^n). Seek intended tight order, not merely any loose upper bound.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Every activation stores only a constant number of locals, but calls are nested. A path foo(n)→foo(n−1)→…→foo(0) reaches n+1 simultaneous activations. The loop calls execute sequentially, so the exponentially many calls are not all live at once. Maximum stack space is Θ(n), option B.

Count simultaneously live activations, not total recursive calls. During its last recursive branch, foo(n) may be suspended while foo(n−1), foo(n−2),…, foo(0) are active, giving linear depth. Each frame contains only a constant number of scalar locals. Separate loop iterations return before the next call, so their storage is reused. This distinguishes linear stack space from exponential running time. Larger Big-O choices are also loose bounds; the intended answer describes the tight growth.

Original paper, page 11

2 marks · MCQ
Report issue

Memoized recurrence storage

Dynamic Programming

Question 81b, GATE 2005: double foo(int n){int i;double sum;if(n==0)return 1.0;sum=0.0;for(i=0;i<n;i++)sum+=foo(i);return sum;} Printed 81(b): memoize foo(i), 0≤i<n, as computed. Auxiliary space? A O(1); B O(n); C O(n²); D O(n!).
Question 81b, GATE 2005: double foo(int n){int i;double sum;if(n==0)return 1.0;sum=0.0;for(i=0;i<n;i++)sum+=foo(i);return sum;} Printed 81(b): memoize foo(i), 0≤i<n, as computed. Auxiliary space? A O(1); B O(n); C O(n²); D O(n!).
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Caching foo(i) for 0≤i<n requires n scalar values, hence Θ(n) space. Any recursive call stack is also at most O(n), so the total remains Θ(n), option B. Memoization reduces recomputation but does not require storing all call-tree nodes. This counts machine words, as in the question’s double-valued implementation.

Memoization allocates one result per argument value, a linear-size table, rather than one result per recursive-call occurrence. A recursive implementation can still have a linear stack, but adding two linear requirements remains linear. The table itself gives a linear lower bound in the stated storage scheme. Count constant-size machine words as specified by the double implementation; arbitrary-precision value bit lengths would be a different model.

Original paper, page 11

2 marks · MCQ
Report issue

Unique light edge of a cut

Graph Algorithms

Question 82a, GATE 2005: Undirected connected graph has distinct positive edge weights. Partition X, Y separates s∈X, t∈Y; e is the minimum-weight edge crossing that cut. Printed 82(a): e must belong to which object: minimum spanning tree, weighted shortest s–t path, every s–t path, or weighted longest s–t path? GFG has a blank A and shifted labels; preserve the concept rather than a universal option letter.
Question 82a, GATE 2005: Undirected connected graph has distinct positive edge weights. Partition X, Y separates s∈X, t∈Y; e is the minimum-weight edge crossing that cut. Printed 82(a): e must belong to which object: minimum spanning tree, weighted shortest s–t path, every s–t path, or weighted longest s–t path? GFG has a blank A and shifted labels; preserve the concept rather than a universal option letter.
Tap to enlarge
Your answer
Answer & solution

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

Let T be a minimum spanning tree. If its edges omit the unique lightest crossing edge e, insert e into T, making a cycle. That cycle contains another edge f crossing the same cut. Distinct weights give w(e)<w(f); replacing f by e makes a lighter spanning tree, a contradiction. Hence e belongs to the MST. Connectivity is implicitly required for a spanning tree (otherwise use a minimum spanning forest in relevant components). The answer concept is unambiguous, but the source option letters are not interchangeable.

Use an exchange argument. If an MST omitted the lightest crossing edge, adding it creates a cycle. Because its endpoints are on opposite sides, the rest of that cycle must cross the same cut elsewhere. Replace that heavier crossing edge by e; distinct weights make the improvement strict, contradicting minimality. This proves MST membership but not membership in every s–t path: a path can cross on a more expensive edge. Minimum total distance is a different objective.

Original paper, page 11

2 marks · MCQ
Report issue

MST path minimizes the bottleneck

Graph Algorithms

Question 82b, GATE 2005: Undirected connected graph has distinct positive edge weights. Partition X, Y separates s∈X, t∈Y; e is the minimum-weight edge crossing that cut. Printed 82(b): path congestion is its largest edge weight. Which always minimizes congestion from s to t? A path in an MST; B weighted shortest path; C Euler walk; D Hamiltonian path.
Question 82b, GATE 2005: Undirected connected graph has distinct positive edge weights. Partition X, Y separates s∈X, t∈Y; e is the minimum-weight edge crossing that cut. Printed 82(b): path congestion is its largest edge weight. Which always minimizes congestion from s to t? A path in an MST; B weighted shortest path; C Euler walk; D Hamiltonian path.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Take the s–t path in an MST and let f be its heaviest edge. Removing f partitions the tree with s and t on opposite sides. Any other s–t path must cross this cut. A crossing edge lighter than f could replace f to improve the MST, so every crossing edge has weight at least w(f). Every alternative path therefore has bottleneck at least w(f), exactly the MST path’s bottleneck. Option A.

Take the unique s–t path in an MST and remove its heaviest edge f. This creates a cut separating s, t. If any crossing edge were lighter than f, substituting it would create a cheaper spanning tree. Thus every alternative s–t path must use a crossing edge at least as heavy as f. Its maximum edge cannot be lower than the MST path’s maximum, proving minimax optimality even though the MST path need not minimize total distance.

Original paper, page 11

2 marks · MCQ
Report issue

Yacc default ambiguity resolution

Parsing & Syntax Analysis

Question 83a, GATE 2005: Expression grammar E→number | E+E | E×E has the usual synthesized arithmetic values and is given to yacc without precedence/associativity declarations. Printed 83(a): yacc A detects/eliminates recursion; B resolves reduce/reduce conflict; C resolves shift/reduce in favor of shift; D resolves shift/reduce in favor of reduce.
Question 83a, GATE 2005: Expression grammar E→number | E+E | E×E has the usual synthesized arithmetic values and is given to yacc without precedence/associativity declarations. Printed 83(a): yacc A detects/eliminates recursion; B resolves reduce/reduce conflict; C resolves shift/reduce in favor of shift; D resolves shift/reduce in favor of reduce.
Question 83a, GATE 2005: Expression grammar E→number | E+E | E×E has the usual synthesized arithmetic values and is given to yacc without precedence/associativity declarations. Printed 83(a): yacc A detects/eliminates recursion; B resolves reduce/reduce conflict; C resolves shift/reduce in favor of shift; D resolves shift/reduce in favor of reduce.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

The grammar E→number | E+E | E×E is ambiguous. After recognizing E+E or E×E, a following operator permits either reduction of the completed expression or shifting to build the right operand further. This is a shift/reduce conflict. With no precedence/associativity declarations, yacc defaults to shifting, option C; left recursion itself is valid for LR parsing.

After E+E has been recognized and a further operator is seen, the parser can either reduce the completed expression now or shift the operator to extend its right operand. The grammar does not specify which grouping is intended, hence a shift/reduce conflict. yacc’s default selects shift. Left recursion is supported naturally by LR parsing and is not removed automatically; no two distinct completed production reductions cause this particular ambiguity.

Original paper, page 12

2 marks · MCQ
Report issue

Expression evaluation with default shifts

Parsing & Syntax Analysis

Question 83b, GATE 2005: Expression grammar E→number | E+E | E×E has the usual synthesized arithmetic values and is given to yacc without precedence/associativity declarations. Printed 83(b): under its default resolution, how is 3×2+1 interpreted? A equal precedence, left associative, result 7; B equal precedence, right associative, result 9; C ×higher, left associative, result 7; D +higher, left associative, result 9.
Question 83b, GATE 2005: Expression grammar E→number | E+E | E×E has the usual synthesized arithmetic values and is given to yacc without precedence/associativity declarations. Printed 83(b): under its default resolution, how is 3×2+1 interpreted? A equal precedence, left associative, result 7; B equal precedence, right associative, result 9; C ×higher, left associative, result 7; D +higher, left associative, result 9.
Question 83b, GATE 2005: Expression grammar E→number | E+E | E×E has the usual synthesized arithmetic values and is given to yacc without precedence/associativity declarations. Printed 83(b): under its default resolution, how is 3×2+1 interpreted? A equal precedence, left associative, result 7; B equal precedence, right associative, result 9; C ×higher, left associative, result 7; D +higher, left associative, result 9.
Question 83b, GATE 2005: Expression grammar E→number | E+E | E×E has the usual synthesized arithmetic values and is given to yacc without precedence/associativity declarations. Printed 83(b): under its default resolution, how is 3×2+1 interpreted? A equal precedence, left associative, result 7; B equal precedence, right associative, result 9; C ×higher, left associative, result 7; D +higher, left associative, result 9.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Using the default shift resolution from part(a), neither operator receives a special precedence declaration and pending operators are reduced from the right. Thus 3×2+1 is parsed as 3×(2+1)=9. This behaves as equal precedence and right associativity, option B. This conclusion is conditional on the default shift resolution, not on adding conventional arithmetic precedence declarations.

At the + following 3×2, shifting postpones reducing 3×2. The parser first combines 2+1, then multiplies that result by 3, giving 9. Applying the same shift default to repeated operators creates right association. This is not evidence of a declared higher precedence for+: the behavior is the equal-precedence default arising from unresolved conflicts. A user-supplied precedence declaration could intentionally change the result.

Original paper, page 12

2 marks · MCQ
Report issue

Profitable unit-time jobs before deadlines

Greedy Algorithms

Question 84a, GATE 2005: Nine unit-time jobs T1…T9, one at a time, earn profits[15, 20, 30, 18, 18, 10, 23, 16, 25] if finished by deadlines[7, 2, 5, 3, 4, 5, 2, 7, 3], respectively. Printed 84(a): in a maximum-profit schedule A all jobs done; B T1, T6 omitted; C T1, T8 omitted; D T4, T6 omitted.
Question 84a, GATE 2005: Nine unit-time jobs T1…T9, one at a time, earn profits[15, 20, 30, 18, 18, 10, 23, 16, 25] if finished by deadlines[7, 2, 5, 3, 4, 5, 2, 7, 3], respectively. Printed 84(a): in a maximum-profit schedule A all jobs done; B T1, T6 omitted; C T1, T8 omitted; D T4, T6 omitted.
Question 84a, GATE 2005: Nine unit-time jobs T1…T9, one at a time, earn profits[15, 20, 30, 18, 18, 10, 23, 16, 25] if finished by deadlines[7, 2, 5, 3, 4, 5, 2, 7, 3], respectively. Printed 84(a): in a maximum-profit schedule A all jobs done; B T1, T6 omitted; C T1, T8 omitted; D T4, T6 omitted.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Order jobs by descending profit and put each in the latest free slot not exceeding its deadline. One resulting schedule in slots 1…7 is T2, T7, T9, T5, T3, T8, T1. Their deadlines are respectively 2, 2, 3, 4, 5, 7, 7, so all meet their deadlines. T4 and T6 are omitted, option D. In particular T2, T4, T7, T9 all have deadline≤3, so at least one of them must be omitted; T4 has their lowest profit. Only seven slots exist through the latest deadline, requiring another omission, optimally T6.

The greedy unit-job method processes larger profits first and places each job as late as its deadline permits, leaving earlier slots for tighter deadlines. It yields T2, T7, T9, T5, T3, T8, T1. Check every slot against its deadline:1≤2, 2≤2, 3≤3, 4≤4, 5≤5, 6≤7, 7≤7. T4 and T6 are absent. The three-slot deadline bottleneck among T2, T4, T7, T9 explains why a job must be omitted even before considering total capacity.

Original paper, page 12

2 marks · MCQ
Report issue

Maximum deadline-scheduling profit

Greedy Algorithms

Question 84b, GATE 2005: Nine unit-time jobs T1…T9, one at a time, earn profits[15, 20, 30, 18, 18, 10, 23, 16, 25] if finished by deadlines[7, 2, 5, 3, 4, 5, 2, 7, 3], respectively. Printed 84(b): maximum profit A147; B165; C167; D175.
Question 84b, GATE 2005: Nine unit-time jobs T1…T9, one at a time, earn profits[15, 20, 30, 18, 18, 10, 23, 16, 25] if finished by deadlines[7, 2, 5, 3, 4, 5, 2, 7, 3], respectively. Printed 84(b): maximum profit A147; B165; C167; D175.
Question 84b, GATE 2005: Nine unit-time jobs T1…T9, one at a time, earn profits[15, 20, 30, 18, 18, 10, 23, 16, 25] if finished by deadlines[7, 2, 5, 3, 4, 5, 2, 7, 3], respectively. Printed 84(b): maximum profit A147; B165; C167; D175.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

The schedule T2, T7, T9, T5, T3, T8, T1 earns 20+23+25+18+30+16+15=147. All nine profits sum to 175. At least one of the four jobs with deadline≤3 must be dropped, losing at least 18, and at least one additional job must be dropped since the latest deadline is 7, losing at least 10. Therefore profit≤175−18−10=147, attained above. Option A.

Sum the feasible schedule’s seven profits to obtain 147. For optimality, the four jobs with deadline at most 3 cannot all fit in three slots, requiring a loss of at least 18. At most seven jobs can finish by the latest deadline 7, so another distinct job must be omitted, losing at least 10. Subtract these unavoidable losses from 175 to get upper bound 147, matched by the schedule. Thus the result is proven optimal rather than just a greedy candidate.

Original paper, page 12

2 marks · MCQ
Report issue

Unnormalized custom floating-point encoding

Data Representation & Arithmetic

Question 85a, GATE 2005: A 16-bit format has sign bit 15, seven-bit excess 64 exponent in 14…8, eight-bit pure fractional mantissa in 7…0; sign-magnitude. Printed 85(a): encode positive 0.239×2^13 without normalization or rounding. Hex choices A 0D24; B 0D4D; C 4D0D; D 4D3D.
Question 85a, GATE 2005: A 16-bit format has sign bit 15, seven-bit excess 64 exponent in 14…8, eight-bit pure fractional mantissa in 7…0; sign-magnitude. Printed 85(a): encode positive 0.239×2^13 without normalization or rounding. Hex choices A 0D24; B 0D4D; C 4D0D; D 4D3D.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

The sign is 0. The seven-bit biased exponent is 13+64=77=0x4D. The eight-bit pure-fraction field is obtained by truncation: floor(0.239×256)=61=0x3D, binary 00111101. Concatenating sign, exponent, and mantissa gives 0x4D3D, option D. No normalization or rounding is applied.

Bias affects the exponent field, not the mantissa:13+64=77, or binary 1001101. Truncating eight fraction bits gives floor(.239×256)=61, binary 00111101. The sign 0 followed by exponent 1001101 produces the high byte 01001101=4D; the low byte is 3D. Round-to-nearest would be a different instruction, explicitly excluded here.

Original paper, page 12

2 marks · MCQ
Report issue

Normalizing the stored fraction with zero fill

Data Representation & Arithmetic

Question 85b, GATE 2005: A 16-bit format has sign bit 15, seven-bit excess 64 exponent in 14…8, eight-bit pure fractional mantissa in 7…0; sign-magnitude. Printed 85(b): normalize the representation from(a), now storing an implicit leading 1 before the binary point, padding only zeros during shifts. Hex choices A 0A20; B 1134; C 49D0; D 4AE8. Preserve the linked truncated value, not a fresh conversion of the exact decimal.
Question 85b, GATE 2005: A 16-bit format has sign bit 15, seven-bit excess 64 exponent in 14…8, eight-bit pure fractional mantissa in 7…0; sign-magnitude. Printed 85(b): normalize the representation from(a), now storing an implicit leading 1 before the binary point, padding only zeros during shifts. Hex choices A 0A20; B 1134; C 49D0; D 4AE8. Preserve the linked truncated value, not a fresh conversion of the exact decimal.
Question 85b, GATE 2005: A 16-bit format has sign bit 15, seven-bit excess 64 exponent in 14…8, eight-bit pure fractional mantissa in 7…0; sign-magnitude. Printed 85(b): normalize the representation from(a), now storing an implicit leading 1 before the binary point, padding only zeros during shifts. Hex choices A 0A20; B 1134; C 49D0; D 4AE8. Preserve the linked truncated value, not a fresh conversion of the exact decimal.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Part(a) stores the fraction .00111101₂ times 213. Moving the radix point three places right gives 1.11101₂×210. With the leading 1 implicit and only zeros padded, the eight stored fraction bits are 11101000=0xE8. The biased exponent is 10+64=74=0x4A, so the word is 0x4AE8, option D. This normalizes the truncated stored mantissa from part(a). Directly converting the original exact decimal to normalized form would produce different low bits; the explicit zero-fill rule is essential.

Begin with the already truncated .00111101×213. Shift three places to make its leading 1 sit before the point:1.11101×210. Drop only that implicit leading 1 and pad the remaining fraction to 11101000. The new biased exponent 10+64=74 gives high byte 4A; the fraction givesE 8. This transformation preserves the stored number exactly. Re-expanding the original decimal instead would introduce nonzero lower bits disallowed by the zero-padding premise.

Original paper, page 12