Organised by IISc Bengaluru

GATE 2016 CS (Computer Science) Set 1 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

Out of the following four sentences, select the most suitable sentence with respect to grammar and usage.

  1. (A)I will not leave the place until the minister does not meet me.
  2. (B)I will not leave the place until the minister doesn't meet me.
  3. (C)I will not leave the place until the minister meet me.
  4. (D)I will not leave the place until the minister meets me.
Answer: D - show solution

'Until' already carries the negative sense of 'up to the time when', so adding 'does not' after it creates a double negative and changes the meaning (options A and B are wrong). The subject 'the minister' is third person singular, so the present-tense verb must be 'meets', not 'meet' (option C is wrong). 'I will not leave the place until the minister meets me' is correct. Answer: (D).

Concept: Tests subject-verb agreement and the use of 'until'. The trap is the double negative 'until ... does not', which sounds natural in some spoken Indian English but is ungrammatical.

Q2MCQ1 mark · -1/3· Easy

A rewording of something written or spoken is a ______________.

  1. (A)paraphrase
  2. (B)paradox
  3. (C)paradigm
  4. (D)paraffin
Answer: A - show solution

A paraphrase restates a text or speech in other words. A paradox is a self-contradictory statement, a paradigm is a model or pattern, and paraffin is a wax or fuel. Answer: (A) paraphrase.

Concept: Vocabulary question built on look-alike words sharing the prefix 'para-'. Only the meaning matters; do not be distracted by the similar spelling.

Q3MCQ1 mark · -1/3· Easy

Archimedes said, "Give me a lever long enough and a fulcrum on which to place it, and I will move the world." The sentence above is an example of a ___________ statement.

  1. (A)figurative
  2. (B)collateral
  3. (C)literal
  4. (D)figurine
Answer: A - show solution

Archimedes is not literally proposing to move the Earth; he uses an exaggerated image to express the power of the lever. A statement that uses words in a non-literal, imaginative sense is figurative. 'Literal' is the opposite, 'collateral' means secondary or accompanying, and a 'figurine' is a small statue. Answer: (A) figurative.

Concept: Distinguishes figurative from literal language. The distractor 'figurine' looks like 'figurative' but is a noun meaning a statuette.

Q4MCQ1 mark · -1/3· Moderate

If 'relftaga' means carefree, 'otaga' means careful and 'fertaga' means careless, which of the following could mean 'aftercare'?

  1. (A)zentaga
  2. (B)tagafer
  3. (C)tagazen
  4. (D)relffer
Answer: C - show solution

All three words share 'taga', which must mean 'care'. In each, 'care' comes first in English but 'taga' comes last in the coded word: relf = free, o = ful, fer = less, so the coded word reverses the English order (modifier + taga). In 'aftercare', 'care' is the last English part, so 'taga' must come first, followed by a new code for 'after'. Only 'tagazen' has that form ('zen' = after). Answer: (C) tagazen.

Concept: Coded-language reasoning: identify the common root and, crucially, the word order. The trap is 'zentaga', which keeps 'taga' at the end as in the examples but ignores that the English order is reversed.

Q5MCQ1 mark · -1/3· Easy

A cube is built using 64 cubic blocks of side one unit. After it is built, one cubic block is removed from every corner of the cube. The resulting surface area of the body (in square units) after the removal is __________.

  1. (A)56
  2. (B)64
  3. (C)72
  4. (D)96
Answer: D - show solution

64 unit blocks form a 4 x 4 x 4 cube with surface area 6 x 16 = 96. Removing a corner block takes away its 3 exposed unit faces, but exposes 3 new unit faces of the neighbouring blocks (the inner faces of the notch). The net change per corner is 0, so the surface area stays 96. Answer: (D) 96.

Concept: Visualising surface area after removing corner blocks. The trap is subtracting 3 faces per corner (giving 72) and forgetting the 3 newly exposed faces.

Q6MCQ2 marks · -2/3· Moderate

A shaving set company sells 4 different types of razors, Elegance, Smooth, Soft and Executive. Elegance sells at Rs. 48, Smooth at Rs. 63, Soft at Rs. 78 and Executive at Rs. 173 per piece. The table below shows the numbers of each razor sold in each quarter of a year. Quarter \ Product Elegance Smooth Soft Executive Q1 27300 20009 17602 9999 Q2 25222 19392 18445 8942 Q3 28976 22429 19544 10234 Q4 21012 18229 16595 10109 Which product contributes the greatest fraction to the revenue of the company in that year?

  1. (A)Elegance
  2. (B)Executive
  3. (C)Smooth
  4. (D)Soft
Answer: B - show solution

Annual units: Elegance 27300+25222+28976+21012 = 102510; Smooth 20009+19392+22429+18229 = 80059; Soft 17602+18445+19544+16595 = 72186; Executive 9999+8942+10234+10109 = 39284. Revenue: Elegance 102510 x 48 = 4,920,480; Smooth 80059 x 63 = 5,043,717; Soft 72186 x 78 = 5,630,508; Executive 39284 x 173 = 6,796,132. Executive has the largest revenue, hence the greatest fraction. Answer: (B) Executive.

Concept: Revenue = price x quantity. The trap is picking Elegance because it sells the most units; the much higher price of Executive outweighs its lower volume.

Q7MCQ2 marks · -2/3· Easy

Indian currency notes show the denomination indicated in at least seventeen languages. If this is not an indication of the nation's diversity, nothing else is. Which of the following can be logically inferred from the above sentences?

  1. (A)India is a country of exactly seventeen languages.
  2. (B)Linguistic pluralism is the only indicator of a nation's diversity.
  3. (C)Indian currency notes have sufficient space for all the Indian languages.
  4. (D)Linguistic pluralism is strong evidence of India's diversity.
Answer: D - show solution

The passage says 'at least seventeen', so 'exactly seventeen' (A) is wrong. 'If this is not an indication ..., nothing else is' is a rhetorical way of saying the multilingual notes are a very strong indicator, not the only possible one, so (B) overstates it. Nothing is said about space on notes (C). The claim is simply that linguistic plurality strongly evidences India's diversity. Answer: (D).

Concept: Inference questions reward the option that follows without adding information. The traps are absolute words ('exactly', 'only') that go beyond the passage.

Q8MCQ2 marks · -2/3· Moderate

Consider the following statements relating to the level of poker play of four players P, Q, R and S. I. P always beats Q II. R always beats S III. S loses to P only sometimes IV. R always loses to Q Which of the following can be logically inferred from the above statements? (i) P is likely to beat all the three other players (ii) S is the absolute worst player in the set

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

(ii): Statement III says S loses to P only sometimes, so S sometimes beats P. S cannot be the absolute worst player, so (ii) fails. (i): The chain P > Q > R > S suggests P is strong, but no statement relates P directly to R, and S beats P part of the time. Winning in poker is not transitive, so 'P is likely to beat all three' cannot be logically inferred from the given statements. Neither inference follows. Answer: (D) neither (i) nor (ii).

Concept: Tests whether you assume transitivity where none is given. The trap is chaining P > Q > R > S into conclusions about pairs the statements never compare, and ignoring that S beats P sometimes.

Q9MCQ2 marks · -2/3· Easy

If f(x) = 2x⁷ + 3x - 5, which of the following is a factor of f(x)?

  1. (A)(x³ + 8)
  2. (B)(x - 1)
  3. (C)(2x - 5)
  4. (D)(x + 1)
