If '→' denotes increasing order of intensity, then the meaning of the words [walk → jog → sprint] is analogous to [bothered → ________ → daunted].
Which one of the given options is appropriate to fill the blank?
- (A)phased
- (B)phrased
- (C)fazed
- (D)fused
Walk, jog and sprint are the same action at rising intensity. The second series must go from mildly troubled (bothered) to intimidated into losing courage (daunted). 'Fazed' means disturbed or disconcerted - stronger than bothered, weaker than daunted. 'Phased' (done in stages), 'phrased' (worded) and 'fused' (joined) are sound-alike distractors with unrelated meanings. Answer: (C) fazed.
Concept: Intensity analogy combined with a homophone trap: phased, fazed and phrased sound alike, but only 'fazed' belongs to the bothered-daunted scale. Read the meaning, not the sound.
Two wizards try to create a spell using all the four elements, water, air, fire, and earth. For this, they decide to mix all these elements in all possible orders. They also decide to work independently. After trying all possible combination of elements, they conclude that the spell does not work.
How many attempts does each wizard make before coming to this conclusion, independently?
- (A)24
- (B)48
- (C)16
- (D)12
Each wizard mixes all four elements in every possible order, so each tries every permutation of 4 distinct items: 4! = 4 × 3 × 2 × 1 = 24. They work independently, so each makes 24 attempts on his own (the combined 48 is not asked). Answer: (A) 24.
Concept: Order matters, so this is a permutation count 4!. The trap is doubling to 48 for two wizards - the question asks for attempts by each wizard.
In an engineering college of 10,000 students, 1,500 like neither their core branches nor other branches. The number of students who like their core branches is 1/4th of the number of students who like other branches. The number of students who like both their core and other branches is 500.
The number of students who like their core branches is
- (A)1,800
- (B)3,500
- (C)1,600
- (D)1,500
Students who like at least one = 10,000 − 1,500 = 8,500. Let O = students liking other branches and C = O/4 liking core branches. By inclusion-exclusion, C + O − 500 = 8,500, so O/4 + O = 9,000, giving 5O/4 = 9,000, O = 7,200 and C = 1,800. Answer: (A) 1,800.
Concept: Two-set inclusion-exclusion: |C ∪ O| = |C| + |O| − |C ∩ O|. Forgetting to account for the 500 who like both gives a wrong total.
For positive non-zero real variables x and y, if
ln((x + y)/2) = (1/2)[ln(x) + ln(y)]
then, the value of x/y + y/x is
- (A)1
- (B)1/2
- (C)2
- (D)4
The right side is (1/2) ln(xy) = ln √(xy). So ln((x + y)/2) = ln √(xy), giving (x + y)/2 = √(xy). The arithmetic mean equals the geometric mean only when x = y (equivalently (√x − √y)² = 0). Then x/y + y/x = 1 + 1 = 2. Answer: (C) 2.
Concept: Log rules turn the equation into AM = GM, whose equality case forces x = y. Spotting the equality case avoids messy algebra.
In the sequence 6, 9, 14, x, 30, 41, a possible value of x is
- (A)25
- (B)21
- (C)18
- (D)20
Differences of the known terms: 9 − 6 = 3, 14 − 9 = 5, and 41 − 30 = 11. The differences are consecutive odd numbers 3, 5, 7, 9, 11. So x = 14 + 7 = 21, and indeed 30 − 21 = 9. Answer: (B) 21.
Concept: First-difference pattern (consecutive odd numbers). Check that the chosen value also fits the gap to the next term.
Sequence the following sentences in a coherent passage.
P: This fortuitous geological event generated a colossal amount of energy and heat that resulted in the rocks rising to an average height of 4 km across the contact zone.
Q: Thus, the geophysicists tend to think of the Himalayas as an active geological event rather than as a static geological feature.
R: The natural process of the cooling of this massive edifice absorbed large quantities of atmospheric carbon dioxide, altering the earth's atmosphere and making it better suited for life.
S: Many millennia ago, a breakaway chunk of bedrock from the Antarctic Plate collided with the massive Eurasian Plate.
- (A)QPSR
- (B)QSPR
- (C)SPRQ
- (D)SRPQ
S opens the story with a time marker ('Many millennia ago') and introduces the collision. P refers back to it as 'this fortuitous geological event' and describes the rocks rising. R refers to 'this massive edifice' (the risen rock mass) cooling. Q begins with 'Thus' and draws the conclusion. Order: S P R Q. Answer: (C) SPRQ.
Concept: Para-jumble: find the opener with no back-reference, then chain demonstratives ('this event', 'this edifice') to their antecedents; a 'Thus' sentence concludes, it does not open.
A person sold two different items at the same price. He made 10% profit in one item, and 10% loss in the other item. In selling these two items, the person made a total of
- (A)1% profit
- (B)2% profit
- (C)1% loss
- (D)2% loss
Let each selling price be 99. Cost of the first item = 99/1.1 = 90; cost of the second = 99/0.9 = 110. Total cost 200, total selling price 198. Loss = 2 on 200 = 1%. In general the loss is (10/10)² % = 1%. Answer: (C) 1% loss.
Concept: Equal selling prices with equal percentage profit and loss always give a net loss of (x/10)² %. The trap is assuming the profit and loss cancel.
The pie charts depict the shares of various power generation technologies in the total electricity generation of a country for the years 2007 and 2023.
Source 2007 2023
Coal 35% 20%
Gas 25% 15%
Hydro 30% 35%
Solar 5% 20%
Wind 5% 10%
The renewable sources of electricity generation consist of Hydro, Solar and Wind. Assuming that the total electricity generated remains the same from 2007 to 2023, what is the percentage increase in the share of the renewable sources of electricity generation over this period?
- (A)25%
- (B)50%
- (C)77.5%
- (D)62.5%
Renewable share in 2007 = 30 + 5 + 5 = 40%. In 2023 = 35 + 20 + 10 = 65%. Since the total is unchanged, the increase is (65 − 40)/40 × 100 = 25/40 × 100 = 62.5%. Answer: (D) 62.5%.
Concept: Percentage increase is relative to the starting value. Reporting the 25 percentage-point rise as 25% is the trap (option A).
A cube is to be cut into 8 pieces of equal size and shape. Here, each cut should be straight and it should not stop till it reaches the other end of the cube.
The minimum number of such cuts required is
- (A)3
- (B)4
- (C)7
- (D)8
Each full straight cut can at most double the number of pieces (pieces are not rearranged), so at least 3 cuts are needed since 2³ = 8. Three mutually perpendicular cuts through the centre, parallel to the three pairs of faces, give 8 identical smaller cubes. Answer: (A) 3.
Concept: Spatial reasoning: three orthogonal planes through the centre split a cube into 8 congruent cubes; fewer than 3 cuts cannot produce 8 pieces.
In the 4 × 4 array shown below, each cell of the first three rows has either a cross (X) or a number.
Row 1: 1 X 4 3
Row 2: X 5 5 4
Row 3: 3 X 6 X
Row 4: _ _ _ _
The number in a cell represents the count of the immediate neighboring cells (left, right, top, bottom, diagonals) NOT having a cross (X). Given that the last row has no crosses (X), the sum of the four numbers to be filled in the last row is
- (A)11
- (B)10
- (C)12
- (D)9
Row 3 is 3, X, 6, X and row 4 has no crosses. Count the non-X neighbours of each row-4 cell. Cell (4,1): neighbours (3,1), (3,2)=X, (4,2) - count 2. Cell (4,2): (3,1), (3,2)=X, (3,3), (4,1), (4,3) - count 4. Cell (4,3): (3,2)=X, (3,3), (3,4)=X, (4,2), (4,4) - count 3. Cell (4,4): (3,3), (3,4)=X, (4,3) - count 2. Sum = 2 + 4 + 3 + 2 = 11. Answer: (A) 11.
Concept: Neighbour counting with diagonals included. Only row 3 and row 4 matter for the last row; the usual slips are dropping diagonal neighbours or counting the X cells.
Consider a computer with a 4 MHz processor. Its DMA controller can transfer 8 bytes in 1 cycle from a device to main memory through cycle stealing at regular intervals. Which one of the following is the data transfer rate (in bits per second) of the DMA controller if 1% of the processor cycles are used for DMA?
- (A)2,56,000
- (B)3,200
- (C)25,60,000
- (D)32,000
Processor cycles per second = 4 × 10⁶. DMA steals 1% of them: 4 × 10⁴ cycles per second. Each cycle moves 8 bytes = 64 bits. Rate = 4 × 10⁴ × 64 = 2,560,000 bits per second, written in Indian digit grouping as 25,60,000. Answer: (C) 25,60,000.
Concept: Cycle-stealing DMA rate = fraction of cycles × clock rate × bits per cycle. Traps: forgetting to convert bytes to bits, or misreading the Indian digit grouping in the options.
Let p and q be the following propositions:
p: Fail grade can be given.
q: Student scores more than 50% marks.
Consider the statement: "Fail grade cannot be given when student scores more than 50% marks."
Which one of the following is the CORRECT representation of the above statement in propositional logic?
- (A)q → ¬p
- (B)q → p
- (C)p → q
- (D)¬p → q
"A when B" means "if B then A". Here B = student scores more than 50% marks (q) and A = fail grade cannot be given (¬p). So the statement is q → ¬p. Answer: (A) q → ¬p.
Concept: Translating 'when'/'if' clauses: the condition after 'when' is the antecedent. The trap is reversing the implication or dropping the negation.
Consider the following C program. Assume parameters to a function are evaluated from right to left.
Which one of the following options is the CORRECT output of the above C program?
#include <stdio.h>
int g(int p) { printf("%d", p); return p; }
int h(int q) { printf("%d", q); return q; }
void f(int x, int y) {
g(x);
h(y);
}
int main() {
f(g(10),h(20));
}- (A)20101020
- (B)10202010
- (C)20102010
- (D)10201020
Evaluating f's arguments right to left: h(20) runs first and prints 20, then g(10) prints 10. Output so far: 2010. Inside f, x = 10 and y = 20; g(x) prints 10 and then h(y) prints 20. Full output: 20101020. Answer: (A) 20101020.
Concept: Argument evaluation order (given here as right to left) versus statement order inside the body, which is always sequential. The trap is applying right-to-left to the body too.
The format of a single-precision floating-point number as per the IEEE 754 standard is:
Sign (1 bit) | Exponent (8 bits) | Mantissa (23 bits)
Choose the largest floating-point number among the following options.
- (A)Sign 0, Exponent 0111 1111, Mantissa 1111 1111 1111 1111 1111 111
- (B)Sign 0, Exponent 1111 1110, Mantissa 1111 1111 1111 1111 1111 111
- (C)Sign 0, Exponent 1111 1111, Mantissa 1111 1111 1111 1111 1111 111
- (D)Sign 0, Exponent 0111 1111, Mantissa 0000 0000 0000 0000 0000 000
Exponent 1111 1111 (255) is reserved: with a non-zero mantissa, option (C) is NaN, not a number at all. Among the valid numbers the larger biased exponent wins. (A) and (D) have exponent 127 (unbiased 0), values 2 − 2⁻²³ and 1.0. (B) has exponent 254 (unbiased 127) with an all-ones mantissa: (2 − 2⁻²³) × 2¹²⁷, the largest finite single-precision value. Answer: (B).
Concept: IEEE 754 special values: exponent all ones means infinity (mantissa 0) or NaN (mantissa non-zero). The trap is picking the all-ones pattern as the largest.
Let T(n) be the recurrence relation defined as follows:
T(0) = 1,
T(1) = 2, and
T(n) = 5T(n − 1) − 6T(n − 2) for n ≥ 2
Which one of the following statements is TRUE?
- (A)T(n) = Θ(2ⁿ)
- (B)T(n) = Θ(n2ⁿ)
- (C)T(n) = Θ(3ⁿ)
- (D)T(n) = Θ(n3ⁿ)
Characteristic equation r² − 5r + 6 = 0 gives r = 2, 3, so T(n) = a·2ⁿ + b·3ⁿ. From T(0) = 1: a + b = 1. From T(1) = 2: 2a + 3b = 2. Subtracting twice the first equation: b = 0, so a = 1. Hence T(n) = 2ⁿ exactly (check: T(2) = 10 − 6 = 4) and T(n) = Θ(2ⁿ). Answer: (A).
Concept: Linear homogeneous recurrence: the initial conditions decide which root survives. The trap is taking the dominant root 3 without solving for the constants, which here make the 3ⁿ coefficient zero.
Let f(x) be a continuous function from ℝ to ℝ such that
f(x) = 1 − f(2 − x)
Which one of the following options is the CORRECT value of ∫₀² f(x) dx ?
- (A)0
- (B)1
- (C)2
- (D)−1
Let I = ∫₀² f(x) dx. Substituting x → 2 − x gives I = ∫₀² f(2 − x) dx. Adding the two forms: 2I = ∫₀² [f(x) + f(2 − x)] dx = ∫₀² 1 dx = 2. So I = 1. Answer: (B) 1.
Concept: The property ∫ₐᵇ f(x) dx = ∫ₐᵇ f(a + b − x) dx turns the functional equation into a constant integrand.
Let A be the adjacency matrix of a simple undirected graph G. Suppose A is its own inverse. Which one of the following statements is always TRUE?
- (A)G is a cycle
- (B)G is a perfect matching
- (C)G is a complete graph
- (D)There is no such graph G
A is its own inverse means A² = I. Since A is a symmetric 0/1 matrix, the diagonal entry (A²)ᵢᵢ equals the degree of vertex i, so every vertex has degree exactly 1. A graph in which every vertex has degree 1 is a set of disjoint edges covering all vertices - a perfect matching. Conversely, for a perfect matching no two edges share a vertex, so A² = I holds. Answer: (B).
Concept: (A²)ᵢⱼ counts walks of length 2 from i to j; diagonal entries are degrees. A cycle has degree 2 everywhere, so it fails.
When six unbiased dice are rolled simultaneously, the probability of getting all distinct numbers (i.e., 1, 2, 3, 4, 5, and 6) is
- (A)1/324
- (B)5/324
- (C)7/324
- (D)11/324
Total outcomes = 6⁶ = 46656. Favourable outcomes: the six dice show 1 to 6 in some order, 6! = 720 ways. Probability = 720/46656 = 5/324. Answer: (B) 5/324.
Concept: The dice are distinguishable, so favourable outcomes are permutations (6!), not a single arrangement. Using 1/6⁶ is the trap.
Once the DBMS informs the user that a transaction has been successfully completed, its effect should persist even if the system crashes before all its changes are reflected on disk. This property is called
- (A)durability
- (B)atomicity
- (C)consistency
- (D)isolation
The ACID property that guarantees committed changes survive failures (via the log and redo during recovery) is durability. Atomicity is all-or-nothing execution, consistency is preserving integrity constraints, isolation is non-interference of concurrent transactions. Answer: (A) durability.
Concept: Distinguishing the ACID properties. Durability is about committed work surviving crashes; atomicity is about undoing partial work.
In the context of owner and weak entity sets in the ER (Entity-Relationship) data model, which one of the following statements is TRUE?
- (A)The weak entity set MUST have total participation in the identifying relationship
- (B)The owner entity set MUST have total participation in the identifying relationship
- (C)Both weak and owner entity sets MUST have total participation in the identifying relationship
- (D)Neither weak entity set nor owner entity set MUST have total participation in the identifying relationship
A weak entity cannot be identified without its owner, so every weak entity must take part in the identifying relationship: total participation on the weak side. An owner may have no weak entities at all (an employee with no dependents), so its participation need not be total. Answer: (A).
Concept: Weak entity sets depend on an identifying owner, hence total participation (double line) on the weak side only.
Consider the following two sets:
Set X Set Y
P. Lexical Analyzer 1. Abstract Syntax Tree
Q. Syntax Analyzer 2. Token
R. Intermediate Code Generator 3. Parse Tree
S. Code Optimizer 4. Constant Folding
Which one of the following options is the CORRECT match from Set X to Set Y ?
- (A)P - 4; Q - 1; R - 3; S - 2
- (B)P - 2; Q - 3; R - 1; S - 4
- (C)P - 2; Q - 1; R - 3; S - 4
- (D)P - 4; Q - 3; R - 2; S - 1
The lexical analyzer produces tokens (P-2). The syntax analyzer builds the parse tree (Q-3). The intermediate code generator works with the abstract syntax tree as an intermediate representation (R-1). Constant folding is a code optimization (S-4). Answer: (B) P - 2; Q - 3; R - 1; S - 4.
Concept: Phases of a compiler and their artefacts. Parse tree versus AST is the usual confusion: the parser gives the concrete parse tree, the AST serves as an intermediate representation.
Which one of the following regular expressions is equivalent to the language accepted by the DFA given below?
DFA: two states A (start, non-accepting) and B (accepting). Transitions: A on 0 → A, A on 1 → B, B on 0 → B, B on 1 → A.
- (A)0*1(0 + 10*1)*
- (B)0*(10*11)*0*
- (C)0*1(010*1)*0*
- (D)0(1 + 0*10*1)*0*
0 never changes state and 1 toggles between A and B, so the DFA accepts exactly the strings with an odd number of 1s. (A) 0*1(0 + 10*1)*: 0*1 reaches B; each further block 0 stays at B and 10*1 leaves B and returns. It generates exactly the odd-1 strings. (B) generates ε (zero 1s). (C) cannot generate 111. (D) forces a leading 0, so it misses 1. Answer: (A).
Concept: Converting a two-state parity DFA to a regular expression. Testing options on short strings such as ε, 1, 111 and 010 eliminates the wrong ones fast.
Node X has a TCP connection open to node Y. The packets from X to Y go through an intermediate IP router R. Ethernet switch S is the first switch on the network path between X and R. Consider a packet sent from X to Y over this connection.
Which of the following statements is/are TRUE about the destination IP and MAC addresses on this packet at the time it leaves X?
- (A)The destination IP address is the IP address of R
- (B)The destination IP address is the IP address of Y
- (C)The destination MAC address is the MAC address of S
- (D)The destination MAC address is the MAC address of Y
The IP destination is end-to-end, so it is Y's IP (B true, A false). The MAC destination is the next layer-3 hop: Y is on another network, so X sends the frame to its gateway R's MAC. A switch is transparent at layer 2 and is never addressed, so neither S's MAC (C) nor Y's MAC (D) is the destination. Answer: (B).
Concept: IP addresses are end-to-end, MAC addresses are hop-by-hop to the next router. Switches never appear as frame destinations.
Which of the following tasks is/are the responsibility/responsibilities of the memory management unit (MMU) in a system with paging-based memory management?
- (A)Allocate a new page table for a newly created process
- (B)Translate a virtual address to a physical address using the page table
- (C)Raise a trap when a virtual address is not found in the page table
- (D)Raise a trap when a process tries to write to a page marked with read-only permission in the page table
The MMU is hardware: it uses the page table to translate virtual to physical addresses (B), raises a page-fault trap when the mapping is absent or invalid (C), and raises a protection trap on a write to a read-only page (D). Allocating a page table for a new process is a software task of the OS kernel, so (A) is not the MMU's job. Answer: (B), (C), (D).
Concept: Division of labour: the hardware MMU translates, checks and traps; the OS allocates, sets up tables and handles the traps.
Consider a process P running on a CPU. Which one or more of the following events will always trigger a context switch by the OS that results in process P moving to a non-running state (e.g., ready, blocked)?
- (A)P makes a blocking system call to read a block of data from the disk
- (B)P tries to access a page that is in the swap space, triggering a page fault
- (C)An interrupt is raised by the disk to deliver data requested by some other process
- (D)A timer interrupt is raised by the hardware
(A) A blocking disk read must wait for I/O, so P is always blocked. (B) The page is in swap space, so it must be read from disk and P blocks until it arrives. (C) The disk interrupt is serviced and the other process becomes ready, but P may simply resume - not always a switch. (D) A timer interrupt preempts P only if its time slice has expired and another process is ready; otherwise P continues. Answer: (A), (B).
Concept: 'Always' is the key word: events that make P wait for I/O always remove it from the CPU; interrupts only sometimes lead to preemption.
Which of the following file organizations is/are I/O efficient for the scan operation in DBMS?
- (A)Sorted
- (B)Heap
- (C)Unclustered tree index
- (D)Unclustered hash index
A full scan must read every record. In sorted and heap files the records are packed into data pages that are read once each, about B I/Os for B pages. Scanning through an unclustered index fetches records in index order, jumping between data pages, which can cost one I/O per record plus the index pages; a hash index also leaves buckets partly empty. So only sorted and heap files are I/O efficient for a scan. Answer: (A), (B).
Concept: Scan cost depends on physical layout. Unclustered indexes help point or range lookups but make full scans expensive because of random page accesses.
Which of the following statements about the Two Phase Locking (2PL) protocol is/are TRUE?
- (A)2PL permits only serializable schedules
- (B)With 2PL, a transaction always locks the data item being read or written just before every operation and always releases the lock just after the operation
- (C)With 2PL, once a lock is released on any data item inside a transaction, no more locks on any data item can be obtained inside that transaction
- (D)A deadlock is possible with 2PL
(A) True: every 2PL schedule is conflict serializable (equivalent to the order of lock points). (B) False: releasing right after each operation and locking again later violates the growing/shrinking rule. (C) True: that is the definition of 2PL. (D) True: two transactions each holding one lock and waiting for the other's lock deadlock under basic 2PL. Answer: (A), (C), (D).
Concept: 2PL guarantees serializability but not freedom from deadlock or cascading aborts. Statement B describes short-duration locking, which breaks 2PL.
Which of the following statements about IPv4 fragmentation is/are TRUE?
- (A)The fragmentation of an IP datagram is performed only at the source of the datagram
- (B)The fragmentation of an IP datagram is performed at any IP router which finds that the size of the datagram to be transmitted exceeds the MTU
- (C)The reassembly of fragments is performed only at the destination of the datagram
- (D)The reassembly of fragments is performed at all intermediate routers along the path from the source to the destination
In IPv4 any router whose outgoing link MTU is smaller than the datagram fragments it (unless DF is set), so A is false and B is true. Fragments may travel different paths, so they are reassembled only at the final destination: C true, D false. Answer: (B), (C).
Concept: IPv4 allows fragmentation inside the network but reassembly only at the destination. Source-only fragmentation is IPv6 behaviour, a common mix-up.
Which of the following statements is/are FALSE?
- (A)An attribute grammar is a syntax-directed definition (SDD) in which the functions in the semantic rules have no side effects
- (B)The attributes in a L-attributed definition cannot always be evaluated in a depth-first order
- (C)Synthesized attributes can be evaluated by a bottom-up parser as the input is parsed
- (D)All L-attributed definitions based on LR(1) grammar can be evaluated using a bottom-up parsing strategy
(A) True - the textbook definition of an attribute grammar. (B) False - L-attributed definitions are exactly those that can always be evaluated in one depth-first, left-to-right traversal. (C) True - synthesized attributes are computed at each reduction. (D) False - L-attributed definitions on LL(1) grammars can be evaluated bottom-up (using marker non-terminals), but not every L-attributed definition on an LR(1) grammar can. The FALSE statements are B and D. Answer: (B), (D).
Concept: The question asks for FALSE statements. Key facts: L-attributed means depth-first evaluable; bottom-up evaluation of inherited attributes is guaranteed only for L-attributed SDDs on LL grammars.
For a Boolean variable x, which of the following statements is/are FALSE?
- (A)x · 1 = x
- (B)x + 1 = x
- (C)x · x = 0
- (D)x + x̄ = 1
(A) x · 1 = x is the identity law - true. (B) x + 1 = 1, not x - false. (C) x · x = x by idempotence, not 0 - false. (D) x + x̄ = 1 is the complement law - true. The FALSE statements are B and C. Answer: (B), (C).
Concept: Basic Boolean identities. Note the question asks for FALSE statements, and option C has x · x (idempotent), not x · x̄.
An instruction format has the following structure:
Instruction Number: Opcode destination reg, source reg-1, source reg-2
Consider the following sequence of instructions to be executed in a pipelined processor:
I1: DIV R3, R1, R2
I2: SUB R5, R3, R4
I3: ADD R3, R5, R6
I4: MUL R7, R3, R8
Which of the following statements is/are TRUE?
- (A)There is a RAW dependency on R3 between I1 and I2
- (B)There is a WAR dependency on R3 between I1 and I3
- (C)There is a RAW dependency on R3 between I2 and I3
- (D)There is a WAW dependency on R3 between I3 and I4
I1 writes R3 and I2 reads it: RAW on R3 (A true). I1 and I3 both write R3: that is WAW, not WAR (B false). I2 reads R3 and later I3 writes it: WAR, not RAW (C false). I3 writes R3 and I4 reads it: RAW, not WAW (D false). Answer: (A).
Concept: Classify by order of access: write-then-read is RAW, read-then-write is WAR, write-then-write is WAW. Each wrong option names a real dependency with the wrong type.
Which of the following fields of an IP header is/are always modified by any router before it forwards the IP packet?
- (A)Source IP Address
- (B)Protocol
- (C)Time to Live (TTL)
- (D)Header Checksum
Every router decrements TTL. Since TTL is covered by the header checksum, the checksum must be recomputed as well. The source address changes only under NAT (not at any router), and the protocol field is never changed in forwarding. Answer: (C), (D).
Concept: The TTL decrement forces a checksum update at each hop. NAT rewriting addresses is neither 'always' nor done by 'any router'.
Consider the following C function definition.
Which of the following statements is/are TRUE?
int fX(char *a){
char *b = a;
while(*b)
b++;
return b - a;}- (A)The function call fX("abcd") will always return a value
- (B)Assuming a character array c is declared as char c[] = "abcd" in main(), the function call fX(c) will always return a value
- (C)The code of the function will not compile
- (D)Assuming a character pointer c is declared as char *c = "abcd" in main(), the function call fX(c) will always return a value
fX advances b to the terminating null character and returns the pointer difference, i.e. the string length; it is valid C and compiles (C false). A string literal, a char array initialised from a literal, and a char pointer to a literal are all null-terminated, so the loop always stops and fX returns 4 in each case. Answer: (A), (B), (D).
Concept: A strlen written with pointer subtraction. All three forms of "abcd" carry the terminating null, and the function only reads, so none of them misbehaves.
Let P be the partial order defined on the set {1,2,3,4} as follows
P = {(x, x) | x ∈ {1,2,3,4}} ∪ {(1,2), (3,2), (3,4)}
The number of total orders on {1,2,3,4} that contain P is __________
A total order containing P is a linear arrangement with 1 before 2, 3 before 2 and 3 before 4. The first element must be minimal: 1 or 3. If 1 is first, the rest {2,3,4} must have 3 first (it precedes both 2 and 4), then 2 and 4 in either order: 2 orders (1324, 1342). If 3 is first, the rest {1,2,4} only needs 1 before 2: 3!/2 = 3 orders (3124, 3142, 3412). Total = 5. Answer: 5.
Concept: Counting linear extensions of a small poset. Fix the first element among the minimal elements and recurse; forgetting that 3 must also precede 4 overcounts.
Let A be an array containing integer values. The distance of A is defined as the minimum number of elements in A that must be replaced with another integer so that the resulting array is sorted in non-decreasing order. The distance of the array [2, 5, 3, 1, 4, 2, 6] is ___________
The elements kept unchanged must already form a non-decreasing subsequence, and any such subsequence can be kept (integers can fill the gaps since values may repeat). So distance = n − length of the longest non-decreasing subsequence. Here 2, 3, 4, 6 (positions 1, 3, 5, 7) has length 4, and no length-5 non-decreasing subsequence exists. Distance = 7 − 4 = 3 (e.g. 2, 3, 3, 3, 4, 4, 6). Answer: 3.
Concept: Reduces to the longest non-decreasing subsequence. The trap is counting inversions or out-of-place elements instead.
What is the output of the following C program?
#include <stdio.h>
int main() {
double a[2]={20.0, 25.0}, *p, *q;
p = a;
q = p + 1;
printf("%d,%d", (int)(q - p), (int)(*q - *p));
return 0;
}- (A)4,8
- (B)1,5
- (C)8,5
- (D)1,8
q = p + 1 points to the next double, and pointer subtraction counts elements, not bytes: q − p = 1. *q − *p = 25.0 − 20.0 = 5.0, cast to int gives 5. Both values are ints, so %d prints them correctly: 1,5. Answer: (B) 1,5.
Concept: Pointer arithmetic is scaled by element size: the difference of two double pointers is in elements. The trap is answering 8 (sizeof(double)).
Consider a single processor system with four processes A, B, C, and D, represented as given below, where for each process the first value is its arrival time, and the second value is its CPU burst time.
A (0, 10), B (2, 6), C (4, 3), and D (6, 7).
Which one of the following options gives the average waiting times when preemptive Shortest Remaining Time First (SRTF) and Non-Preemptive Shortest Job First (NP-SJF) CPU scheduling algorithms are applied to the processes?
- (A)SRTF = 6, NP-SJF = 7
- (B)SRTF = 6, NP-SJF = 7.5
- (C)SRTF = 7, NP-SJF = 7.5
- (D)SRTF = 7, NP-SJF = 8.5
SRTF: A 0-2; B arrives (6 < 8) B 2-4; C arrives (3 < 4) C 4-7; then B (4 left) 7-11; D 11-18; A 18-26. Waiting = completion − arrival − burst: A 26−0−10 = 16, B 11−2−6 = 3, C 7−4−3 = 0, D 18−6−7 = 5. Average 24/4 = 6. NP-SJF: A 0-10; at 10 pick C 10-13, B 13-19, D 19-26. Waiting: A 0, B 11, C 6, D 13. Average 30/4 = 7.5. Answer: (B) SRTF = 6, NP-SJF = 7.5.
Concept: Gantt charts for preemptive vs non-preemptive SJF. In SRTF, re-check at every arrival; in NP-SJF the long first job runs to completion.
Which one of the following CIDR prefixes exactly represents the range of IP addresses 10.12.2.0 to 10.12.3.255?
- (A)10.12.2.0/23
- (B)10.12.2.0/24
- (C)10.12.0.0/22
- (D)10.12.2.0/22
The range covers 2 × 256 = 512 addresses = 2⁹, so the prefix length is 32 − 9 = 23. The block must start on a multiple of 512: third octet 2 = 00000010, and 2 is a multiple of 2, so 10.12.2.0/23 covers 10.12.2.0 - 10.12.3.255 exactly. /24 is too small, /22 covers 10.12.0.0 - 10.12.3.255 (too large). Answer: (A) 10.12.2.0/23.
Concept: CIDR block size must be a power of two and aligned to its size. 10.12.2.0/22 is not even a valid block start.
You are given a set V of distinct integers. A binary search tree T is created by inserting all elements of V one by one, starting with an empty tree. The tree T follows the convention that, at each node, all values stored in the left subtree of the node are smaller than the value stored at the node. You are not aware of the sequence in which these values were inserted into T, and you do not have access to T.
Which one of the following statements is TRUE?
- (A)Inorder traversal of T can be determined from V
- (B)Root node of T can be determined from V
- (C)Preorder traversal of T can be determined from V
- (D)Postorder traversal of T can be determined from V
For any BST, the inorder traversal lists the keys in increasing order, so it is just V sorted - independent of insertion order. The shape of T, and hence the root, preorder and postorder, depend on the insertion order (the root is the first inserted element), which is unknown. Answer: (A).
Concept: Inorder of a BST is always the sorted order. Other traversals encode the tree shape, which varies with insertion order.
Consider the following context-free grammar where the start symbol is S and the set of terminals is {a,b,c,d}.
S → AaAb | BbBa
A → cS | ε
B → dS | ε
The following is a partially-filled LL(1) parsing table.
a b c d $
S S → AaAb S → BbBa (1) (2)
A A → ε (3) A → cS
B (4) B → ε B → dS
Which one of the following options represents the CORRECT combination for the numbered cells in the parsing table?
Note: In the options, "blank" denotes that the corresponding cell is empty.
- (A)(1) S → AaAb (2) S → BbBa (3) A → ε (4) B → ε
- (B)(1) S → BbBa (2) S → AaAb (3) A → ε (4) B → ε
- (C)(1) S → AaAb (2) S → BbBa (3) blank (4) blank
- (D)(1) S → BbBa (2) S → AaAb (3) blank (4) blank
FIRST(A) = {c, ε}, FIRST(B) = {d, ε}. FIRST(AaAb) = {c, a}, FIRST(BbBa) = {d, b}. So M[S,c] = S → AaAb (1) and M[S,d] = S → BbBa (2). FOLLOW(A): A is followed by a and by b in AaAb, so FOLLOW(A) = {a, b} and A → ε goes in columns a and b: (3) = A → ε. FOLLOW(B) = {b, a} from BbBa, so (4) = B → ε. Answer: (A).
Concept: Filling an LL(1) table: productions go under FIRST of their right side, and ε-productions under FOLLOW of the left side. Forgetting the second occurrence of A (followed by b) leaves (3) blank wrongly.
Let M be the 5-state NFA with ε-transitions described below. States 1 to 5; start state 1; accepting states 2 and 5. Transitions: 1 -ε→ 2, 1 -ε→ 4, 2 -0→ 3, 3 -0→ 2, 3 -ε→ 5, 4 -1→ 5, 5 -1→ 4.
Which one of the following regular expressions represents the language accepted by M ?
- (A)(00)* + 1(11)*
- (B)0* + (1 + 0(00)*)(11)*
- (C)(00)* + (1 + (00)*)(11)*
- (D)0⁺ + 1(11)* + 0(11)*
Via 1 → 2: the 2-3 loop reads pairs, so ending at 2 accepts (00)*. Reaching 3 reads 0(00)*; then ε to 5, and the 5-4 loop on 1 returns to 5 after 11, giving 0(00)*(11)*. Via 1 → 4: reach 5 with 1, then (11)*: 1(11)*. So L = (00)* + 0(00)*(11)* + 1(11)* = (00)* + (1 + 0(00)*)(11)*. Option (B): 0* = (00)* + 0(00)*, and 0(00)* is already inside 0(00)*(11)*, so (B) equals L. (A) misses 0. (C) misses 0 and wrongly accepts 11. (D) misses 00011. Answer: (B).
Concept: Trace ε-closures: the path through state 3 contributes an odd block of 0s followed by pairs of 1s. Checking short strings such as 0, 011, 00011 separates the options.
Consider an array X that contains n positive integers. A subarray of X is defined to be a sequence of array locations with consecutive indices.
The C code snippet given below has been written to compute the length of the longest subarray of X that contains at most two distinct integers. The code has two missing expressions labelled (P) and (Q).
Which one of the following options gives the CORRECT missing expressions?
(Hint: At the end of the i-th iteration, the value of len1 is the length of the longest subarray ending with X[i] that contains all equal values, and len2 is the length of the longest subarray ending with X[i] that contains at most two distinct values.)
int first=0, second=0, len1=0, len2=0, maxlen=0;
for (int i=0; i < n; i++) {
if (X[i] == first) {
len2++; len1++;
} else if (X[i] == second) {
len2++;
len1 = (P);
second = first;
} else {
len2 = (Q);
len1 = 1; second = first;
}
if (len2 > maxlen) {
maxlen = len2;
}
first = X[i];
}- (A)(P) len1+1 (Q) len2+1
- (B)(P) 1 (Q) len1+1
- (C)(P) 1 (Q) len2+1
- (D)(P) len2+1 (Q) len1+1
first is the previous element and second the other value in the current two-value window. If X[i] equals second (not first), the window still has two values, so len2++; but the run of equal values ending at X[i] restarts, so len1 = 1 (P = 1). If X[i] is a new third value, the longest two-value subarray ending at X[i] is the run of the previous value (length len1) plus X[i]: len2 = len1 + 1 (Q). Answer: (B) (P) 1, (Q) len1+1.
Concept: Maintaining run-length invariants. When a new value appears, only the trailing run of the previous value can stay in the window - not the whole old window (len2+1 is the trap).
Consider the following expression: x[i] = (p + r) * −s[i] + u/w. The following sequence shows the list of triples representing the given expression, with entries missing for triples (1), (3), and (6).
(0) + p r
(1) ...
(2) uminus (1)
(3) ...
(4) / u w
(5) + (3) (4)
(6) ...
(7) = (6) (5)
Which one of the following options fills in the missing entries CORRECTLY?
- (A)(1) =[] s i (3) * (0) (2) (6) []= x i
- (B)(1) []= s i (3) − (0) (2) (6) =[] x (5)
- (C)(1) =[] s i (3) * (0) (2) (6) []= x (5)
- (D)(1) []= s i (3) − (0) (2) (6) =[] x i
(1) must fetch s[i] for uminus: an indexed read, written =[] s i. (2) negates it. (3) multiplies (p + r) by −s[i]: * (0) (2). (4) and (5) add u/w. The assignment to x[i] is split into an indexed-store triple that computes the location, []= x i, and triple (7) = (6) (5) assigns the value (5) to it. Answer: (A).
Concept: In triples, an array store x[i] = y needs two triples: []= x i, then an assignment using it. The read s[i] uses =[]. Option C puts (5) inside (6), duplicating (7).
Let x and y be random variables, not necessarily independent, that take real values in the interval [0,1]. Let z = xy and let the mean values of x, y, z be x̄, ȳ, z̄, respectively. Which one of the following statements is TRUE?
- (A)z̄ = x̄ȳ
- (B)z̄ ≤ x̄ȳ
- (C)z̄ ≥ x̄ȳ
- (D)z̄ ≤ x̄
Since 0 ≤ y ≤ 1 and x ≥ 0, z = xy ≤ x always, so E[z] ≤ E[x], i.e. z̄ ≤ x̄ - (D) always holds. The others fail without independence: if x = y uniform on [0,1], z̄ = E[x²] = 1/3 > 1/4 = x̄ȳ, breaking (A) and (B); if y = 1 − x, z̄ = E[x − x²] = 1/6 < 1/4, breaking (C). Answer: (D).
Concept: E[xy] = E[x]E[y] needs independence (zero covariance). Only the pointwise bound xy ≤ x survives for dependent variables.
The relation schema, Person(pid, city), describes the city of residence for every person uniquely identified by pid. The following relational algebra operators are available: selection, projection, cross product, and rename.
To find the list of cities where at least 3 persons reside, using the above operators, the minimum number of cross product operations that must be used is
- (A)1
- (B)2
- (C)3
- (D)4
With no aggregation, 'at least 3 persons' needs three distinct tuples of Person in the same city. Rename three copies P1, P2, P3 and form P1 × P2 × P3 (2 cross products), select P1.city = P2.city = P3.city with P1.pid ≠ P2.pid, P2.pid ≠ P3.pid, P1.pid ≠ P3.pid, and project city. With one cross product only two persons can be compared at once, which cannot certify three. Answer: (B) 2.
Concept: Counting to k without aggregation needs k copies of the relation, i.e. k − 1 cross products, with pairwise inequality on the key.
Consider a multi-threaded program with two threads T1 and T2. The threads share two semaphores: s1 (initialized to 1) and s2 (initialized to 0). The threads also share a global variable x (initialized to 0). The threads execute the code shown below.
Which of the following outcomes is/are possible when threads T1 and T2 execute concurrently?
// code of T1 // code of T2
wait(s1); wait(s1);
x = x+1; x = x+1;
print(x); print(x);
wait(s2); signal(s2);
signal(s1); signal(s1);
- (A)T1 runs first and prints 1, T2 runs next and prints 2
- (B)T2 runs first and prints 1, T1 runs next and prints 2
- (C)T1 runs first and prints 1, T2 does not print anything (deadlock)
- (D)T2 runs first and prints 1, T1 does not print anything (deadlock)
If T1 enters first: it takes s1, prints 1, then blocks on wait(s2) (s2 = 0) while still holding s1. T2 blocks on wait(s1). Deadlock, T2 prints nothing: (C) possible, (A) impossible. If T2 enters first: it takes s1, prints 1, signals s2 (s2 = 1) and s1. T1 then enters, prints 2, wait(s2) succeeds, signals s1. So (B) possible and (D) impossible. Answer: (B), (C).
Concept: Holding a mutex while waiting on another semaphore that only the blocked thread can signal is a classic deadlock. Trace both entry orders.
Let A be an n × n matrix over the set of all real numbers ℝ. Let B be a matrix obtained from A by swapping two rows. Which of the following statements is/are TRUE?
- (A)The determinant of B is the negative of the determinant of A
- (B)If A is invertible, then B is also invertible
- (C)If A is symmetric, then B is also symmetric
- (D)If the trace of A is zero, then the trace of B is also zero
(A) A row swap multiplies the determinant by −1 - true. (B) det B = −det A ≠ 0, so B is invertible - true. (C) False: A = [[1,2],[2,3]] is symmetric, but swapping its rows gives B = [[2,3],[1,2]], which is not. (D) False: A = [[0,1],[1,0]] has trace 0, swapping rows gives I with trace 2. Answer: (A), (B).
Concept: Elementary row operations: a swap flips the determinant's sign but keeps it non-zero. Symmetry and trace depend on positions of entries, so they are not preserved.
Let S1 and S2 be two stacks. S1 has capacity of 4 elements. S2 has capacity of 2 elements. S1 already has 4 elements: 100, 200, 300, and 400 (400 on top), whereas S2 is empty.
Only the following three operations are available:
PushToS2: Pop the top element from S1 and push it on S2.
PushToS1: Pop the top element from S2 and push it on S1.
GenerateOutput: Pop the top element from S1 and output it to the user.
Note that the pop operation is not allowed on an empty stack and the push operation is not allowed on a full stack.
Which of the following output sequences can be generated by using the above operations?
- (A)100, 200, 400, 300
- (B)200, 300, 400, 100
- (C)400, 200, 100, 300
- (D)300, 200, 400, 100
(A) Outputting 100 first needs 400, 300, 200 parked in S2, but S2 holds only 2 - impossible. (B) PushToS2 (400), PushToS2 (300), output 200, PushToS1, output 300, PushToS1, output 400, output 100 - possible. (C) Output 400, PushToS2 (300), output 200, output 100, PushToS1, output 300 - possible. (D) PushToS2 (400), output 300, output 200, PushToS1, output 400, output 100 - possible. Answer: (B), (C), (D).
Concept: Simulating stack permutations with a bounded auxiliary stack. The capacity of S2 is what rules out reaching the bottom element first.
Which of the following is/are EQUAL to 224 in radix-5 (i.e., base-5) notation?
- (A)64 in radix-10
- (B)100 in radix-8
- (C)50 in radix-16
- (D)121 in radix-7
224 in base 5 = 2·25 + 2·5 + 4 = 64. (A) 64 in base 10 = 64. (B) 100 in base 8 = 64. (C) 50 in base 16 = 5·16 = 80. (D) 121 in base 7 = 49 + 14 + 1 = 64. Answer: (A), (B), (D).
Concept: Convert everything to decimal with positional weights. Hex 50 is 80, not 50 - the usual slip is reading the digits as decimal.
Consider 4-variable functions f1, f2, f3, f4 expressed in sum-of-minterms form as given below.
f1 = Σ(0,2,3,5,7,8,11,13)
f2 = Σ(1,3,5,7,11,13,15)
f3 = Σ(0,1,4,11)
f4 = Σ(0,2,6,13)
In the circuit, f1 and f2 feed a 2-input AND gate, f3 and f4 feed a 2-input OR gate, and the outputs of the AND gate and the OR gate feed a 2-input XOR gate whose output is Y.
With respect to the circuit given above, which of the following options is/are CORRECT?
- (A)Y = Σ(0,1,2,11,13)
- (B)Y = Π(3,4,5,6,7,8,9,10,12,14,15)
- (C)Y = Σ(0,1,2,3,4,5,6,7)
- (D)Y = Π(8,9,10,11,12,13,14,15)
Y = (f1 · f2) ⊕ (f3 + f4). f1 · f2 = common minterms = {3,5,7,11,13}. f3 + f4 = {0,1,2,4,6,11,13}. XOR keeps minterms in exactly one of them: 11 and 13 cancel, leaving {3,5,7} ∪ {0,1,2,4,6} = {0,1,2,3,4,5,6,7}. So Y = Σ(0,1,2,3,4,5,6,7) = Π(8,9,10,11,12,13,14,15). Answer: (C), (D).
Concept: AND is intersection, OR is union and XOR is symmetric difference of minterm sets. Options in Π form list the maxterms, i.e. the complement set.
Let G be an undirected connected graph in which every edge has a positive integer weight. Suppose that every spanning tree in G has even weight. Which of the following statements is/are TRUE for every such graph G ?
- (A)All edges in G have even weight
- (B)All edges in G have even weight OR all edges in G have odd weight
- (C)In each cycle C in G, all edges in C have even weight
- (D)In each cycle C in G, either all edges in C have even weight OR all edges in C have odd weight
Take any cycle C and two edges e, f on it. Extend the path C − f to a spanning tree T (it contains e, not f). T − e + f is also a spanning tree, and both have even weight, so w(f) − w(e) is even: e and f have the same parity. Hence every cycle is all-even or all-odd: (D) true. Counterexamples: a triangle with weights 1, 1, 1 (every spanning tree weighs 2) breaks (A) and (C); a path (a tree) with weights 1, 1, 2 has its only spanning tree of weight 4, breaking (B). Answer: (D).
Concept: Spanning-tree exchange: swapping one cycle edge for another keeps a spanning tree, so cycle edges must share parity. Edges not on a common cycle (bridges) can differ.
Consider a context-free grammar G with the following 3 rules.
S → aS, S → aSbS, S → c
Let w ∈ L(G). Let na(w), nb(w), nc(w) denote the number of times a, b, c occur in w, respectively. Which of the following statements is/are TRUE?
- (A)na(w) > nb(w)
- (B)na(w) > nc(w) − 2
- (C)nc(w) = nb(w) + 1
- (D)nc(w) = nb(w) ∗ 2
Track the number of S symbols in a sentential form. Start with 1. S → aS keeps it, S → aSbS adds one S and one b (and one a), S → c removes an S and adds a c. Every S ends as a c, so nc = 1 + nb: (C) true and (D) false (w = c gives 1 ≠ 0). Each b comes with an a, so na ≥ nb, but w = acbc has na = nb = 1, so (A) false. Since nc − 2 = nb − 1 ≤ na − 1 < na, (B) true. Answer: (B), (C).
Concept: Invariant counting over derivations. Check strict inequalities against the smallest strings (c, acbc) to catch equal cases.
Consider a disk with the following specifications: rotation speed of 6000 RPM, average seek time of 5 milliseconds, 500 sectors/track, 512-byte sectors.
A file has content stored in 3000 sectors located randomly on the disk. Assuming average rotational latency, the total time (in seconds, rounded off to 2 decimal places) to read the entire file from the disk is _________
6000 RPM = 100 rotations per second, so one rotation = 10 ms and average rotational latency = 5 ms. Transfer of one sector = 10 ms / 500 = 0.02 ms. Sectors are random, so each needs seek + latency + transfer = 5 + 5 + 0.02 = 10.02 ms. Total = 3000 × 10.02 ms = 30.06 s. The official key accepts 29.5 to 30.5 (ignoring the tiny transfer time gives 30.00). Answer: 30.06.
Concept: For randomly placed sectors every access pays the full seek and half-rotation latency. The trap is treating the file as contiguous and paying seek once.
Consider a TCP connection operating at a point of time with the congestion window of size 12 MSS (Maximum Segment Size), when a timeout occurs due to packet loss. Assuming that all the segments transmitted in the next two RTTs (Round Trip Time) are acknowledged correctly, the congestion window size (in MSS) during the third RTT will be _________
On timeout, ssthresh = 12/2 = 6 MSS and cwnd resets to 1 MSS, entering slow start. RTT 1: cwnd = 1; all acknowledged, cwnd = 2. RTT 2: cwnd = 2; all acknowledged, cwnd = 4. Still below ssthresh 6, so during the third RTT cwnd = 4 MSS. Answer: 4.
Concept: Timeout means cwnd = 1 and slow start (doubling per RTT) up to ssthresh = half the old window. Fast-recovery halving applies to triple duplicate ACKs, not timeouts.
Consider an Ethernet segment with a transmission speed of 10⁸ bits/sec and a maximum segment length of 500 meters. If the speed of propagation of the signal in the medium is 2 × 10⁸ meters/sec, then the minimum frame size (in bits) required for collision detection is _________
One-way propagation delay = 500 / (2 × 10⁸) = 2.5 µs. For CSMA/CD the transmission time must be at least the round-trip time 2 × 2.5 = 5 µs. Minimum frame = 10⁸ × 5 × 10⁻⁶ = 500 bits. Answer: 500.
Concept: CSMA/CD requires frame transmission time ≥ 2 × propagation delay so the sender is still transmitting when a collision returns. Using one-way delay gives 250, the trap.
A functional dependency F: X → Y is termed as a useful functional dependency if and only if it satisfies all the following three conditions:
- X is not the empty set.
- Y is not the empty set.
- Intersection of X and Y is the empty set.
For a relation R with 4 attributes, the total number of possible useful functional dependencies is ________
Each attribute goes to X, to Y, or to neither: 3⁴ = 81 assignments with X and Y disjoint. Remove those with X empty (each attribute in Y or neither: 2⁴ = 16) and those with Y empty (16), adding back the one with both empty: 81 − 16 − 16 + 1 = 50. Answer: 50.
Concept: Counting ordered pairs of disjoint non-empty subsets via 3ⁿ and inclusion-exclusion. Forgetting to add back the both-empty case gives 49.
A processor with 16 general purpose registers uses a 32-bit instruction format. The instruction format consists of an opcode field, an addressing mode field, two register operand fields, and a 16-bit scalar field. If 8 addressing modes are to be supported, the maximum number of unique opcodes possible for every addressing mode is _________
Register fields: 16 registers need 4 bits each, 2 × 4 = 8 bits. Addressing mode: 8 modes need 3 bits. Scalar: 16 bits. Opcode bits = 32 − 8 − 3 − 16 = 5, so 2⁵ = 32 opcodes for every addressing mode. Answer: 32.
Concept: Instruction field budgeting. The addressing-mode field is separate, so each mode gets the full opcode space.
A non-pipelined instruction execution unit operating at 2 GHz takes an average of 6 cycles to execute an instruction of a program P. The unit is then redesigned to operate on a 5-stage pipeline at 2 GHz. Assume that the ideal throughput of the pipelined unit is 1 instruction per cycle. In the execution of program P, 20% instructions incur an average of 2 cycles stall due to data hazards and 20% instructions incur an average of 3 cycles stall due to control hazards. The speedup (rounded off to one decimal place) obtained by the pipelined design over the non-pipelined design is _________
Pipelined CPI = 1 + 0.2 × 2 + 0.2 × 3 = 1 + 0.4 + 0.6 = 2. Non-pipelined CPI = 6. The clock is the same 2 GHz, so speedup = 6 / 2 = 3.0. Answer: 3.0.
Concept: Effective CPI = ideal CPI + average stall cycles per instruction. Using 5 (stage count) instead of the given 6 cycles is the trap.
The number of distinct minimum-weight spanning trees of the following graph is _________
Graph on vertices a, b, c, d, e, f, g with edges (weight in brackets): a-b (1), a-f (1), a-g (2), b-g (2), b-c (3), c-g (2), c-d (1), d-g (2), d-e (1), e-g (2), f-g (2), f-e (3).
Take all weight-1 edges (no cycle): a-b, a-f, c-d, d-e. Components: {a,b,f}, {c,d,e}, {g}. Two more edges are needed. The cheapest connections are weight 2, all through g: g to {a,b,f} via a-g, b-g or f-g (3 choices) and g to {c,d,e} via c-g, d-g or e-g (3 choices). The direct links between {a,b,f} and {c,d,e} (b-c, f-e) weigh 3, so they never appear. MST weight 4 + 4 = 8 and the count is 3 × 3 = 9. Answer: 9.
Concept: Counting MSTs with ties: contract the forced lighter edges, then multiply the number of equal-weight choices for each required connection.
The chromatic number of a graph is the minimum number of colours used in a proper colouring of the graph. The chromatic number of the following graph is _________
Graph: 8 vertices placed on an octagon and numbered 1 to 8 in order around it. Edges: the octagon sides 1-2, 2-3, 3-4, 4-5, 5-6, 6-7, 7-8, 8-1, and the chords 1-4, 1-6, 2-5, 2-7, 3-6, 3-8, 4-7, 5-8.
Colour odd-numbered vertices red and even-numbered vertices blue. Every edge joins vertices whose labels differ by an odd amount (sides differ by 1 or 7, chords by 3 or 5), so every edge joins an odd and an even vertex: the graph is bipartite and 2 colours suffice. It has edges, so 1 colour is not enough. Answer: 2.
Concept: A graph is 2-colourable exactly when it is bipartite (no odd cycle). The crossing chords make the picture look dense, which tempts answers of 3 or 4.
A processor uses a 32-bit instruction format and supports byte-addressable memory access. The ISA of the processor has 150 distinct instructions. The instructions are equally divided into two types, namely R-type and I-type, whose formats are shown below.
R-type Instruction Format: OPCODE | UNUSED | DST Register | SRC Register 1 | SRC Register 2
I-type Instruction Format: OPCODE | DST Register | SRC Register | # Immediate value/address
In the OPCODE, 1 bit is used to distinguish between I-type and R-type instructions and the remaining bits indicate the operation. The processor has 50 architectural registers, and all register fields in the instructions are of equal size.
Let X be the number of bits used to encode the UNUSED field, Y be the number of bits used to encode the OPCODE field, and Z be the number of bits used to encode the immediate value/address field. The value of X + 2Y + Z is ________
75 instructions of each type need ⌈log₂ 75⌉ = 7 operation bits, plus 1 type bit: Y = 8. 50 registers need 6 bits per register field. R-type: 8 + X + 3 × 6 = 32, so X = 6. I-type: 8 + 2 × 6 + Z = 32, so Z = 12. X + 2Y + Z = 6 + 16 + 12 = 34. Answer: 34.
Concept: Field budgeting with a type bit: the 7 operation bits encode 75 operations per type, not 150. Using 8 operation bits gives Y = 9 and a wrong total.
Let L1 be the language represented by the regular expression b*ab*(ab*ab*)* and L2 = {w ∈ (a + b)* | |w| ≤ 4}, where |w| denotes the length of string w. The number of strings in L2 which are also in L1 is ___________
b*ab* contributes exactly one a, and each (ab*ab*) block adds two more, with b's anywhere: L1 = strings over {a,b} with an odd number of a's. Count those of length ≤ 4. Length 1: 1 (a). Length 2: C(2,1) = 2. Length 3: C(3,1) + C(3,3) = 4. Length 4: C(4,1) + C(4,3) = 8. Total = 1 + 2 + 4 + 8 = 15. Answer: 15.
Concept: Recognise the expression as 'odd number of a's'; half of the 2ⁿ strings of each length n ≥ 1 qualify, giving 2ⁿ⁻¹ each.
Let Zn be the group of integers {0, 1, 2, ..., n − 1} with addition modulo n as the group operation. The number of elements in the group Z2 × Z3 × Z4 that are their own inverses is ________
An element is its own inverse when g + g = 0, componentwise. In Z2 both 0 and 1 satisfy 2g = 0 (2 choices). In Z3 only 0 (2g ≡ 0 mod 3 forces g = 0). In Z4, 0 and 2 (2 choices). Total = 2 × 1 × 2 = 4. Answer: 4.
Concept: Self-inverse elements in a direct product are tuples of self-inverse components. Remember the identity counts as its own inverse.
Consider a 32-bit system with 4 KB page size and page table entries of size 4 bytes each. Assume 1 KB = 2¹⁰ bytes. The OS uses a 2-level page table for memory management, with the page table containing an outer page directory and an inner page table. The OS allocates a page for the outer page directory upon process creation. The OS uses demand paging when allocating memory for the inner page table, i.e., a page of the inner page table is allocated only if it contains at least one valid page table entry.
An active process in this system accesses 2000 unique pages during its execution, and none of the pages are swapped out to disk. After it completes the page accesses, let X denote the minimum and Y denote the maximum number of pages across the two levels of the page table of the process.
The value of X+Y is ________
A 4 KB page holds 4096/4 = 1024 entries, so each inner page-table page maps 1024 pages and the directory has 1024 entries (2²⁰ pages total). Minimum: 2000 pages packed contiguously need ⌈2000/1024⌉ = 2 inner pages, plus the directory: X = 3. Maximum: spread the pages so each inner page has as few valid entries as possible, but there are only 1024 inner pages possible: Y = 1024 + 1 = 1025. X + Y = 1028. Answer: 1028.
Concept: Two-level paging bounds: dense placement minimises inner tables; sparse placement is capped by the directory's 1024 entries, not by 2000.
Consider the following augmented grammar, which is to be parsed with a SLR parser. The set of terminals is {a,b,c,d,#,@}
S′ → S
S → SS | Aa | bAc | Bc | bBa
A → d#
B → @
Let I0 = CLOSURE({S′ → •S}). The number of items in the set GOTO(I0, S) is ___________
I0 contains S′ → •S, S → •SS, S → •Aa, S → •bAc, S → •Bc, S → •bBa, A → •d#, B → •@. GOTO(I0, S) moves the dot over S in S′ → •S and S → •SS, giving the kernel S′ → S• and S → S•S. Closure of S → S•S adds all S-items S → •SS, S → •Aa, S → •bAc, S → •Bc, S → •bBa, and then A → •d# and B → •@. Total = 2 + 5 + 2 = 9. Answer: 9.
Concept: GOTO = advance the dot, then take the closure. Forgetting to close over A and B (reached via •Aa and •Bc) gives 7.
Answers are the official GATE answer key. Questions that depend on a figure are left out until they can be shown faithfully.