Organised by IISc Bengaluru

GATE 2016 CS (Computer Science) Set 2 question paper with solutions

64 questions with the official answer key and a worked solution for each. Try a question before opening its answer.

Practise this paper with instant checking
Q1MCQ1 mark · -1/3· Easy

The man who is now Municipal Commissioner worked as ____________________.

  1. (A)the security guard at a university
  2. (B)a security guard at the university
  3. (C)a security guard at university
  4. (D)the security guard at the university
Answer: B - show solution

The blank names a job he held before becoming Municipal Commissioner. "A security guard" is right because he was one of many guards (indefinite). "The university" is right because a specific, identifiable university is meant. So the phrase is "a security guard at the university". Answer: (B).

Concept: Definite versus indefinite article. A job held among many people takes "a"; a specific place takes "the". The trap is "the security guard", which implies he was the only guard.

Q2MCQ1 mark · -1/3· Easy

Nobody knows how the Indian cricket team is going to cope with the difficult and seamer-friendly wickets in Australia. Choose the option which is closest in meaning to the underlined phrase "cope with" in the above sentence.

  1. (A)put up with
  2. (B)put in with
  3. (C)put down to
  4. (D)put up against
Answer: A - show solution

"Cope with" means to deal with or endure a difficult situation. "Put up with" means to tolerate or endure. "Put down to" means to attribute, "put up against" means to pit against, and "put in with" is not an idiom with this sense. Answer: (A) put up with.

Concept: Phrasal-verb meaning in context. All options share "put", so only the particle decides the meaning; only "put up with" carries the sense of enduring.

Q3MCQ1 mark · -1/3· Easy

Find the odd one in the following group of words. mock, deride, praise, jeer

  1. (A)mock
  2. (B)deride
  3. (C)praise
  4. (D)jeer
Answer: C - show solution

Mock, deride and jeer all mean to ridicule or scorn. Praise means to express approval, the opposite sense. Answer: (C) praise.

Concept: Odd-one-out by meaning: three near-synonyms and one antonym. Knowing that "deride" means ridicule is the only hurdle.

Q4MCQ1 mark · -1/3· Easy

Pick the odd one from the following options.

  1. (A)CADBE
  2. (B)JHKIL
  3. (C)XVYWZ
  4. (D)ONPMQ
Answer: D - show solution

Write letter positions. CADBE = 3,1,4,2,5: steps -2,+3,-2,+3. JHKIL = 10,8,11,9,12: -2,+3,-2,+3. XVYWZ = 24,22,25,23,26: -2,+3,-2,+3. ONPMQ = 15,14,16,13,17: -1,+2,-3,+4. Only ONPMQ breaks the pattern. Answer: (D) ONPMQ.

Concept: Letter-series pattern: convert letters to alphabet positions and compare the differences. Judging by the look of the letters instead of the step sizes is the trap.

Q5MCQ1 mark · -1/3· Easy

In a quadratic function, the value of the product of the roots (α, β) is 4. Find the value of (αⁿ + βⁿ) / (α⁻ⁿ + β⁻ⁿ)

  1. (A)n⁴
  2. (B)4ⁿ
  3. (C)2²ⁿ⁻¹
  4. (D)4ⁿ⁻¹
Answer: B - show solution

α⁻ⁿ + β⁻ⁿ = 1/αⁿ + 1/βⁿ = (αⁿ + βⁿ)/(αβ)ⁿ. So the ratio is (αⁿ + βⁿ) × (αβ)ⁿ/(αⁿ + βⁿ) = (αβ)ⁿ = 4ⁿ. Answer: (B) 4ⁿ.

Concept: Negative powers combine over the common denominator (αβ)ⁿ. Trying to find the actual roots is unnecessary and is the time trap.

Q6MCQ2 marks · -2/3· Easy

Among 150 faculty members in an institute, 55 are connected with each other through Facebook and 85 are connected through WhatsApp. 30 faculty members do not have Facebook or WhatsApp accounts. The number of faculty members connected only through Facebook accounts is ______________.

  1. (A)35
  2. (B)45
  3. (C)65
  4. (D)90
Answer: A - show solution

Faculty with at least one account = 150 - 30 = 120. By inclusion-exclusion, both = 55 + 85 - 120 = 20. Only Facebook = 55 - 20 = 35. Answer: (A) 35.

Concept: Two-set inclusion-exclusion. The traps are answering 55 (all Facebook users) or not removing the 30 with neither account first.

Q7MCQ2 marks · -2/3· Easy

Computers were invented for performing only high-end useful computations. However, it is no understatement that they have taken over our world today. The internet, for example, is ubiquitous. Many believe that the internet itself is an unintended consequence of the original invention. With the advent of mobile computing on our phones, a whole new dimension is now enabled. One is left wondering if all these developments are good or, more importantly, required. Which of the statement(s) below is/are logically valid and can be inferred from the above paragraph? (i) The author believes that computers are not good for us. (ii) Mobile computers and the internet are both intended inventions

  1. (A)(i) only
  2. (B)(ii) only
  3. (C)both (i) and (ii)
  4. (D)neither (i) nor (ii)
Answer: D - show solution

(i): the author only wonders whether the developments are good; no belief that computers are bad is stated, so (i) cannot be inferred. (ii): the passage says many believe the internet is an unintended consequence, which contradicts (ii). Neither follows. Answer: (D).

Concept: Inference versus over-reading. Raising a question is not asserting a conclusion, and a statement the passage contradicts cannot be inferred.

Q8MCQ2 marks · -2/3· Easy

All hill-stations have a lake. Ooty has two lakes. Which of the statement(s) below is/are logically valid and can be inferred from the above sentences? (i) Ooty is not a hill-station. (ii) No hill-station can have more than one lake.

  1. (A)(i) only
  2. (B)(ii) only
  3. (C)both (i) and (ii)
  4. (D)neither (i) nor (ii)
Answer: D - show solution

"All hill-stations have a lake" means at least one lake; it does not limit the number. So a hill-station may have two lakes and (ii) does not follow. Ooty having two lakes is consistent with being a hill-station, so (i) does not follow either. Answer: (D).

Concept: Reading "have a lake" as "exactly one lake" is the trap. Neither conclusion is forced by the premises.

Q9MCQ2 marks · -2/3· Easy

In a 2 × 4 rectangle grid shown below, each cell is a rectangle. How many rectangles can be observed in the grid? (The grid has 2 rows and 4 columns of cells, formed by 3 horizontal lines and 5 vertical lines.)

  1. (A)21
  2. (B)27
  3. (C)30
  4. (D)36
Answer: C - show solution

A rectangle is fixed by choosing 2 of the 3 horizontal lines and 2 of the 5 vertical lines. Count = C(3,2) × C(5,2) = 3 × 10 = 30. Answer: (C) 30.

Concept: Rectangles in an m × n grid: C(m+1,2) × C(n+1,2). The trap is counting only the 8 cells or missing multi-cell rectangles.

Q10MCQ2 marks · -2/3· Easy

The graph of f(x) is made of two straight segments: it rises from the point (-3, -2) to a peak at (1, 2), then falls to the point (3, 0). Choose the correct expression for f(x) given in the graph.

  1. (A)f(x) = 1 - |x - 1|
  2. (B)f(x) = 1 + |x - 1|
  3. (C)f(x) = 2 - |x - 1|
  4. (D)f(x) = 2 + |x - 1|