Answer: B - show solution

By the factor theorem, (x - c) is a factor iff f(c) = 0. f(1) = 2 + 3 - 5 = 0, so (x - 1) is a factor. Check the others: f(-1) = -2 - 3 - 5 = -10 ≠ 0; f(5/2) is clearly positive and large; x³ + 8 has root x = -2 and f(-2) = -256 - 6 - 5 ≠ 0. Answer: (B) (x - 1).

Concept: Factor theorem: substitute the root of each candidate factor. A quick check of x = 1 (sum of coefficients equals zero) settles it immediately.

Q10MCQ2 marks · -2/3· Moderate

In a process, the number of cycles to failure decreases exponentially with an increase in load. At a load of 80 units, it takes 100 cycles for failure. When the load is halved, it takes 10000 cycles for failure. The load for which the failure will happen in 5000 cycles is ________.

  1. (A)40.00
  2. (B)46.02
  3. (C)60.01
  4. (D)92.02
Answer: B - show solution

Let N = A·e^(-kL). From N(80) = 100 and N(40) = 10000: N(40)/N(80) = e^(40k) = 100, so k = ln 100 / 40. For N = 5000: N(40)/N(L) = 10000/5000 = 2 = e^(k(L - 40)), so L - 40 = ln 2 / k = 40 · ln 2 / ln 100 = 40 × 0.30103 / 2 = 6.02. L = 46.02. Answer: (B) 46.02.

Concept: Exponential decay model fitted from two points, solved with logarithms. The trap is assuming linear interpolation between 40 and 80, which gives a very different load.

Q11NAT1 mark · no negative· Moderate

Let p, q, r, s represent the following propositions. p: x ∈ {8, 9, 10, 11, 12} q: x is a composite number r: x is a perfect square s: x is a prime number The integer x ≥ 2 which satisfies ¬((p → q) ∧ (¬r ∨ ¬s)) is ________.

Answer: 11 - show solution

¬((p → q) ∧ (¬r ∨ ¬s)) = ¬(p → q) ∨ ¬(¬r ∨ ¬s) = (p ∧ ¬q) ∨ (r ∧ s). r ∧ s needs x to be both a perfect square and a prime, which is impossible. So we need p ∧ ¬q: x ∈ {8, 9, 10, 11, 12} and x not composite. Since x ≥ 2, not composite means prime; the only prime in the set is 11. Answer: 11.

Concept: Applying De Morgan's law and ¬(p → q) ≡ p ∧ ¬q. The trap is mis-negating the implication as ¬p → ¬q or forgetting that r ∧ s is unsatisfiable.

Q12MCQ1 mark · -1/3· Easy

Let aₙ be the number of n-bit strings that do NOT contain two consecutive 1s. Which one of the following is the recurrence relation for aₙ?

  1. (A)aₙ = aₙ₋₁ + 2aₙ₋₂
  2. (B)aₙ = aₙ₋₁ + aₙ₋₂
  3. (C)aₙ = 2aₙ₋₁ + aₙ₋₂
  4. (D)aₙ = 2aₙ₋₁ + 2aₙ₋₂
Answer: B - show solution

Classify valid n-bit strings by their last bit. If it ends in 0, the first n-1 bits form any valid string: aₙ₋₁ ways. If it ends in 1, the bit before must be 0, and the first n-2 bits form any valid string: aₙ₋₂ ways. So aₙ = aₙ₋₁ + aₙ₋₂ (with a₁ = 2, a₂ = 3). Answer: (B).

Concept: Standard Fibonacci-type recurrence from case analysis on the last bit. The trap is counting the '1' ending as aₙ₋₁ without forcing the preceding 0.

Q13NAT1 mark · no negative· Easy

lim (x→4) sin(x - 4) / (x - 4) = ________.

Answer: 1 - show solution

Substitute t = x - 4; as x → 4, t → 0. The limit becomes lim (t→0) sin t / t = 1. Answer: 1.

Concept: The standard limit sin t / t → 1 after a shift of variable. The trap is substituting x = 4 directly and stopping at the indeterminate form 0/0.

Q14NAT1 mark · no negative· Easy

A probability density function on the interval [a, 1] is given by 1/x² and outside this interval the value of the function is zero. The value of a is ________.

Answer: 0.5 - show solution

A pdf must integrate to 1: ∫ from a to 1 of x⁻² dx = [-1/x] from a to 1 = -1 + 1/a = 1. So 1/a = 2 and a = 0.5. Answer: 0.5.

Concept: Normalisation condition of a probability density function. The trap is a sign slip in the antiderivative -1/x.

Q15NAT1 mark · no negative· Easy

Two eigenvalues of a 3 × 3 real matrix P are (2 + √-1) and 3. The determinant of P is ________.

Answer: 15 - show solution

For a real matrix, complex eigenvalues occur in conjugate pairs, so the third eigenvalue is 2 - i. The determinant is the product of eigenvalues: (2 + i)(2 - i) × 3 = (4 + 1) × 3 = 15. Answer: 15.

Concept: Real matrices have conjugate-paired complex eigenvalues, and det = product of eigenvalues. The trap is treating the given two as all the information and multiplying (2 + i) × 3.

Q16MCQ1 mark · -1/3· Easy

Consider the Boolean operator # with the following properties: x # 0 = x, x # 1 = x̄, x # x = 0 and x # x̄ = 1. Then x # y is equivalent to

  1. (A)xȳ + x̄y
  2. (B)xȳ + x̄ȳ
  3. (C)x̄y + xy
  4. (D)xy + x̄ȳ
Answer: A - show solution

The properties give the truth table: y = 0 gives x, y = 1 gives x̄. So x # y = 1 exactly when x ≠ y, which is XOR: x # y = xȳ + x̄y. Check: x # x = 0 and x # x̄ = 1 hold. Answer: (A).

Concept: Recognising XOR from its identities. The trap is option (D), XNOR, which gives x # x = 1.

Q17NAT1 mark · no negative· Easy

The 16-bit 2's complement representation of an integer is 1111 1111 1111 0101; its decimal representation is ________.

Answer: -11 - show solution

The MSB is 1, so the number is negative. Its magnitude is the 2's complement: invert 1111 1111 1111 0101 to get 0000 0000 0000 1010, add 1 to get 0000 0000 0000 1011 = 11. So the value is -11. Answer: -11.

Concept: Reading a negative 2's complement number. The trap is reading it as unsigned (65525) or forgetting to add 1 after inverting (giving -10).

Q18NAT1 mark · no negative· Moderate

We want to design a synchronous counter that counts the sequence 0-1-0-2-0-3 and then repeats. The minimum number of J-K flip-flops required to implement this counter is ________.

Answer: 3 to 4 - show solution

The sequence has 6 distinct steps (the three 0s are different states because each is followed by a different value). Distinguishing 6 states needs ⌈log₂ 6⌉ = 3 flip-flops, with combinational logic decoding the output; this gives 3. If instead the counter's output must come directly from flip-flops, the 2 value bits are not enough to tell the three 0 states apart and an extra state bit is needed, giving 4. The official key accepts 3 to 4. Answer: 3 (or 4).

Concept: A counter with repeated output values needs extra state to remember its position. The trap is answering 2 because the largest output value is 3.

Q19NAT1 mark · no negative· Easy

A processor can support a maximum memory of 4 GB, where the memory is word-addressable (a word consists of two bytes). The size of the address bus of the processor is at least ________ bits.

Answer: 31 - show solution

4 GB = 2³² bytes. Each address refers to one word of 2 bytes, so the number of addressable units is 2³² / 2 = 2³¹. The address bus needs log₂(2³¹) = 31 bits. Answer: 31.

Concept: Address width depends on the number of addressable units, not bytes. The trap is answering 32 by ignoring word addressing.

Q20MCQ1 mark · -1/3· Easy

A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?

  1. (A)Both operations can be performed in O(1) time
  2. (B)At most one operation can be performed in O(1) time but the worst case time for the other operation will be Ω(n)
  3. (C)The worst case time complexity for both operations will be Ω(n)
  4. (D)Worst case time complexity for both operations will be Ω(log n)
Answer: A - show solution

Use a circular array with front and rear indices. ENQUEUE writes at rear and advances rear modulo the array size; DEQUEUE reads at front and advances front modulo the size. Neither shifts elements, so both run in O(1). Answer: (A).

Concept: Circular buffer implementation of a queue. The trap is imagining a linear array that shifts elements on every dequeue, which costs Ω(n).

Q21NAT1 mark · no negative· Easy

Consider the following directed graph with vertices a, b, c, d, e, f and edges a → b, b → c, c → f, a → d, d → e, e → f. The number of different topological orderings of the vertices of the graph is ________.

Answer: 6 - show solution

a is the only source, so it comes first; f is the only sink, so it comes last. In between, b must precede c and d must precede e, with no constraint between the two chains. The number of interleavings of two chains of length 2 is C(4, 2) = 6. Answer: 6.

Concept: Counting topological orders as interleavings of independent chains. The trap is listing orders by hand and missing some, or treating b, c, d, e as freely permutable (24).

Q22MCQ1 mark · -1/3· Easy

Consider the following C program. Which one of the following expressions, when placed in the blank above, will NOT result in a type checking error?

void f(int, short);
void main()
{
    int i = 100;
    short s = 12;
    short *p = &s;
    __________ ;    // call to f()
}
  1. (A)f(s,*s)
  2. (B)i = f(i,s)
  3. (C)f(i,*s)
  4. (D)f(i,*p)
Answer: D - show solution

s is a short, not a pointer, so *s is invalid; this rules out (A) and (C). f returns void, so assigning its result to i is a type error; this rules out (B). In (D), i is int and *p dereferences a short pointer to give a short, matching f(int, short). Answer: (D) f(i,*p).

Concept: Type checking of function calls: argument types, dereferencing only pointers, and void return values. The trap is (B), which looks harmless but uses a void result as a value.

Q23MCQ1 mark · -1/3· Easy

The worst case running times of Insertion sort, Merge sort and Quick sort, respectively, are:

  1. (A)Θ(n log n), Θ(n log n), and Θ(n²)
  2. (B)Θ(n²), Θ(n²), and Θ(n log n)
  3. (C)Θ(n²), Θ(n log n), and Θ(n log n)
  4. (D)Θ(n²), Θ(n log n), and Θ(n²)
Answer: D - show solution

Insertion sort: a reverse-sorted input forces i shifts for the i-th element, Θ(n²). Merge sort always splits in half and merges in linear time, Θ(n log n) in every case. Quick sort: with consistently bad pivots (e.g. sorted input with first-element pivot) partitions are of size n-1 and 0, Θ(n²). Answer: (D).

Concept: Worst-case complexities of the standard sorts. The trap is quoting quick sort's average Θ(n log n) as its worst case.

Q24MCQ1 mark · -1/3· Moderate

Let G be a weighted connected undirected graph with distinct positive edge weights. If every edge weight is increased by the same value, then which of the following statements is/are TRUE? P: Minimum spanning tree of G does not change Q: Shortest path between any pair of vertices does not change

  1. (A)P only
  2. (B)Q only
  3. (C)Neither P nor Q
  4. (D)Both P and Q
Answer: A - show solution

P: Every spanning tree has exactly V - 1 edges, so adding c to each edge adds (V - 1)c to every tree; the relative order of edge weights (which Kruskal uses) is unchanged. The MST stays the same. P is true. Q: Paths have different numbers of edges, so a path with k edges increases by kc. Example: A-B weight 3 directly vs A-C-B with weights 1 + 1 = 2. Adding 2 to each edge gives 5 vs 6, so the shortest path changes. Q is false. Answer: (A) P only.

Concept: MSTs depend only on the order of weights; shortest paths depend on sums over paths of different lengths. The trap is assuming both are invariant.

Q25NAT1 mark · no negative· Easy

Consider the following C program. The output of the program is ________.

#include<stdio.h>
void mystery(int *ptra, int *ptrb) {
    int *temp;
    temp = ptrb;
    ptrb = ptra;
    ptra = temp;
}
int main() {
    int a=2016, b=0, c=4, d=42;
    mystery(&a, &b);
    if (a < c)
        mystery(&c, &a);
    mystery(&a, &d);
    printf("%d\n", a);
}
Answer: 2016 - show solution

mystery swaps its local copies of the pointers, never the values they point to (it never writes through *ptra or *ptrb). So no call changes a, b, c or d. a stays 2016; a < c is false so the second call is skipped anyway; the third call also changes nothing. Output: 2016.

Concept: C passes pointers by value: swapping the pointer variables inside a function has no effect on the caller. The trap is assuming a swap of the integers happened.

Q26MCQ1 mark · -1/3· Easy

Which of the following languages is generated by the given grammar? S → aS | bS | ε

  1. (A){aⁿbᵐ | n, m ≥ 0}
  2. (B){w ∈ {a, b}* | w has equal number of a's and b's}
  3. (C){aⁿ | n ≥ 0} ∪ {bⁿ | n ≥ 0} ∪ {aⁿbⁿ | n ≥ 0}
  4. (D){a, b}*
Answer: D - show solution

Each step prepends either a or b, in any order, and ε ends the derivation. So any string over {a, b} of any length, including ε, can be generated, e.g. ba via S ⇒ bS ⇒ baS ⇒ ba. The language is {a, b}*. Answer: (D).

Concept: Reading a right-linear grammar. The trap is (A), which forbids b before a, though the grammar allows a and b in any order.

Q27MCQ1 mark · -1/3· Moderate

Which of the following decision problems are undecidable? I. Given NFAs N₁ and N₂, is L(N₁) ∩ L(N₂) = Φ? II. Given a CFG G = (N, Σ, P, S) and a string x ∈ Σ*, does x ∈ L(G)? III. Given CFGs G₁ and G₂, is L(G₁) = L(G₂)? IV. Given a TM M, is L(M) = Φ?

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

I: Build the product automaton for the intersection and test reachability of a final state; decidable. II: CFG membership is decidable (convert to CNF and use CYK). III: Equivalence of two CFGs is undecidable. IV: Emptiness of a TM's language is a non-trivial property of RE languages, undecidable by Rice's theorem. Undecidable: III and IV. Answer: (C).

Concept: Know the decidability table: regular languages are closed and decidable for everything; CFLs have decidable membership and emptiness but undecidable equivalence; TM language properties are undecidable.

Q28MCQ1 mark · -1/3· Moderate