Answer: C - show solution

The graph is an inverted V with its peak at x = 1, so f(x) = k - |x - 1| with k = f(1) = 2. Check: f(-3) = 2 - 4 = -2 and f(3) = 2 - 2 = 0, both match. Answer: (C) f(x) = 2 - |x - 1|.

Concept: Reading an absolute-value graph: the vertex gives the shift and height, and a downward V means a minus sign. Options with + |x - 1| open upward.

Q11NAT1 mark · no negative· Easy

Consider the following expressions: (i) false (ii) Q (iii) true (iv) P ∨ Q (v) ¬Q ∨ P The number of expressions given above that are logically implied by P ∧ (P ⇒ Q) is ______.

Answer: 4 - show solution

P ∧ (P ⇒ Q) ≡ P ∧ Q, so P and Q are both true whenever the premise holds. false - not implied; Q - implied; true - implied (everything implies true); P ∨ Q - implied; ¬Q ∨ P - implied since P is true. Count = 4. Answer: 4.

Concept: A implies B when B is true in every model of A. P ∧ (P ⇒ Q) is modus ponens, giving P ∧ Q. Forgetting that "true" is implied by everything is the usual slip.

Q12NAT1 mark · no negative· Moderate

Let f(x) be a polynomial and g(x) = f′(x) be its derivative. If the degree of (f(x) + f(-x)) is 10, then the degree of (g(x) - g(-x)) is ______.

Answer: 9 - show solution

f(x) + f(-x) keeps only the even-power terms of f (doubled), so the highest even power in f is x¹⁰. g(x) - g(-x) keeps only the odd-power terms of g = f′. Odd powers of f′ come from even powers of f: x¹⁰ gives 10x⁹, and a higher odd term in g would need a higher even term in f, which does not exist. Degree = 9. Answer: 9.

Concept: f(x)+f(-x) isolates even terms, g(x)-g(-x) isolates odd terms, and differentiation maps even powers to odd ones. The trap is assuming f itself has degree 10.

Q13NAT1 mark · no negative· Easy

The minimum number of colours that is sufficient to vertex-colour any planar graph is ______.

Answer: 4 - show solution

By the Four Colour Theorem every planar graph is 4-colourable, and K4 is planar and needs 4 colours, so 4 is sufficient for all planar graphs and cannot be lowered. Answer: 4.

Concept: Four Colour Theorem. Confusing it with the Five Colour Theorem, or with 3 colours that suffice only for special classes, is the usual mistake.

Q14MCQ1 mark · -1/3· Easy

Consider the systems, each consisting of m linear equations in n variables. I. If m < n, then all such systems have a solution II. If m > n, then none of these systems has a solution III. If m = n, then there exists a system which has a solution Which one of the following is CORRECT?

  1. (A)I, II and III are true
  2. (B)Only II and III are true
  3. (C)Only III is true
  4. (D)None of them is true
Answer: C - show solution

I is false: with m < n a system can still be inconsistent, e.g. x + y + z = 1 and x + y + z = 2. II is false: an overdetermined system can be consistent, e.g. x = 1, 2x = 2, 3x = 3. III is true: the homogeneous system with m = n always has the zero solution. Only III holds. Answer: (C).

Concept: Consistency depends on ranks, not on comparing m and n. Underdetermined does not mean solvable; overdetermined does not mean unsolvable.

Q15NAT1 mark · no negative· Easy

Suppose that a shop has an equal number of LED bulbs of two different types. The probability of an LED bulb lasting more than 100 hours given that it is of Type 1 is 0.7, and given that it is of Type 2 is 0.4. The probability that an LED bulb chosen uniformly at random lasts more than 100 hours is ______.

Answer: 0.55 - show solution

Equal numbers of each type, so P(T1) = P(T2) = 0.5. By total probability, P(lasts > 100 h) = 0.5 × 0.7 + 0.5 × 0.4 = 0.35 + 0.20 = 0.55. Answer: 0.55.

Concept: Law of total probability over a partition. With an unequal mix a plain average would be wrong; here the mix is equal, so the weighted and plain averages coincide.

Q16NAT1 mark · no negative· Easy

Suppose that the eigenvalues of matrix A are 1, 2, 4. The determinant of (A⁻¹)ᵀ is ______.

Answer: 0.124 to 0.126 - show solution

det A = product of eigenvalues = 1 × 2 × 4 = 8. Transposing does not change a determinant, and det(A⁻¹) = 1/det A. So det((A⁻¹)ᵀ) = 1/8 = 0.125. Answer: 0.125 (accepted range 0.124 to 0.126).

Concept: Determinant = product of eigenvalues; det(Aᵀ) = det A; det(A⁻¹) = 1/det A. The trap is answering 8 by forgetting the inverse.

Q17NAT1 mark · no negative· Moderate

Consider an eight-bit ripple-carry adder for computing the sum of A and B, where A and B are integers represented in 2's complement form. If the decimal value of A is one, the decimal value of B that leads to the longest latency for the sum to stabilize is ______.

Answer: -1 - show solution

A = 1 = 00000001. Latency is longest when a carry generated at bit 0 propagates through all eight stages, which needs every bit of B to be 1 so each stage passes the carry on: B = 11111111. In 2's complement that is -1, and 1 + (-1) ripples a carry from bit 0 to bit 7. Answer: -1.

Concept: Ripple-carry worst case is a full carry chain: generate at the LSB, propagate everywhere else. The trap is answering 255 or 127 without reading 11111111 as a 2's complement value.

Q18MCQ1 mark · -1/3· Moderate

Let x₁ ⊕ x₂ ⊕ x₃ ⊕ x₄ = 0 where x₁, x₂, x₃, x₄ are Boolean variables, and ⊕ is the XOR operator. Which one of the following must always be TRUE?

  1. (A)x₁x₂x₃x₄ = 0
  2. (B)x₁x₃ + x₂ = 0
  3. (C)x̄₁ ⊕ x̄₃ = x̄₂ ⊕ x̄₄
  4. (D)x₁ + x₂ + x₃ + x₄ = 0
Answer: C - show solution

x₁ ⊕ x₂ ⊕ x₃ ⊕ x₄ = 0 means x₁ ⊕ x₃ = x₂ ⊕ x₄. Complementing both inputs of an XOR leaves it unchanged (x̄ ⊕ ȳ = x ⊕ y), so x̄₁ ⊕ x̄₃ = x₁ ⊕ x₃ = x₂ ⊕ x₄ = x̄₂ ⊕ x̄₄. All xᵢ = 1 satisfies the premise but breaks (A), (B) and (D). Answer: (C).

Concept: XOR as parity (an even number of 1s). Rearranging XOR terms plus the identity x̄ ⊕ ȳ = x ⊕ y settles it; all-ones is the quick counterexample for the rest.

Q19NAT1 mark · no negative· Easy

Let X be the number of distinct 16-bit integers in 2's complement representation. Let Y be the number of distinct 16-bit integers in sign magnitude representation. Then X -Y is ______.

Answer: 1 - show solution

In 16-bit 2's complement every bit pattern is a distinct integer: X = 2¹⁶. Sign-magnitude has two zeros (+0 and -0), so Y = 2¹⁶ - 1 distinct integers. X - Y = 1. Answer: 1.

Concept: Sign-magnitude (and 1's complement) spend one pattern on negative zero; 2's complement does not. Counting patterns instead of distinct values gives the wrong answer 0.

Q20NAT1 mark · no negative· Easy

A processor has 40 distinct instructions and 24 general purpose registers. A 32-bit instruction word has an opcode, two register operands and an immediate operand. The number of bits available for the immediate operand field is ______.

Answer: 16 - show solution

40 instructions need ceil(log₂ 40) = 6 opcode bits. 24 registers need ceil(log₂ 24) = 5 bits each, so two register fields take 10 bits. Immediate = 32 - 6 - 10 = 16 bits. Answer: 16.

Concept: Instruction-format sizing with the ceiling of log₂. The trap is using 4 bits for 24 registers or 5 bits for 40 opcodes.

Q21NAT1 mark · no negative· Easy

Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex t at a distance four from the root. If t is the n-th vertex in this BFS traversal, then the maximum possible value of n is ______.

Answer: 31 - show solution

BFS visits level by level. To make t as late as possible, levels 0 to 3 are full and t is the last vertex of a full level 4. Vertices before level 4: 1 + 2 + 4 + 8 = 15; level 4 holds at most 16. So t can be vertex 15 + 16 = 31. Answer: 31.

Concept: BFS order on a tree is level order. A complete binary tree maximises the position of a depth-4 vertex: 2⁵ - 1. Off-by-one errors on the number of levels are the usual trap.

Q22NAT1 mark · no negative· Easy

The value printed by the following program is ______.

void f(int* p, int m){
   m = m + 5;
   *p = *p + m;
   return;
}

void main(){
   int i=5, j=10;

   f(&i, j);
   printf("%d", i+j);
}
Answer: 30 - show solution

j is passed by value, i by address. Inside f, m = 10 + 5 = 15 (a local copy) and *p = 5 + 15 = 20, so i becomes 20 while j stays 10. Printed value = 20 + 10 = 30. Answer: 30.

Concept: Call by value versus passing a pointer: changing m does not affect j, writing through p does change i. Adding 5 to j as well (35) is the trap.

Q24MCQ1 mark · -1/3· Easy

The Floyd-Warshall algorithm for all-pair shortest paths computation is based on

  1. (A)Greedy paradigm.
  2. (B)Divide-and-Conquer paradigm.
  3. (C)Dynamic Programming paradigm.
  4. (D)neither Greedy nor Divide-and-Conquer nor Dynamic Programming paradigm.
Answer: C - show solution

Floyd-Warshall computes d_k(i,j), the shortest path using only intermediate vertices from {1..k}, from the k - 1 table: d_k(i,j) = min(d_(k-1)(i,j), d_(k-1)(i,k) + d_(k-1)(k,j)). Overlapping subproblems solved bottom-up in a table is dynamic programming. Answer: (C) Dynamic Programming paradigm.

Concept: Floyd-Warshall and Bellman-Ford are DP; Dijkstra and Prim are greedy. The recurrence over growing sets of allowed intermediate vertices is the giveaway.

Q25MCQ1 mark · -1/3· Moderate

N items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on which the operation is to be performed. An algorithm performs the following operations on the list in this order: Θ(N) delete, O(log N) insert, O(log N) find, and Θ(N) decrease-key. What is the time complexity of all these operations put together?

  1. (A)O(log² N)
  2. (B)O(N)
  3. (C)O(N²)
  4. (D)Θ(N² log N)
Answer: C - show solution

Delete with a pointer in a doubly linked list is O(1), so Θ(N) deletes cost O(N). Insert into a sorted list needs a linear scan, O(N) each: O(N log N) total. Find is also O(N) each: O(N log N). Decrease-key must move the node backward to keep the order, O(N) each, and Θ(N) of them cost O(N²). Total O(N²). Answer: (C) O(N²).

Concept: Per-operation costs on a sorted doubly linked list: pointer deletes are O(1), searching and repositioning are linear. The Θ(N) decrease-keys dominate.

Q26NAT1 mark · no negative· Easy

The number of states in the minimum sized DFA that accepts the language defined by the regular expression (0 + 1)*(0 + 1)(0 + 1)* is ______.

Answer: 2 - show solution

(0 + 1)*(0 + 1)(0 + 1)* is every string with at least one symbol, i.e. all non-empty strings over {0, 1}. The DFA needs a non-accepting start state (seen nothing) and one accepting state reached on any symbol, which loops on 0 and 1. The two states are distinguishable by the empty string. Answer: 2.

Concept: Simplify the regular expression before building the automaton: it is just Σ⁺. A DFA for Σ⁺ needs 2 states. Counting the three factors as three states is the trap.

Q27MCQ1 mark · -1/3· Easy

Language L₁ is defined by the grammar: S₁ → aS₁b | ε Language L₂ is defined by the grammar: S₂ → abS₂ | ε Consider the following statements: P: L₁ is regular Q: L₂ is regular Which one of the following is TRUE?

  1. (A)Both P and Q are true
  2. (B)P is true and Q is false
  3. (C)P is false and Q is true
  4. (D)Both P and Q are false
Answer: C - show solution

L₁ = {aⁿbⁿ : n ≥ 0}, which needs unbounded counting and is not regular (pumping lemma). L₂ = (ab)*, a regular expression, so it is regular; the grammar is right-linear. So P is false and Q is true. Answer: (C).

Concept: Recognise the language behind the grammar. Self-embedding (aSb) gives aⁿbⁿ; a right-linear rule (abS) gives a regular language. Judging only by "it is a CFG" is the trap.

Q28MCQ1 mark · -1/3· Moderate

Consider the following types of languages: L₁: Regular, L₂: Context-free, L₃: Recursive, L₄: Recursively enumerable. Which of the following is/are TRUE? I. L̄₃ ∪ L₄ is recursively enumerable II. L̄₂ ∪ L₃ is recursive III. L₁* ∩ L₂ is context-free IV. L₁ ∪ L̄₂ is context-free (L̄ denotes the complement of L.)

  1. (A)I only
  2. (B)I and III only
  3. (C)I and IV only
  4. (D)I, II and III only
Answer: D - show solution

I: recursive languages are closed under complement, so L̄₃ is recursive, hence RE; RE is closed under union, so true. II: every CFL is recursive, so L̄₂ is recursive; recursive ∪ recursive is recursive, true. III: L₁* is regular, and regular ∩ CFL is context-free, true. IV: CFLs are not closed under complement, so L̄₂ need not be context-free and the union need not be either; false. Answer: (D) I, II and III only.

Concept: Closure properties across the Chomsky hierarchy. Key facts: recursive is closed under complement, CFL is not; CFL ∩ regular is CFL; every CFL is recursive.

Q29MCQ1 mark · -1/3· Easy

Match the following: (P) Lexical analysis (i) Leftmost derivation (Q) Top down parsing (ii) Type checking (R) Semantic analysis (iii) Regular expressions (S) Runtime environments (iv) Activation records

  1. (A)P ↔ i, Q ↔ ii, R ↔ iv, S ↔ iii
  2. (B)P ↔ iii, Q ↔ i, R ↔ ii, S ↔ iv
  3. (C)P ↔ ii, Q ↔ iii, R ↔ i, S ↔ iv
  4. (D)P ↔ iv, Q ↔ i, R ↔ ii, S ↔ iii
Answer: B - show solution

Tokens are specified by regular expressions (P-iii). Top-down parsers build a leftmost derivation (Q-i). Type checking is part of semantic analysis (R-ii). Runtime environments manage activation records on the stack (S-iv). Answer: (B).

Concept: Compiler phases and their core tools. Top-down gives leftmost derivation; bottom-up gives a rightmost derivation in reverse.

Q30MCQ1 mark · -1/3· Easy

In which one of the following page replacement algorithms it is possible for the page fault rate to increase even when the number of allocated frames increases?

  1. (A)LRU (Least Recently Used)
  2. (B)OPT (Optimal Page Replacement)
  3. (C)MRU (Most Recently Used)
  4. (D)FIFO (First In First Out)
Answer: D - show solution

LRU and OPT are stack algorithms: the pages held with k frames are always a subset of those held with k + 1 frames, so faults never increase with more frames. FIFO is not a stack algorithm and shows Belady's anomaly, e.g. reference string 1,2,3,4,1,2,5,1,2,3,4,5 gives 9 faults with 3 frames and 10 with 4. Answer: (D) FIFO.

Concept: Belady's anomaly affects FIFO, not stack algorithms such as LRU and OPT.

Q31MCQ1 mark · -1/3· Easy

B+ Trees are considered BALANCED because

  1. (A)the lengths of the paths from the root to all leaf nodes are all equal.
  2. (B)the lengths of the paths from the root to all leaf nodes differ from each other by at most 1.
  3. (C)the number of children of any two non-leaf sibling nodes differ by at most 1.
  4. (D)the number of records in any two leaf nodes differ by at most 1.
Answer: A - show solution

B+ tree insertion and deletion split, merge or redistribute nodes and only grow or shrink the tree at the root, so every leaf is always at the same depth. That equal root-to-leaf path length is what "balanced" means here. Node occupancy is bounded (at least half full) but not within 1 of a sibling. Answer: (A).

Concept: B and B+ trees are perfectly height-balanced: all leaves at one level. The "differ by at most 1" option describes AVL trees, which is the trap.

Q32MCQ1 mark · -1/3· Easy

Suppose a database schedule S involves transactions T₁, ..., Tₙ. Construct the precedence graph of S with vertices representing the transactions and edges representing the conflicts. If S is serializable, which one of the following orderings of the vertices of the precedence graph is guaranteed to yield a serial schedule?

  1. (A)Topological order
  2. (B)Depth-first order
  3. (C)Breadth-first order
  4. (D)Ascending order of transaction indices
Answer: A - show solution

A schedule is conflict serializable exactly when its precedence graph is acyclic. Each edge Ti → Tj means Ti must come before Tj in an equivalent serial schedule, so any topological order of the graph gives a valid serial order. DFS or BFS order, or index order, can violate an edge. Answer: (A) Topological order.

Concept: Conflict serializability test: acyclic precedence graph, serial order = topological sort. Assuming T1, T2, ... index order is the trap.

Q33MCQ1 mark · -1/3· Easy

Anarkali digitally signs a message and sends it to Salim. Verification of the signature by Salim requires

  1. (A)Anarkali's public key.
  2. (B)Salim's public key.
  3. (C)Salim's private key.
  4. (D)Anarkali's private key.
Answer: A - show solution

Anarkali signs with her own private key. Anyone can verify the signature with the matching public key, so Salim uses Anarkali's public key. Salim's keys play no role in a signature. Answer: (A).

Concept: Digital signatures: sign with the sender's private key, verify with the sender's public key. Encryption for confidentiality is the reverse (receiver's public key), which is the usual mix-up.

Q34MCQ1 mark · -1/3· Easy

In an Ethernet local area network, which one of the following statements is TRUE?

  1. (A)A station stops to sense the channel once it starts transmitting a frame.
  2. (B)The purpose of the jamming signal is to pad the frames that are smaller than the minimum frame size.
  3. (C)A station continues to transmit the packet even after the collision is detected.
  4. (D)The exponential backoff mechanism reduces the probability of collision on retransmissions.
Answer: D - show solution

(A) is false: CSMA/CD keeps sensing while transmitting in order to detect collisions. (B) is false: the jam signal tells all stations a collision occurred; padding is a separate field. (C) is false: the station aborts transmission on detecting a collision. (D) is true: binary exponential backoff widens the random wait range after each collision, reducing the chance of colliding again. Answer: (D).

Concept: CSMA/CD mechanics: listen while talking, abort and jam on collision, then back off exponentially. Confusing the jam signal with padding is the trap.

Q35MCQ1 mark · -1/3· Easy

Identify the correct sequence in which the following packets are transmitted on the network by a host when a browser requests a webpage from a remote server, assuming that the host has just been restarted.

  1. (A)HTTP GET request, DNS query, TCP SYN
  2. (B)DNS query, HTTP GET request, TCP SYN
  3. (C)DNS query, TCP SYN, HTTP GET request
  4. (D)TCP SYN, DNS query, HTTP GET request
Answer: C - show solution

After a restart the DNS cache is empty, so the host first sends a DNS query to resolve the server name. With the IP address it opens a TCP connection, starting with SYN. Only after the handshake can the HTTP GET be sent over that connection. Answer: (C) DNS query, TCP SYN, HTTP GET request.

Concept: Order of protocols when fetching a page: resolve the name, connect, then request. "Just been restarted" rules out a cached DNS answer.

Q36MCQ2 marks · -2/3· Moderate

A binary relation R on ℕ × ℕ is defined as follows: (a, b)R(c, d) if a ≤ c or b ≤ d. Consider the following propositions: P: R is reflexive Q: R is transitive Which one of the following statements is TRUE?

  1. (A)Both P and Q are true.
  2. (B)P is true and Q is false.
  3. (C)P is false and Q is true.
  4. (D)Both P and Q are false.
Answer: B - show solution

Reflexive: (a, b)R(a, b) since a ≤ a. So P is true. Transitive: take (5, 5)R(1, 6) because 5 ≤ 6, and (1, 6)R(2, 1) because 1 ≤ 2. But (5, 5)R(2, 1) fails since 5 > 2 and 5 > 1. So Q is false. Answer: (B) P is true and Q is false.

Concept: An "or" condition breaks transitivity: the two steps can be justified by different coordinates. One concrete counterexample is enough; the trap is assuming it behaves like a product order (which uses "and").

Q37MCQ2 marks · -2/3· Moderate

Which one of the following well-formed formulae in predicate calculus is NOT valid?

  1. (A)(∀x p(x) ⇒ ∀x q(x)) ⇒ (∃x ¬p(x) ∨ ∀x q(x))
  2. (B)(∃x p(x) ∨ ∃x q(x)) ⇒ ∃x (p(x) ∨ q(x))
  3. (C)∃x (p(x) ∧ q(x)) ⇒ (∃x p(x) ∧ ∃x q(x))
  4. (D)∀x (p(x) ∨ q(x)) ⇒ (∀x p(x) ∨ ∀x q(x))
Answer: D - show solution

(A): ∀x p(x) ⇒ ∀x q(x) ≡ ¬∀x p(x) ∨ ∀x q(x) ≡ ∃x ¬p(x) ∨ ∀x q(x), so it is a tautology. (B): ∃ distributes over ∨, valid. (C): a witness for p ∧ q is a witness for each, valid. (D): over the integers let p = "even", q = "odd". Every x is even or odd, but neither "all even" nor "all odd" holds, so (D) is not valid. Answer: (D).

Concept: ∀ distributes over ∧ and ∃ over ∨; the reverse directions (∀ over ∨, ∃ over ∧) hold only one way. A two-predicate counterexample such as even/odd settles it.

Q38MCQ2 marks · -2/3· Moderate

Consider a set U of 23 different compounds in a Chemistry lab. There is a subset S of U of 9 compounds, each of which reacts with exactly 3 compounds of U. Consider the following statements: I. Each compound in U \ S reacts with an odd number of compounds. II. At least one compound in U \ S reacts with an odd number of compounds. III. Each compound in U \ S reacts with an even number of compounds. Which one of the above statements is ALWAYS TRUE?

  1. (A)Only I
  2. (B)Only II
  3. (C)Only III
  4. (D)None
Answer: B - show solution

Model compounds as vertices and reactions as edges. The degree sum is even (handshaking lemma). The 9 compounds in S contribute 9 × 3 = 27, an odd number, so the degrees in U \ S must sum to an odd number, which forces at least one vertex in U \ S to have odd degree. That proves II. I and III are not forced: the 14 vertices in U \ S can have a mix of odd and even degrees. Answer: (B) Only II.

Concept: Handshaking lemma: the number of odd-degree vertices is even. Here S already has 9 odd vertices, so U \ S must hold an odd number of odd vertices, at least one.

Q39NAT2 marks · no negative· Moderate

The value of the expression 13⁹⁹ (mod 17), in the range 0 to 16, is ______.

Answer: 4 - show solution

13 ≡ -4 (mod 17). (-4)² = 16 ≡ -1, so (-4)⁴ ≡ 1. 99 = 4 × 24 + 3, so 13⁹⁹ ≡ (-4)³ = -64 ≡ -64 + 68 = 4 (mod 17). Answer: 4.

Concept: Modular exponentiation: find a small power that is ±1 (order of the element), then reduce the exponent. Fermat (exponent mod 16) also works: 99 mod 16 = 3.

Q40NAT2 marks · no negative· Moderate

Suppose the functions F and G can be computed in 5 and 3 nanoseconds by functional units U_F and U_G, respectively. Given two instances of U_F and two instances of U_G, it is required to implement the computation F(G(Xᵢ)) for 1 ≤ i ≤ 10. Ignoring all other delays, the minimum time required to complete this computation is ______ nanoseconds.

Answer: 28 - show solution

Each F needs its G result first. Pair one U_G with one U_F as a two-stage pipeline and run two such pipelines, 5 items each. The F stage (5 ns) is the bottleneck, so the U_G work stays ahead. In one pipeline: first G finishes at 3 ns, then the 5 F computations run back to back, ending at 3 + 5 × 5 = 28 ns. Both pipelines run in parallel. Answer: 28.

Concept: Pipelining with a slow stage: total time = fill time of earlier stages + (number of items × bottleneck time). Simply adding 10 × 8 / 2 = 40 ignores the overlap.

Q41NAT2 marks · no negative· Easy

Consider a processor with 64 registers and an instruction set of size twelve. Each instruction has five distinct fields, namely, opcode, two source register identifiers, one destination register identifier, and a twelve-bit immediate value. Each instruction must be stored in memory in a byte-aligned fashion. If a program has 100 instructions, the amount of memory (in bytes) consumed by the program text is ______.

Answer: 500 - show solution

Opcode for 12 instructions: 4 bits. Each register identifier for 64 registers: 6 bits, three of them: 18 bits. Immediate: 12 bits. Total 4 + 18 + 12 = 34 bits, which needs 5 bytes when byte-aligned. 100 instructions × 5 bytes = 500 bytes. Answer: 500.

Concept: Byte alignment rounds each instruction up to whole bytes: 34 bits becomes 40. Answering 425 (34 × 100 / 8) ignores the alignment.

Q42NAT2 marks · no negative· Moderate

The width of the physical address on a machine is 40 bits. The width of the tag field in a 512 KB 8-way set associative cache is ______ bits.

Answer: 24 - show solution

Cache size 512 KB = 2¹⁹ bytes. With block size 2ᵇ, the number of sets is 2¹⁹ / (8 × 2ᵇ) = 2¹⁶⁻ᵇ, so index + offset = (16 - b) + b = 16 bits whatever the block size. Tag = 40 - 16 = 24 bits. Answer: 24.

Concept: Tag width depends only on address width, cache size and associativity: tag = address bits - log₂(cache size / ways). The block size cancels, which is why it was not given.

Q43NAT2 marks · no negative· Moderate

Consider a 3 GHz (gigahertz) processor with a three-stage pipeline and stage latencies τ₁, τ₂, and τ₃ such that τ₁ = 3τ₂/4 = 2τ₃. If the longest pipeline stage is split into two pipeline stages of equal latency, the new frequency is ______ GHz, ignoring delays in the pipeline registers.

Answer: 3.9 to 4.1 - show solution

Let τ₁ = 6k. Then τ₂ = 8k and τ₃ = 3k. The clock is set by the longest stage τ₂ = 8k = 1/3 ns, so k = 1/24 ns. Splitting τ₂ gives two 4k stages; the longest stage is now τ₁ = 6k = 0.25 ns. New frequency = 1/0.25 ns = 4 GHz. Answer: 4 (accepted range 3.9 to 4.1).

Concept: Pipeline clock period equals the slowest stage. After splitting, the bottleneck moves to the next longest stage; assuming the frequency doubles to 6 GHz is the trap.

Q44NAT2 marks · no negative· Moderate

A complete binary min-heap is made by including each integer in [1, 1023] exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth 0. The maximum depth at which integer 9 can appear is ______.

Answer: 8 - show solution

In a min-heap every ancestor of a node holds a smaller key. Only 1 to 8 are smaller than 9, so 9 can have at most 8 ancestors, i.e. depth at most 8. This is achievable: place 1, 2, ..., 8 along one root-to-node path at depths 0 to 7 and 9 below at depth 8. The heap of 1023 nodes has depths 0 to 9, so depth 8 exists. Answer: 8.

Concept: Heap order bounds depth by the number of smaller keys. Also check that the tree is deep enough (1023 nodes give depth 9). Answering 9 forgets that only eight keys are smaller.

Q45MCQ2 marks · -2/3· Moderate

The following function computes Xʸ for positive integers X and Y. Which one of the following conditions is TRUE before every iteration of the loop?

int exp(int X, int Y) {
    int res = 1, a = X, b = Y;

    while ( b != 0 ){
        if ( b%2 == 0) { a = a*a; b = b/2; }
        else           { res = res*a; b = b-1; }
    }
    return res;
}
  1. (A)Xʸ = aᵇ
  2. (B)(res * a)ʸ = (res * X)ᵇ
  3. (C)Xʸ = res * aᵇ
  4. (D)Xʸ = (res * a)ᵇ
Answer: C - show solution

Initially res = 1, a = X, b = Y, so res × aᵇ = Xʸ. Even b: a becomes a², b becomes b/2, and (a²)^(b/2) = aᵇ, so res × aᵇ is unchanged. Odd b: res becomes res × a and b becomes b - 1, and (res × a) × a^(b-1) = res × aᵇ, unchanged. So Xʸ = res × aᵇ holds before every iteration, and at b = 0 it gives res = Xʸ. (A) fails once res changes. Answer: (C).

Concept: Loop invariant for fast exponentiation: the quantity res × aᵇ stays equal to Xʸ. Check initialisation and preservation for both branches.

Q46MCQ2 marks · -2/3· Moderate

Consider the following New-order strategy for traversing a binary tree: - Visit the root; - Visit the right subtree using New-order; - Visit the left subtree using New-order; The New-order traversal of the expression tree corresponding to the reverse polish expression 3 4 * 5 - 2 ^ 6 7 * 1 + - is given by:

  1. (A)+ - 1 6 7 * 2 ^ 5 - 3 4 *
  2. (B)- + 1 * 6 7 ^ 2 - 5 * 3 4
  3. (C)- + 1 * 7 6 ^ 2 - 5 * 4 3
  4. (D)1 7 6 * + 2 5 4 3 * - ^ -
Answer: C - show solution

Evaluate the RPN to get the tree: ((3 * 4) - 5) ^ 2 is the left operand and (6 * 7) + 1 the right operand of the root "-". New-order is root, right, left. Root: -. Right subtree "+": +, then its right 1, then its left "*": * 7 6. Left subtree "^": ^, its right 2, its left "-": -, then 5, then "*": * 4 3. Sequence: - + 1 * 7 6 ^ 2 - 5 * 4 3. Answer: (C).

Concept: Build the expression tree from postfix with a stack, then apply the custom order. New-order is the reverse of postorder. Option (B) swaps the order inside the leaf pairs, the usual slip.

Q47NAT2 marks · no negative· Easy

Consider the following program: Note: max(x,y) returns the maximum of x and y. The value printed by this program is ______.

int f(int *p, int n)
{
   if (n <= 1) return 0;
   else return max(f(p+1,n-1),p[0]-p[1]);
}

int main()
{
   int a[] = {3,5,2,6,4};
   printf("%d", f(a,5));
}
Answer: 3 - show solution

f returns the maximum of p[i] - p[i+1] over adjacent pairs, and 0 from the base case. Differences: 3 - 5 = -2, 5 - 2 = 3, 2 - 6 = -4, 6 - 4 = 2. Maximum of {0, -2, 3, -4, 2} = 3. Answer: 3.

Concept: Recognise what the recursion computes: the largest drop between adjacent elements, floored at 0. Reading p[0]-p[1] as p[1]-p[0] gives 4, the trap.

Q48NAT2 marks · no negative· Moderate

Let A₁, A₂, A₃, and A₄ be four matrices of dimensions 10 × 5, 5 × 20, 20 × 10, and 10 × 5, respectively. The minimum number of scalar multiplications required to find the product A₁A₂A₃A₄ using the basic matrix multiplication method is ______.

Answer: 1500 - show solution

Dimensions p = 10, 5, 20, 10, 5. Pairs: A₁A₂ = 1000, A₂A₃ = 1000, A₃A₄ = 1000. Triples: A₁..A₃ = min(1000 + 10·20·10, 1000 + 10·5·10) = 1500; A₂..A₄ = min(1000 + 5·10·5, 1000 + 5·20·5) = 1250. Full: split after A₁: 1250 + 10·5·5 = 1500; after A₂: 1000 + 1000 + 10·20·5 = 3000; after A₃: 1500 + 10·10·5 = 2000. Minimum 1500, from A₁((A₂A₃)A₄). Answer: 1500.

Concept: Matrix chain multiplication DP: m[i][j] = min over k of m[i][k] + m[k+1][j] + pᵢ₋₁pₖpⱼ. Greedy left-to-right order is not optimal.

Q49NAT2 marks · no negative· Moderate

The given diagram shows the flowchart for a recursive function A(n). Assume that all statements, except for the recursive calls, have O(1) time complexity. If the worst case time complexity of this function is O(n^α), then the least possible value (accurate up to two decimal positions) of α is ______. Flowchart (described in words): Start, then call A(n/2), then decision 1. - Decision 1, one branch: call A(n/2), then Return. - Decision 1, other branch: call A(n/2), call A(n/2), then decision 2. - Decision 2, one branch: Return. - Decision 2, other branch: call A(n/2), then decision 3. - Decision 3, one branch: call A(n/2), then Return. - Decision 3, other branch: Return.

Answer: 2.2 to 2.4 - show solution

Count recursive calls on the longest path: 1 (before decision 1) + 2 (decision 1 right branch) + 1 (after decision 2) + 1 (decision 3 call) = 5 calls of A(n/2). Worst case T(n) = 5T(n/2) + O(1). By the master theorem T(n) = Θ(n^(log₂ 5)), and log₂ 5 ≈ 2.32. Answer: 2.32 (accepted range 2.2 to 2.4).

Concept: Worst-case path through branching code determines the recurrence. With a = 5, b = 2 and constant extra work, the master theorem gives n^(log₂ 5). Counting all calls in the chart (6) instead of one path is the trap.

Q50NAT2 marks · no negative· Moderate

The number of ways in which the numbers 1, 2, 3, 4, 5, 6, 7 can be inserted in an empty binary search tree, such that the resulting tree has height 6, is ______. Note: The height of a tree with a single node is 0.

Answer: 64 - show solution

7 nodes with height 6 means the tree is a single path. Each inserted key must be either the smallest or the largest of the keys still to be inserted, otherwise some later key would branch off. The last key is forced, and each of the first 6 insertions has 2 choices (current min or current max). Count = 2⁶ = 64. Answer: 64.

Concept: A degenerate (path) BST arises when each new key is an extreme of the remaining keys. Counting only fully sorted orders (2 ways) misses the zig-zag paths.

Q51MCQ2 marks · -2/3· Moderate

In an adjacency list representation of an undirected simple graph G = (V, E), each edge (u, v) has two adjacency list entries: [v] in the adjacency list of u, and [u] in the adjacency list of v. These are called twins of each other. A twin pointer is a pointer from an adjacency list entry to its twin. If |E| = m and |V| = n, and the memory size is not a constraint, what is the time complexity of the most efficient algorithm to set the twin pointer in each entry in each adjacency list?

  1. (A)Θ(n²)
  2. (B)Θ(n + m)
  3. (C)Θ(m²)
  4. (D)Θ(n⁴)
Answer: B - show solution

Memory is unlimited, so keep an n × n table of entry pointers (allocated without initialising, or with the standard O(1)-initialisation trick). Pass 1: for each vertex u and each entry [v] in its list, store a pointer to that entry at T[u][v]: O(n + m). Pass 2: for each entry [v] in u's list, set its twin to T[v][u]: O(n + m). Every list entry must be touched at least once, so Θ(n + m) is optimal. Answer: (B).

Concept: Unlimited memory permits direct addressing, turning lookups into O(1). Alternatively a radix-sort of the 2m (u, v) pairs also gives linear time. Initialising an n² table naively would cost Θ(n²), the trap behind (A).

Q52MCQ2 marks · -2/3· Moderate

Consider the following two statements: I. If all states of an NFA are accepting states then the language accepted by the NFA is Σ*. II. There exists a regular language A such that for all languages B, A ∩ B is regular. Which one of the following is CORRECT?

  1. (A)Only I is true
  2. (B)Only II is true
  3. (C)Both I and II are true
  4. (D)Both I and II are false
Answer: B - show solution

I is false: an NFA may have missing transitions, so a string with no run simply dies. E.g. a one-state accepting NFA over {a, b} with a self-loop only on a accepts a*, not Σ*. II is true: take A = ∅; then A ∩ B = ∅ for every B, which is regular (any finite A also works). Answer: (B) Only II.

Concept: NFAs (and partial DFAs) reject by having no run, not only by ending in a non-accepting state. For II, the empty language is the standard witness.

Q53MCQ2 marks · -2/3· Moderate

Consider the following languages: L₁ = {aⁿbᵐcⁿ⁺ᵐ : m, n ≥ 1} L₂ = {aⁿbⁿc²ⁿ : n ≥ 1} Which one of the following is TRUE?

  1. (A)Both L₁ and L₂ are context-free.
  2. (B)L₁ is context-free while L₂ is not context-free.
  3. (C)L₂ is context-free while L₁ is not context-free.
  4. (D)Neither L₁ nor L₂ is context-free.
Answer: B - show solution

L₁: a PDA pushes a symbol for each a and each b, then pops one for each c; acceptance when the stack empties exactly. Grammar: S → aSc | aBc, B → bBc | bc. So L₁ is context-free. L₂ needs the count of a to equal the count of b and also c to equal 2n, two dependent comparisons; pumping a string aᵖbᵖc²ᵖ cannot keep all three counts in ratio 1:1:2, so L₂ is not context-free. Answer: (B).

Concept: One stack can match one nested count (a and b against c) but not two independent equalities. aⁿbⁿc²ⁿ behaves like aⁿbⁿcⁿ, the classic non-CFL.

Q54MCQ2 marks · -2/3· Hard

Consider the following languages. L₁ = {⟨M⟩ | M takes at least 2016 steps on some input}, L₂ = {⟨M⟩ | M takes at least 2016 steps on all inputs} and L₃ = {⟨M⟩ | M accepts ε}, where for each Turing machine M, ⟨M⟩ denotes a specific encoding of M. Which one of the following is TRUE?

  1. (A)L₁ is recursive and L₂, L₃ are not recursive
  2. (B)L₂ is recursive and L₁, L₃ are not recursive
  3. (C)L₁, L₂ are recursive and L₃ is not recursive
  4. (D)L₁, L₂, L₃ are recursive
Answer: C - show solution

In 2016 steps M reads at most the first 2016 input symbols, so whether M runs at least 2016 steps on input w depends only on w's first 2016 symbols (inputs shorter than that are a finite set too). So simulate M for 2016 steps on every input of length at most 2016, a finite set: this decides both L₁ (some run lasts 2016 steps) and L₂ (all do). L₃ is a non-trivial semantic property of the language of M, undecidable by Rice's theorem. Answer: (C) L₁, L₂ recursive, L₃ not.

Concept: Step-bounded properties are decidable by bounded simulation, since only a finite prefix of input matters. Rice's theorem applies to properties of the language, not of running time; misapplying it to L₁ and L₂ is the trap.

Q55MCQ2 marks · -2/3· Moderate

Which one of the following grammars is free from left recursion?

  1. (A)S → AB A → Aa | b B → c
  2. (B)S → Ab | Bb | c A → Bd | ε B → e
  3. (C)S → Aa | B A → Bb | Sc | ε B → d
  4. (D)S → Aa | Bb | c A → Bd | ε B → Ae | ε
Answer: B - show solution

(A): A → Aa is immediate left recursion. (C): S → Aa and A → Sc give S ⇒ Aa ⇒ Sca, indirect left recursion. (D): A → Bd and B → Ae give A ⇒ Bd ⇒ Aed, indirect left recursion. (B): S starts with A, B or c; A starts with B or ε; B starts with e. No nonterminal can derive a sentential form starting with itself. Answer: (B).

Concept: Check indirect left recursion by following leftmost symbols through other rules, including through nullable prefixes. Looking only for A → A... misses (C) and (D).

Q56MCQ2 marks · -2/3· Moderate

A student wrote two context-free grammars G1 and G2 for generating a single C-like array declaration. The dimension of the array is at least one. For example, int a[10][3]; The grammars use D as the start symbol, and use six terminal symbols int ; id [ ] num. Grammar G1 Grammar G2 D → int L; D → int L; L → id [E L → id E E → num] E → E[num] E → num] [E E → [num] Which of the grammars correctly generate the declaration mentioned above?

  1. (A)Both G1 and G2
  2. (B)Only G1
  3. (C)Only G2
  4. (D)Neither G1 nor G2
Answer: A - show solution

G1: L → id [E and E → num] | num] [E generate id [num] followed by zero or more [num] groups, e.g. int id [num] [num] ; for int a[10][3];. G2: E → E[num] | [num] generates one or more [num] groups (left-recursive), so int id [num][num] ; is also produced. Both generate exactly the declarations with at least one dimension. Answer: (A) Both G1 and G2.

Concept: Grammars can split brackets across productions in unusual ways; derive a sample string to check. Left recursion (G2) does not make a grammar wrong, only unsuitable for top-down parsing.

Q57NAT2 marks · no negative· Moderate

Consider the following processes, with the arrival time and the length of the CPU burst given in milliseconds. The scheduling algorithm used is preemptive shortest remaining-time first. Process Arrival Time Burst Time P1 0 10 P2 3 6 P3 7 1 P4 8 3 The average turn around time of these processes is ______ milliseconds.

Answer: 8.2 to 8.3 - show solution

0-3: P1 runs (remaining 7). At 3, P2 (6) < 7, so P2 runs 3-7 (remaining 2). At 7, P3 (1) < 2, P3 runs 7-8 and finishes. At 8, remaining: P1 7, P2 2, P4 3; P2 runs 8-10 and finishes. P4 runs 10-13. P1 runs 13-20. Turnaround: P1 20 - 0 = 20, P2 10 - 3 = 7, P3 8 - 7 = 1, P4 13 - 8 = 5. Average = 33/4 = 8.25. Answer: 8.25 (accepted range 8.2 to 8.3).

Concept: SRTF re-evaluates at every arrival using remaining time, not original burst. Turnaround = completion - arrival. Using burst instead of remaining time at t = 7 is the trap.

Q58MCQ2 marks · -2/3· Easy

Consider the following two-process synchronization solution. The shared variable turn is initialized to zero. Which one of the following is TRUE?

Process 0                          Process 1
---------                          ----------
Entry: loop while (turn == 1);     Entry: loop while (turn == 0);
  (critical section)                 (critical section)
Exit:  turn = 1;                   Exit:  turn = 0;
  1. (A)This is a correct two-process synchronization solution.
  2. (B)This solution violates mutual exclusion requirement.
  3. (C)This solution violates progress requirement.
  4. (D)This solution violates bounded wait requirement.
Answer: C - show solution

Mutual exclusion holds: turn is either 0 or 1, letting only one process in. But the processes must strictly alternate. If turn = 0 and P0 does not want to enter, P1 is blocked even though the critical section is free; the decision depends on a process outside its critical section. That violates progress. Bounded waiting holds, since each waits at most one turn of the other. Answer: (C).

Concept: Strict alternation guarantees mutual exclusion and bounded waiting but fails progress. Peterson's algorithm adds flags to fix this.

Q59NAT2 marks · no negative· Easy

Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V (S) increments S. During an execution, 20 P(S) operations and 12 V (S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked is ______.

Answer: 7 - show solution

With initial value S₀, the 12 V operations make S₀ + 12 units available in total for the 20 P operations (in the most favourable order). All P operations can complete when S₀ + 12 ≥ 20, i.e. S₀ ≥ 8. At least one P must remain blocked when S₀ + 12 < 20, i.e. S₀ ≤ 7. Largest such value: 7. Answer: 7.

Concept: Count total resource supply against demand: initial value plus V operations versus P operations. Answering 8 confuses the threshold at which all P operations succeed.

Q60NAT2 marks · no negative· Moderate

A file system uses an in-memory cache to cache disk blocks. The miss rate of the cache is shown in the figure. The latency to read a block from the cache is 1 ms and to read a block from the disk is 10 ms. Assume that the cost of checking whether a block exists in the cache is negligible. Available cache sizes are in multiples of 10 MB. Miss rate from the figure: Cache size (MB): 10 20 30 40 50 60 70 80 Miss rate (%): 80 60 40 35 30 25 20 15 The smallest cache size required to ensure an average read latency of less than 6 ms is ______ MB.

Answer: 30 - show solution

Average latency = (1 - m) × 1 + m × 10 = 1 + 9m. Need 1 + 9m < 6, so m < 5/9 ≈ 55.6%. At 20 MB m = 60% gives 6.4 ms (too slow); at 30 MB m = 40% gives 4.6 ms. Even the alternative model (miss costs 1 + 10 ms, latency 1 + 10m) needs m < 50%, again first met at 30 MB. Answer: 30.

Concept: Effective access time with hits and misses, read off a miss-rate curve. Both common latency models give the same cache size here.

Q61MCQ2 marks · -2/3· Moderate

Consider the following database schedule with two transactions, T₁ and T₂. S = r₂(X); r₁(X); r₂(Y); w₁(X); r₁(Y); w₂(X); a₁; a₂ where rᵢ(Z) denotes a read operation by transaction Tᵢ on a variable Z, wᵢ(Z) denotes a write operation by Tᵢ on a variable Z and aᵢ denotes an abort by transaction Tᵢ. Which one of the following statements about the above schedule is TRUE?

  1. (A)S is non-recoverable
  2. (B)S is recoverable, but has a cascading abort
  3. (C)S does not have a cascading abort
  4. (D)S is strict
Answer: C - show solution

Neither transaction reads a value written by the other: r₂(X), r₁(X), r₂(Y), r₁(Y) all read original values, since the only writes are w₁(X) and w₂(X) and no read follows them. With no dirty reads, aborting T₁ forces no other abort, so there is no cascading abort (and the schedule is trivially recoverable, ruling out A and B). It is not strict: w₂(X) overwrites X written by T₁ before T₁ commits or aborts. Answer: (C).

Concept: Recoverable, cascadeless and strict differ by what may follow an uncommitted write: a read (cascadeless forbids) or any read or write (strict forbids). A blind overwrite breaks strictness but not cascadelessness.

Q62NAT2 marks · no negative· Easy

Consider the following database table named water_schemes: scheme_no district_name capacity 1 Ajmer 20 1 Bikaner 10 2 Bikaner 10 3 Bikaner 20 1 Churu 10 2 Churu 20 1 Dungargarh 10 The number of tuples returned by the following SQL query is ______.

with total(name, capacity) as
    select district_name, sum(capacity)
    from water_schemes
    group by district_name
with total_avg(capacity) as
    select avg(capacity)
    from total
select name
    from total, total_avg
    where total.capacity >= total_avg.capacity
Answer: 2 - show solution

total: Ajmer 20, Bikaner 40, Churu 30, Dungargarh 10. total_avg = (20 + 40 + 30 + 10)/4 = 25. Districts with total ≥ 25: Bikaner and Churu. Answer: 2.

Concept: Group-wise aggregate, then an average of those aggregates. Averaging the raw capacities (100/7 ≈ 14.3) instead of the district totals gives 3, the trap.

Q63NAT2 marks · no negative· Easy

A network has a data transmission bandwidth of 20 × 10⁶ bits per second. It uses CSMA/CD in the MAC layer. The maximum signal propagation time from one node to another node is 40 microseconds. The minimum size of a frame in the network is ______ bytes.

Answer: 200 - show solution

For collision detection the transmission time must be at least the round-trip propagation time: L/B ≥ 2 × Tp. L = 2 × 40 × 10⁻⁶ × 20 × 10⁶ = 1600 bits = 200 bytes. Answer: 200.

Concept: CSMA/CD minimum frame: L = 2 × Tp × B. Using one-way propagation gives 100 bytes, the trap.

Q64MCQ2 marks · -2/3· Moderate

For the IEEE 802.11 MAC protocol for wireless communication, which of the following statements is/are TRUE? I. At least three non-overlapping channels are available for transmissions. II. The RTS-CTS mechanism is used for collision detection. III. Unicast frames are ACKed.

  1. (A)All I, II, and III
  2. (B)I and III only
  3. (C)II and III only
  4. (D)II only
Answer: B - show solution

I is true: in the 2.4 GHz band channels 1, 6 and 11 do not overlap. II is false: RTS-CTS is used for collision avoidance (reserving the medium, solving hidden terminals), since wireless stations cannot detect collisions while transmitting. III is true: 802.11 acknowledges every unicast data frame because collisions are not detected. Answer: (B) I and III only.

Concept: 802.11 uses CSMA/CA, not CSMA/CD. RTS-CTS avoids collisions; ACKs replace detection. Calling RTS-CTS collision detection is the trap.

Q65NAT2 marks · no negative· Moderate

Consider a 128 × 10³ bits/second satellite communication link with one way propagation delay of 150 milliseconds. Selective retransmission (repeat) protocol is used on this link to send data with a frame size of 1 kilobyte. Neglect the transmission time of acknowledgement. The minimum number of bits required for the sequence number field to achieve 100% utilization is ______.

Answer: 4 - show solution

Frame transmission time Tt = 8192 bits / 128000 bps = 64 ms. For 100% utilization the sender window must cover Tt + 2Tp = 64 + 300 = 364 ms, i.e. 364/64 = 5.69, so 6 frames. Selective repeat needs a sequence space of at least twice the window: 12, so ceil(log₂ 12) = 4 bits. (Taking 1 KB = 1000 bytes gives 362.5/62.5 = 5.8, again 6 frames and 4 bits.) Answer: 4.

Concept: Window size = 1 + 2a with a = Tp/Tt, rounded up; for selective repeat the sequence number space must be at least 2 × window. Forgetting the doubling gives 3 bits.

Answers are the official GATE answer key. Questions that depend on a figure are left out until they can be shown faithfully.