Which one of the following regular expressions represents the language: the set of all binary strings having two consecutive 0s and two consecutive 1s?

  1. (A)(0 + 1)*0011(0 + 1)* + (0 + 1)*1100(0 + 1)*
  2. (B)(0 + 1)*(00(0 + 1)*11 + 11(0 + 1)*00)(0 + 1)*
  3. (C)(0 + 1)*00(0 + 1)* + (0 + 1)*11(0 + 1)*
  4. (D)00(0 + 1)*11 + 11(0 + 1)*00
Answer: B - show solution

A string must contain 00 somewhere and 11 somewhere, in either order, possibly far apart. (B) says: anything, then either 00 ... 11 or 11 ... 00, then anything; this captures exactly that. (A) forces 00 and 11 to be adjacent (it misses strings like 001011, where 00 and 11 are separated). (C) is 'contains 00 OR 11'. (D) forces the string to start with 00 or 11 and end with the other. Answer: (B).

Concept: Expressing an AND of two substring conditions with a regex requires both orderings. The trap is (C), which is a union (OR) rather than an intersection.

Q29NAT1 mark · no negative· Moderate

Consider the following code segment. The minimum number of total variables required to convert the above code segment to static single assignment form is ________.

x = u - t;
y = x * v;
x = y + w;
y = t - z;
y = x * y;
Answer: 10 - show solution

In SSA each variable is assigned exactly once, so every assignment gets a fresh name: x1 = u - t y1 = x1 * v x2 = y1 + w y2 = t - z y3 = x2 * y2 Variables used: the inputs u, t, v, w, z (5) plus x1, y1, x2, y2, y3 (5). Total = 10. Answer: 10.

Concept: SSA renames every definition. The trap is forgetting to count the original input variables (giving 5) or trying to reuse a temporary name.

Q30MCQ1 mark · -1/3· Easy

Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths submitted at the same time to a computer system. Which one of the following process scheduling algorithms would minimize the average waiting time in the ready queue?

  1. (A)Shortest remaining time first
  2. (B)Round-robin with time quantum less than the shortest CPU burst
  3. (C)Uniform random
  4. (D)Highest priority first with priority proportional to CPU burst length
Answer: A - show solution

When all processes arrive together, running them in increasing order of burst length (SJF) minimises the average waiting time, by an exchange argument. With simultaneous arrival, SRTF behaves exactly as SJF. Round-robin interleaves jobs and delays all of them; random order is not optimal; priority proportional to burst length runs the longest first, the worst order. Answer: (A).

Concept: SJF/SRTF is optimal for average waiting time. The trap is option (D), whose wording sounds like SJF but actually favours long bursts.

Q31MCQ1 mark · -1/3· Easy

Which of the following is NOT a superkey in a relational schema with attributes V, W, X, Y, Z and primary key VY?

  1. (A)VXYZ
  2. (B)VWXZ
  3. (C)VWXY
  4. (D)VWXYZ
Answer: B - show solution

A superkey is any attribute set containing a key. With no other information, a set is guaranteed to be a superkey if it contains both V and Y. VXYZ, VWXY and VWXYZ all contain V and Y. VWXZ lacks Y. Answer: (B) VWXZ.

Concept: Superkey = superset of a candidate key. The trap is over-thinking about other dependencies; only containment of VY is guaranteed.

Q32MCQ1 mark · -1/3· Easy

Which one of the following is NOT a part of the ACID properties of database transactions?

  1. (A)Atomicity
  2. (B)Consistency
  3. (C)Isolation
  4. (D)Deadlock-freedom
Answer: D - show solution

ACID stands for Atomicity, Consistency, Isolation and Durability. Deadlock-freedom is a property of some concurrency-control protocols, not one of the ACID properties. Answer: (D).

Concept: Recall of the ACID acronym; the missing D is Durability, which the distractor tries to replace with Deadlock-freedom.

Q33MCQ1 mark · -1/3· Moderate

A database of research articles in a journal uses the following schema. (VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, YEAR, PRICE) The primary key is (VOLUME, NUMBER, STARTPAGE, ENDPAGE) and the following functional dependencies exist in the schema. (VOLUME, NUMBER, STARTPAGE, ENDPAGE) → TITLE (VOLUME, NUMBER) → YEAR (VOLUME, NUMBER, STARTPAGE, ENDPAGE) → PRICE The database is redesigned to use the following schemas. (VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, PRICE) (VOLUME, NUMBER, YEAR) Which is the weakest normal form that the new database satisfies, but the old one does not?

  1. (A)1NF
  2. (B)2NF
  3. (C)3NF
  4. (D)BCNF
Answer: B - show solution

Old schema: (VOLUME, NUMBER) → YEAR has a proper subset of the key determining a non-prime attribute, a partial dependency. So the old schema is in 1NF but not 2NF. New schemas: in the first, the full key determines TITLE and PRICE; in the second, (VOLUME, NUMBER) is the key and determines YEAR. Every determinant is a key, so both are in BCNF, hence also in 2NF. The weakest normal form satisfied by the new design but not by the old is 2NF. Answer: (B).

Concept: Partial dependencies violate 2NF. The trap is answering BCNF because the new design is in BCNF; the question asks for the weakest form that separates the two.

Q34MCQ1 mark · -1/3· Easy

Which one of the following protocols is NOT used to resolve one form of address to another one?

  1. (A)DNS
  2. (B)ARP
  3. (C)DHCP
  4. (D)RARP
Answer: C - show solution

DNS maps host names to IP addresses; ARP maps IP addresses to MAC addresses; RARP maps MAC addresses to IP addresses. DHCP dynamically assigns IP addresses and configuration to hosts; it does not translate one existing address form into another. Answer: (C) DHCP.

Concept: Distinguishing address resolution from address allocation. The trap is thinking of DHCP as a MAC-to-IP lookup like RARP; it is an allocation protocol.

Q35MCQ1 mark · -1/3· Moderate

Which of the following is/are example(s) of stateful application layer protocols? (i) HTTP (ii) FTP (iii) TCP (iv) POP3

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

HTTP is stateless: each request is independent (state is added via cookies, outside the protocol). TCP is stateful but is a transport-layer protocol, not application layer. FTP keeps session state (login, current directory, transfer mode) across commands, and POP3 keeps session state (authorization, transaction, update states). Stateful application-layer protocols: FTP and POP3. Answer: (C).

Concept: Know which protocols maintain server-side session state and at which layer each operates. The traps are HTTP (stateless) and TCP (stateful but transport layer).

Q36NAT2 marks · no negative· Moderate

The coefficient of x¹² in (x³ + x⁴ + x⁵ + x⁶ + ···)³ is ________.

Answer: 10 - show solution

(x³ + x⁴ + ···)³ = x⁹ (1 + x + x² + ···)³ = x⁹ (1 - x)⁻³. We need the coefficient of x³ in (1 - x)⁻³, which is C(3 + 2, 2) = C(5, 2) = 10. Check by counting: solutions of a + b + c = 12 with each ≥ 3 equal solutions of a' + b' + c' = 3 with each ≥ 0, which is C(5, 2) = 10. Answer: 10.

Concept: Generating functions / stars and bars with lower bounds. The trap is forgetting to factor out x⁹ or using C(n + k, k) with the wrong n.

Q37NAT2 marks · no negative· Moderate

Consider the recurrence relation a₁ = 8, aₙ = 6n² + 2n + aₙ₋₁. Let a₉₉ = K × 10⁴. The value of K is ________.

Answer: 197.9 to 198.1 - show solution

Note that 6(1)² + 2(1) = 8 = a₁, so aₙ = Σ (k = 1 to n) (6k² + 2k). Σ 6k² = 6 · n(n + 1)(2n + 1)/6 = n(n + 1)(2n + 1); Σ 2k = n(n + 1). aₙ = n(n + 1)(2n + 1 + 1) = 2n(n + 1)². a₉₉ = 2 × 99 × 100² = 1,980,000 = 198 × 10⁴. K = 198 (key range 197.9 to 198.1). Answer: 198.

Concept: Unrolling a recurrence into standard power sums. The trick is noticing a₁ fits the same formula, so the sum can start at k = 1; otherwise an off-by-8 slip is easy.

Q38NAT2 marks · no negative· Hard

A function f : ℕ⁺ → ℕ⁺, defined on the set of positive integers ℕ⁺, satisfies the following properties: f(n) = f(n/2) if n is even f(n) = f(n + 5) if n is odd Let R = {i | ∃j : f(j) = i} be the set of distinct values that f takes. The maximum possible size of R is ________.

Answer: 2 - show solution

Both rules preserve divisibility by 5 (halving an even multiple of 5 keeps it a multiple of 5; adding 5 too), so multiples and non-multiples of 5 never mix. Non-multiples: 1 → 6 → 3 → 8 → 4 → 2 → 1, so f(1) = f(2) = f(3) = f(4) = f(6) = f(8). Any other non-multiple n descends into this cycle: an odd n > 5 gives (n + 5)/2 < n after halving, and an even n halves, so the value strictly decreases until it lands in {1, 2, 3, 4, 6, 8}. All non-multiples share one value. Multiples of 5: 5 → 10 → 5, and every 5m reduces the same way to 5. All share one value. So f takes at most 2 distinct values. Answer: 2.

Concept: Find the invariant (residue class mod 5) and show each class collapses to one cycle. The trap is assuming one value per residue mod 5, giving 5.

Q39NAT2 marks · no negative· Moderate

Consider the following experiment. Step 1. Flip a fair coin twice. Step 2. If the outcomes are (TAILS, HEADS) then output Y and stop. Step 3. If the outcomes are either (HEADS, HEADS) or (HEADS, TAILS), then output N and stop. Step 4. If the outcomes are (TAILS, TAILS), then go to Step 1. The probability that the output of the experiment is Y is (up to two decimal places) ________.

Answer: 0.33 to 0.34 - show solution

Each round: P(Y) = 1/4, P(N) = 2/4, P(repeat) = 1/4. Let p = P(output Y). Then p = 1/4 + (1/4)p, so (3/4)p = 1/4 and p = 1/3 ≈ 0.33. Equivalently, conditioned on stopping, Y has 1 of the 3 stopping outcomes. Answer: 0.33 (key 0.33 to 0.34).

Concept: Repeated trials with a restart: condition on the process stopping. The trap is answering 0.25 by ignoring the restarts.

Q40MCQ2 marks · -2/3· Moderate

Consider two cascaded 2-to-1 multiplexers. The first MUX has input 0 = constant 0, input 1 = R, and select line P. The second MUX has input 0 = R̄, input 1 = output of the first MUX, and select line Q. The output of the second MUX is X. The minimal sum of products form of the output X is

  1. (A)P̄Q̄ + PQR
  2. (B)P̄Q + QR
  3. (C)PQ + P̄Q̄R
  4. (D)Q̄R̄ + PQR
Answer: D - show solution

First MUX: output = P̄·0 + P·R = PR. Second MUX: X = Q̄·R̄ + Q·(PR) = Q̄R̄ + PQR. The two terms share no adjacent minterms that would allow further merging (Q̄R̄ covers minterms with Q = 0, R = 0; PQR has Q = 1, R = 1), so this is minimal. Answer: (D).

Concept: A 2-to-1 MUX computes s̄·I0 + s·I1; cascade by substitution. The trap is mixing up which input is selected by 0 versus 1.

Q41NAT2 marks · no negative· Moderate

The size of the data count register of a DMA controller is 16 bits. The processor needs to transfer a file of 29,154 kilobytes from disk to main memory. The memory is byte addressable. The minimum number of times the DMA controller needs to get the control of the system bus from the processor to transfer the file from the disk to main memory is ________.

Answer: 456 - show solution

A 16-bit count register allows at most 2¹⁶ bytes = 64 KB per DMA transfer (one bus grant in burst mode). Number of grants = ⌈29154 KB / 64 KB⌉ = ⌈455.53⌉ = 456. Answer: 456.

Concept: The count register limits the block size per DMA operation. The trap is rounding down to 455 and leaving the last partial block untransferred.

Q42NAT2 marks · no negative· Moderate

The stage delays in a 4-stage pipeline are 800, 500, 400 and 300 picoseconds. The first stage (with delay 800 picoseconds) is replaced with a functionally equivalent design involving two stages with respective delays 600 and 350 picoseconds. The throughput increase of the pipeline is ________ percent.

Answer: 33 to 34 - show solution

Pipeline clock period = slowest stage. Old: max(800, 500, 400, 300) = 800 ps. New stages 600, 350, 500, 400, 300: max = 600 ps. Throughput is 1/period, so the ratio is 800/600 = 1.333, an increase of 33.33%. Answer: 33.33 (key 33 to 34).

Concept: Throughput is set by the bottleneck stage. The trap is computing the change in period (25%) instead of the change in throughput.

Q43MCQ2 marks · -2/3· Moderate

Consider a carry lookahead adder for adding two n-bit integers, built using gates of fan-in at most two. The time to perform addition using this adder is

  1. (A)Θ(1)
  2. (B)Θ(log(n))
  3. (C)Θ(√n)
  4. (D)Θ(n)
Answer: B - show solution

A carry lookahead adder computes each carry as cᵢ = Gᵢ + PᵢGᵢ₋₁ + ... + PᵢPᵢ₋₁...P₀c₀, which involves AND/OR terms of up to about n inputs. With gates of fan-in at most 2, an n-input AND or OR must be built as a binary tree of depth Θ(log n). So the addition takes Θ(log n) time. Answer: (B).

Concept: With unlimited fan-in the CLA would be Θ(1) depth; the fan-in-2 restriction forces logarithmic trees. The trap is answering Θ(1) from the textbook 'constant time' claim.

Q44MCQ2 marks · -2/3· Moderate

The following function computes the maximum value contained in an integer array p[] of size n (n >= 1). The missing loop condition is

int max(int *p, int n) {
    int a=0, b=n-1;
    while (__________) {
        if (p[a] <= p[b]) { a = a+1; }
        else { b = b-1; }
    }
    return p[a];
}
  1. (A)a != n
  2. (B)b != 0
  3. (C)b > (a + 1)
  4. (D)b != a
Answer: D - show solution

Each iteration discards the smaller of p[a] and p[b] (moving a right or b left), so the maximum always stays within [a, b]. When a == b only one candidate remains, and it is the maximum, so the loop must run while b != a. (A) and (B) let a or b run past each other. (C) stops with two candidates left and returns p[a] even if p[b] is larger, e.g. p = {1, 2}. Answer: (D) b != a.

Concept: Loop invariant reasoning: the maximum lies in p[a..b]. The trap is (C), which stops one step early.

Q45MCQ2 marks · -2/3· Moderate

What will be the output of the following C program?

void count(int n){
    static int d=1;
    printf("%d ", n);
    printf("%d ", d);
    d++;
    if(n>1) count(n-1);
    printf("%d ", d);
}
void main(){
    count(3);
}
  1. (A)3 1 2 2 1 3 4 4 4
  2. (B)3 1 2 1 1 1 2 2 2
  3. (C)3 1 2 2 1 3 4
  4. (D)3 1 2 1 1 1 2
Answer: A - show solution

d is static, so all calls share one d, initialised once. count(3): prints 3 1; d = 2; calls count(2). count(2): prints 2 2; d = 3; calls count(1). count(1): prints 1 3; d = 4; no call; prints 4. Back in count(2): prints 4. Back in count(3): prints 4. Output: 3 1 2 2 1 3 4 4 4. Answer: (A).

Concept: Static locals persist across recursive calls; the final printf runs on the way back up, once per call. The traps are treating d as fresh per call or forgetting the unwinding prints.

Q47MCQ2 marks · -2/3· Moderate

An operator delete(i) for a binary heap data structure is to be designed to delete the item in the i-th node. Assume that the heap is implemented in an array and i refers to the i-th index of the array. If the heap tree has depth d (number of edges on the path from the root to the farthest leaf), then what is the time complexity to re-fix the heap efficiently after the removal of the element?

  1. (A)O(1)
  2. (B)O(d) but not O(1)
  3. (C)O(2ᵈ) but not O(d)
  4. (D)O(d·2ᵈ) but not O(2ᵈ)
Answer: B - show solution

Move the last element of the array into position i and shrink the heap. The moved element may violate the heap property with its parent or its children, so sift it up or down as needed. Either direction moves along a single root-to-leaf path, at most d swaps, so O(d). It is not O(1) in general, since the element may need to travel the full height. Answer: (B).

Concept: Arbitrary deletion in a heap = replace with last element, then heapify up or down along one path. The trap is thinking the whole heap must be rebuilt (O(2ᵈ), i.e. O(n)).

Q48NAT2 marks · no negative· Moderate

Consider the weighted undirected graph with 4 vertices, where the weight of edge {i, j} is given by the entry Wᵢⱼ in the matrix W. 0 2 8 5 W = 2 0 5 8 8 5 0 x 5 8 x 0 The largest possible integer value of x, for which at least one shortest path between some pair of vertices will contain the edge with weight x is ________.

Answer: 12 - show solution

Edges: {1,2} = 2, {1,3} = 8, {1,4} = 5, {2,3} = 5, {2,4} = 8, {3,4} = x. The edge {3,4} is most useful for the pair (3, 4). Without it, the shortest 3-4 route is 3-2-1-4 = 5 + 2 + 5 = 12 (3-1-4 and 3-2-4 cost 13). So the direct edge lies on a shortest path whenever x ≤ 12 (at x = 12 it ties, and 'at least one shortest path' still includes it). For other pairs the edge would need a much smaller x (e.g. for (1,3), 5 + x ≤ 7 needs x ≤ 2). Largest integer x = 12. Answer: 12.

Concept: An edge lies on some shortest path iff its weight does not exceed the best alternative between its endpoints. The trap is using strict inequality and answering 11.

Q49NAT2 marks · no negative· Moderate

Let G be a complete undirected graph on 4 vertices, having 6 edges with weights being 1, 2, 3, 4, 5, and 6. The maximum possible weight that a minimum weight spanning tree of G can have is ________.

Answer: 7 - show solution

Kruskal always takes edges 1 and 2 (two edges cannot form a cycle). To make the MST heavy, edge 3 should close a cycle: place edges 1, 2, 3 as a triangle on three vertices, so edge 3 is rejected. The fourth vertex is joined by edges 4, 5, 6, and Kruskal takes 4. MST weight = 1 + 2 + 4 = 7. If edges 1 and 2 do not form a path with 3 completing a triangle, edge 3 is accepted and the weight is only 1 + 2 + 3 = 6. Maximum = 7. Answer: 7.

Concept: Adversarial edge placement against Kruskal's algorithm. The trap is answering 6 + 5 + 4 or ignoring that edges 1 and 2 are always chosen.

Q50MCQ2 marks · -2/3· Moderate

G = (V, E) is an undirected simple graph in which each edge has a distinct weight, and e is a particular edge of G. Which of the following statements about the minimum spanning trees (MSTs) of G is/are TRUE? I. If e is the lightest edge of some cycle in G, then every MST of G includes e II. If e is the heaviest edge of some cycle in G, then every MST of G excludes e

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

II is the cycle property: if e is the unique heaviest edge on a cycle and some spanning tree contains e, removing e and adding another edge of that cycle reconnecting the tree gives a lighter spanning tree. So no MST contains e. II is true. I is false: an edge can be the lightest on one cycle and the heaviest on another. Take vertices X, Y, Z, W with XY = 1, YZ = 2, XZ = 3, ZW = 4, WX = 5. XZ = 3 is the lightest edge of cycle X-Z-W, yet it is the heaviest edge of triangle X-Y-Z, so by the cycle property no MST contains it (the MST is XY, YZ, ZW). Answer: (B) II only.

Concept: Cycle property: the unique heaviest edge of any cycle is in no MST. The trap is believing the converse for the lightest edge; an edge can be lightest on one cycle and heaviest on another.

Q51NAT2 marks · no negative· Hard

Let Q denote a queue containing sixteen numbers and S be an empty stack. Head(Q) returns the element at the head of the queue Q without removing it from Q. Similarly Top(S) returns the element at the top of S without removing it from S. Consider the algorithm given below. The maximum possible number of iterations of the while loop in the algorithm is ________.

while Q is not Empty do
    if S is Empty OR Top(S) ≤ Head(Q) then
        x := Dequeue(Q);
        Push(S, x);
    else
        x := Pop(S);
        Enqueue(Q, x);
    end
end
Answer: 256 - show solution

The loop builds a non-decreasing stack: an element is pushed only if it is not smaller than the top; otherwise the top is popped and sent to the back of the queue. The worst case is when the smallest element is last, e.g. 1, 2, ..., 15, 0 (with n = 16). The first 15 elements are pushed (15 iterations), then 0 forces all 15 to be popped back to the queue (15 iterations), then 0 is pushed, and the 15 elements cycle again; each 'round' fixes one more element. Counting all rounds gives n² iterations; a brute-force check over all permutations for n = 1..7 confirms the maximum is exactly n². For n = 16: 16² = 256. Answer: 256.

Concept: Analysing a stack-queue sorting loop for its worst-case input. The trap is answering 2n or n(n+1)/2 by counting only pushes, not the pops that send elements back to the queue.

Q52MCQ2 marks · -2/3· Moderate

Consider the following context-free grammars: G1: S → aS | B, B → b | bB G2: S → aA | bB, A → aA | B | ε, B → bB | ε Which one of the following pairs of languages is generated by G1 and G2, respectively?

  1. (A){aᵐbⁿ | m > 0 or n > 0} and {aᵐbⁿ | m > 0 and n > 0}
  2. (B){aᵐbⁿ | m > 0 and n > 0} and {aᵐbⁿ | m > 0 or n ≥ 0}
  3. (C){aᵐbⁿ | m ≥ 0 or n > 0} and {aᵐbⁿ | m > 0 and n > 0}
  4. (D){aᵐbⁿ | m ≥ 0 and n > 0} and {aᵐbⁿ | m > 0 or n > 0}
Answer: D - show solution

G1: S generates a* followed by B, and B generates b⁺. So L(G1) = a*b⁺ = {aᵐbⁿ | m ≥ 0 and n > 0}. G2: B generates b*. A generates a* b*. S → aA gives a⁺b*; S → bB gives b⁺. So L(G2) = a⁺b* ∪ b⁺ = all non-empty aᵐbⁿ = {aᵐbⁿ | m > 0 or n > 0}. Answer: (D).

Concept: Translate each nonterminal into a regular expression bottom-up. The trap is missing that G2 cannot generate ε (S has no ε-production) while it can generate strings with only b's.

Q53MCQ2 marks · -2/3· Moderate

Consider a PDA with input alphabet Σ = {a, b} and stack alphabet Γ = {X, Z}. Z is the initial stack symbol. Let L denote the language accepted by the PDA. The PDA has three states q0, q1, q2; q0 is the start state, and q0 and q2 are accepting (final) states. Transitions: q0 → q0 on a, Z/XZ and on a, X/XX q0 → q1 on b, X/ε q1 → q1 on b, X/ε q1 → q2 on ε, Z/Z Which one of the following is TRUE?

  1. (A)L = {aⁿbⁿ | n ≥ 0} and is not accepted by any finite automata
  2. (B)L = {aⁿ | n ≥ 0} ∪ {aⁿbⁿ | n ≥ 0} and is not accepted by any deterministic PDA
  3. (C)L is not accepted by any Turing machine that halts on every input
  4. (D)L = {aⁿ | n ≥ 0} ∪ {aⁿbⁿ | n ≥ 0} and is deterministic context-free
Answer: D - show solution

Acceptance is by final state. Staying in q0, the PDA reads a's and pushes an X for each; since q0 is final, every aⁿ (n ≥ 0) is accepted. On b it pops an X and moves to q1, popping one X per b; when Z is exposed it moves by ε to final q2. So aⁿbⁿ (n ≥ 1) is accepted, and more b's than a's or fewer get stuck or end in non-final q1. L = {aⁿ | n ≥ 0} ∪ {aⁿbⁿ | n ≥ 0}. The machine is deterministic: in each state, for each input/stack-top pair at most one move exists, and the ε-move in q1 is only on Z, where no b-move exists. So L is deterministic context-free. Answer: (D).

Concept: Read acceptance by final state carefully: the accepting start state adds all aⁿ. The trap is (A), forgetting q0 is final, or (B), assuming a union forces nondeterminism.

Q54MCQ2 marks · -2/3· Hard

Let X be a recursive language and Y be a recursively enumerable but not recursive language. Let W and Z be two languages such that Ȳ reduces to W, and Z reduces to X̄ (reduction means the standard many-one reduction). Which one of the following statements is TRUE?

  1. (A)W can be recursively enumerable and Z is recursive.
  2. (B)W can be recursive and Z is recursively enumerable.
  3. (C)W is not recursively enumerable and Z is recursive.
  4. (D)W is not recursively enumerable and Z is not recursive.
Answer: C - show solution

Y is RE but not recursive, so its complement Ȳ is not RE (if both Y and Ȳ were RE, Y would be recursive). If A ≤m B and B is RE then A is RE; contrapositively, Ȳ ≤m W with Ȳ not RE means W is not RE. X is recursive, so X̄ is recursive. If Z ≤m X̄ and X̄ is recursive, then Z is recursive. So W is not RE and Z is recursive. Answer: (C).

Concept: Reductions transfer decidability downward and undecidability upward; plus the fact that the complement of an RE-but-not-recursive language is not RE. The trap is missing the complement bars on Y and X.

Q55NAT2 marks · no negative· Moderate

The attributes of three arithmetic operators in some programming language are given below. Operator Precedence Associativity Arity + High Left Binary - Medium Right Binary * Low Left Binary The value of the expression 2 - 5 + 1 - 7 * 3 in this language is ________.

Answer: 9 - show solution

* has the lowest precedence, so it is applied last: (2 - 5 + 1 - 7) * 3. + has the highest precedence: 5 + 1 = 6, giving 2 - 6 - 7. - is right-associative: 2 - (6 - 7) = 2 - (-1) = 3. Then 3 * 3 = 9. Answer: 9.

Concept: Parsing with non-standard precedence and associativity. The trap is applying the usual rules (giving -30) or treating - as left-associative (giving -33 after multiplying).

Q56MCQ2 marks · -2/3· Moderate

Consider the following Syntax Directed Translation Scheme (SDTS), with non-terminals {S, A} and terminals {a, b}. S → aA { print 1 } S → a { print 2 } A → Sb { print 3 } Using the above SDTS, the output printed by a bottom-up parser, for the input aab is:

  1. (A)1 3 2
  2. (B)2 2 3
  3. (C)2 3 1
  4. (D)syntax error
Answer: C - show solution

The derivation of aab is S ⇒ aA ⇒ aSb ⇒ aab. A bottom-up parser performs the reductions in reverse of this rightmost derivation: 1. Reduce the second a to S by S → a: print 2. 2. Reduce Sb to A by A → Sb: print 3. 3. Reduce aA to S by S → aA: print 1. Output: 2 3 1. Answer: (C).

Concept: Bottom-up parsing executes actions at reductions, i.e. the reverse rightmost derivation. The trap is printing in top-down (derivation) order, giving 1 3 2.

Q57NAT2 marks · no negative· Easy

Consider a computer system with 40-bit virtual addressing and page size of sixteen kilobytes. If the computer system has a one-level page table per process and each page table entry requires 48 bits, then the size of the per-process page table is ________ megabytes.

Answer: 384 - show solution

Page size = 16 KB = 2¹⁴ bytes. Number of pages = 2⁴⁰ / 2¹⁴ = 2²⁶ entries. Each entry is 48 bits = 6 bytes. Table size = 2²⁶ × 6 bytes = 6 × 64 MB = 384 MB. Answer: 384.

Concept: Page table size = number of virtual pages × entry size. The trap is using 48 as bytes or forgetting to convert bits to bytes.

Q58NAT2 marks · no negative· Easy

Consider a disk queue with requests for I/O to blocks on cylinders 47, 38, 121, 191, 87, 11, 92, 10. The C-LOOK scheduling algorithm is used. The head is initially at cylinder number 63, moving towards larger cylinder numbers on its servicing pass. The cylinders are numbered from 0 to 199. The total head movement (in number of cylinders) incurred while servicing these requests is ________.

Answer: 346 - show solution

C-LOOK services requests upward from 63: 87, 92, 121, 191. Movement 191 - 63 = 128. It then jumps to the lowest pending request, 10: movement 191 - 10 = 181. It then services upward: 11, 38, 47. Movement 47 - 10 = 37. Total = 128 + 181 + 37 = 346. Answer: 346.

Concept: C-LOOK reverses only as far as the last request and jumps to the lowest pending one; the jump is counted as head movement here. The trap is going to cylinder 199 or 0 (C-SCAN) or skipping the jump distance.

Q59NAT2 marks · no negative· Hard

Consider a computer system with ten physical page frames. The system is provided with an access sequence (a₁, a₂, ..., a₂₀, a₁, a₂, ..., a₂₀), where each aᵢ is a distinct virtual page number. The difference in the number of page faults between the last-in-first-out page replacement policy and the optimal page replacement policy is ________.

Answer: 1 - show solution

LIFO: a₁..a₁₀ fill the frames (10 faults). a₁₁..a₂₀ each replace the most recently loaded page (10 faults), leaving a₁..a₉ fixed plus a₂₀. Second pass: a₁..a₉ hit; a₁₀..a₂₀ are 11 faults. Total 31. Optimal: first pass 20 faults; for a₁₁ onward it evicts the page used farthest ahead, which keeps a₁..a₉ plus the latest page, ending with {a₁..a₉, a₂₀}. Second pass: a₁..a₉ hit; a₁₀..a₁₉ fault (10), each evicting a dead page, and a₂₀ is still resident, a hit. Total 30. Difference = 31 - 30 = 1. Answer: 1.

Concept: Simulating LIFO and OPT on a cyclic reference string. The trap is assuming LIFO is far worse; both keep a₁..a₉ resident, and they differ only on a₂₀ in the second pass.

Q60MCQ2 marks · -2/3· Hard

Consider the following proposed solution for the critical section problem. There are n processes: P₀ ... Pₙ₋₁. In the code, function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero. Which one of the following is TRUE about the above solution?

Code for Pi:
do {
    c[i]=1; t[i] = pmax(t[0],...,t[n-1])+1; c[i]=0;
    for every j ≠ i in {0,...,n-1} {
        while (c[j]);
        while (t[j] != 0 && t[j]<=t[i]);
    }
    Critical Section;
    t[i]=0;
    Remainder Section;
} while (true);
  1. (A)At most one process can be in the critical section at any time
  2. (B)The bounded wait condition is satisfied
  3. (C)The progress condition is satisfied
  4. (D)It cannot cause a deadlock
Answer: A - show solution

This is Lamport's bakery algorithm without the tie-break on process id. The c[j] wait ensures Pi sees Pj's final ticket. Pi enters only after every other process j has t[j] = 0 or t[j] > t[i]; two processes cannot both see the other's ticket as strictly larger, so mutual exclusion holds: (A) is true. But two processes can compute pmax concurrently and receive the same ticket. Then each sees t[j] <= t[i] and waits for the other forever: a deadlock. So (D) is false, and progress (C) and bounded waiting (B) fail. Answer: (A).

Concept: The bakery algorithm needs the (ticket, id) tie-break; without it equal tickets deadlock, but safety still holds. The trap is assuming it is a correct bakery algorithm and picking (D).

Q61MCQ2 marks · -2/3· Moderate

Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects {O₁, ..., Oₖ}. This is done in the following manner: Step 1. T acquires exclusive locks to O₁, ..., Oₖ in increasing order of their addresses. Step 2. The required operations are performed. Step 3. All locks are released. This protocol will

  1. (A)guarantee serializability and deadlock-freedom
  2. (B)guarantee neither serializability nor deadlock-freedom
  3. (C)guarantee serializability but not deadlock-freedom
  4. (D)guarantee deadlock-freedom but not serializability
Answer: A - show solution

All locks are acquired before any is released, so the protocol is two-phase locking (in fact conservative/strict), which guarantees conflict serializability. All transactions acquire locks in the same global order (increasing address). A wait-for cycle would require some transaction to hold a higher-addressed lock while waiting for a lower one, which the ordering forbids. So no deadlock can occur. Answer: (A).

Concept: 2PL gives serializability; a global lock ordering removes circular wait. The trap is recalling that basic 2PL can deadlock and missing the ordered acquisition.

Q62MCQ2 marks · -2/3· Easy

Consider that B wants to send a message m that is digitally signed to A. Let the pair of private and public keys for A and B be denoted by Kₓ⁻ and Kₓ⁺ for x = A, B, respectively. Let Kₓ(m) represent the operation of encrypting m with a key Kₓ and H(m) represent the message digest. Which one of the following indicates the CORRECT way of sending the message m along with the digital signature to A?

  1. (A){m, K_B⁺(H(m))}
  2. (B){m, K_B⁻(H(m))}
  3. (C){m, K_A⁻(H(m))}
  4. (D){m, K_A⁺(m)}
Answer: B - show solution

A digital signature is created by the sender encrypting the message digest with the sender's own private key, so anyone (here A) can verify it with the sender's public key K_B⁺. B is the sender, so the signature is K_B⁻(H(m)), sent along with m. B does not have A's private key, and encrypting with a public key gives confidentiality, not authentication. Answer: (B).

Concept: Signing uses the signer's private key; verification uses the signer's public key. The trap is confusing signing with encryption for confidentiality (receiver's public key).

Q63NAT2 marks · no negative· Easy

An IP datagram of size 1000 bytes arrives at a router. The router has to forward this packet on a link whose MTU (maximum transmission unit) is 100 bytes. Assume that the size of the IP header is 20 bytes. The number of fragments that the IP datagram will be divided into for transmission is ________.

Answer: 13 - show solution

Data in the datagram = 1000 - 20 = 980 bytes. Each fragment carries at most 100 - 20 = 80 data bytes, and 80 is a multiple of 8, as fragment offsets require. Fragments = ⌈980 / 80⌉ = ⌈12.25⌉ = 13 (12 of 80 bytes and one of 20 bytes). Answer: 13.

Concept: Fragment by data payload, with each fragment's data a multiple of 8 except the last. The trap is dividing 1000 by 100 (giving 10) and forgetting the header repeats in every fragment.

Q64NAT2 marks · no negative· Moderate

For a host machine that uses the token bucket algorithm for congestion control, the token bucket has a capacity of 1 megabyte and the maximum output rate is 20 megabytes per second. Tokens arrive at a rate to sustain output at a rate of 10 megabytes per second. The token bucket is currently full and the machine needs to send 12 megabytes of data. The minimum time required to transmit the data is ________ seconds.

Answer: 1.1 - show solution

Burst phase: sending at 20 MB/s while tokens arrive at 10 MB/s drains the full 1 MB bucket at a net 10 MB/s, so the burst lasts S = C / (M - ρ) = 1 / (20 - 10) = 0.1 s, sending 20 × 0.1 = 2 MB. The remaining 10 MB go at the token rate, 10 MB/s: 1 s. Total = 0.1 + 1 = 1.1 s. Answer: 1.1.

Concept: Token bucket burst length S = C / (M - ρ). The trap is computing 12 / 20 = 0.6 s, ignoring that the bucket empties and the rate then falls to the token rate.

Q65NAT2 marks · no negative· Moderate

A sender uses the Stop-and-Wait ARQ protocol for reliable transmission of frames. Frames are of size 1000 bytes and the transmission rate at the sender is 80 Kbps (1 Kbps = 1000 bits/second). Size of an acknowledgement is 100 bytes and the transmission rate at the receiver is 8 Kbps. The one-way propagation delay is 100 milliseconds. Assuming no frame is lost, the sender throughput is ________ bytes/second.

Answer: 2500 - show solution

Frame transmission time = 8000 bits / 80000 bps = 0.1 s. ACK transmission time = 800 bits / 8000 bps = 0.1 s. Propagation: 0.1 s each way, 0.2 s total. Cycle per frame = 0.1 + 0.1 + 0.1 + 0.1 = 0.4 s. Throughput = 1000 bytes / 0.4 s = 2500 bytes/second. Answer: 2500.

Concept: Stop-and-wait cycle time includes the ACK's transmission time when it is not negligible. The trap is ignoring the ACK time and getting 1000 / 0.3 ≈ 3333.

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