GATE 2021 CS (CS2) – Previous Year Questions with Solutions
All 65 questions of GATE 2021 CS (CS2) with answers and explanations. Read each question, then practise it by topic or as a full paper.
Practise this paper in The GATE Grind →
- Question 1 – Gauri said that she can play the keyboard her sister.
- Question 2 – A transparent square sheet is folded along the dotted vertical line, bringing the left half onto the right. Which option shows the folded sheet?
- Question 3 – If θ is the angle between the longest diagonal of a cube and any edge, find cos θ.
- Question 4 – If (x-12)2-(x-32)2=x+2, find x.
- Question 5 – Pen : Write :: Knife :
- Question 6 – Listening to music during exercise improves performance and reduces discomfort. Research on music while studying was inconclusive: students needing…
- Question 7 – A jigsaw has two pieces. One is shown above the four candidate missing pieces. The pieces may be translated, rotated or flipped. Which missing piece…
- Question 8 – Three classes initially have student counts in ratio 3:13:6. Adding 18 to every class changes the ratio to 15:35:21. Find the initial total.
- Question 9 – The chart gives sales units and total net profits for three years. Cost per unit in Year 3 is 1, half that in Year 2 and one third that in Year 1. Tax…
- Question 10 – P,Q,R,S,T,U have distinct heights. S is taller than R; Q is shortest; U is taller than only one student; T is taller than S but is not tallest. The…
- Question 11 – G is connected, undirected and weighted. S1: Some minimum-weight edge of G is present in every MST. S2: If all edge weights are distinct, G has a…
- Question 12 – A binary min-heap of n elements is stored in an array. Find the worst-case complexity of an optimal algorithm to find its maximum.
- Question 13 – Which phase of a seven-phase ANSI C compiler reports the error? Assume Integer has not been declared as a type.
- Question 14 – For IEEE 754 single precision, which exponent/fraction fields represent the smallest normalized positive value? The sign is zero.
- Question 15 – Which 4-to-1 multiplexer implements f(x,y,z)=Σm(0,1,3,4,5,6), with select lines s1=y,s0=z?
- Question 16 – S1: A relation schema can have at most one foreign key. S2: A foreign key in schema R cannot refer to tuples of R itself. Which are true?
- Question 17 – P and Q choose initial TCP sequence numbers X and Y. P sends SYN=1,SEQ=X,ACK=0 to request a connection. Which header does Q return on accepting?
- Question 18 – Find the worst-case number of arithmetic operations in recursive binary search on a sorted n-element array.
- Question 19 – Regular L⊆0,1* has a minimal DFA with k states. Which language necessarily also has a minimal DFA with k states?
- Question 20 – What is printed by this source C program under its contiguous-array addressing model?
- Question 21 – For n≥2, S1 contains all n×n matrices over a,b,c, and S2 contains all functions from \0,1,,n2-1\ to 0,1,2. Which are correct?
- Question 22 – L1 is regular and L2 is context-free. Which are necessarily context-free?
- Question 23 – Which are NOT intermediate representations of a source program?
- Question 24 – Which statements about CPU scheduling are correct?
- Question 25 – For S:((P Q) R)((P Q)(Q R)), choose the correct statements.
- Question 26 – In a complete binary tree with seven nodes, A is the set of the first three nodes visited by root-started BFS and B the set of the first three visited…
- Question 27 – For the DFA shown, how many binary strings of length eight are accepted?
- Question 28 – For decimal digits x,y, (0.1101)₂=(0.8xy5)₁₀. Find x+y.
- Question 29 – A byte-addressable set-associative cache is 2 KB, with 64-byte blocks and 32-bit addresses. Its tag is 22 bits wide. Find the associativity.
- Question 30 – A 2 MHz processor supports cycle-stealing DMA. The DMA transfers one 8-bit character in one CPU cycle at regular intervals. If DMA uses 0.5% of CPU…
- Question 31 – A sorted data file has 150000 student records and 4096-byte blocks. Disk record pointers are 7 bytes; candidate-key Anum is 12 bytes. A dense index…
- Question 32 – A biased coin has P(head)=0.4. Let X count heads in 1000 independent tosses. Find its standard deviation, rounded to two decimal places.
- Question 33 – Find SomeFunction(15,255).
- Question 34 – P is a 4×5 matrix whose null space is spanned by [2,5,4,3,1]ᵀ. Find rank(P).
- Question 35 – f is continuous on [−3,3] and differentiable on (−3,3), with f′(x)≤2. If f(−3)=7, find the greatest possible f(3).
- Question 36 – Assign a binary prefix code to each letter of abbccdddee. For letters with equal frequencies, a letter earlier in dictionary order must have code…
- Question 37 – L1 and larger L2 form an inclusive cache hierarchy. S1: Read misses in a write-through L1 never cause dirty-line writebacks to L2. S2: Write-allocate…
- Question 38 – A synchronous circuit replaces the first 1 of every maximal run of consecutive ones by 0, leaving other bits unchanged. It is a two-state Mealy…
- Question 39 – A student chooses the order for independent questions A,B. A is answered correctly with probability 0.8 and gives 10 marks; B has probability 0.5 and…
- Question 40 – Apply common-subexpression elimination to the code. y points to a heap struct with f1,f2; x,y,z,p,q,i reside in registers. Count additions and…
- Question 41 – emp(empId,name,gender,salary,deptId) has key empId, and each employee belongs to one department. What does this query count for each department? It…
- Question 42 – Schedule S is R2(Y),R1(X),R3(Z),R1(Y),W1(X),R2(Z),W2(Y),R3(X),W3(Z). P: S is conflict-serializable. Q: If T3 commits before T1 finishes, S is…
- Question 43 – A bag initially has r red and b black balls. In each trial, draw a ball uniformly, note its colour, then return it with one additional ball of the…
- Question 44 – A CRC generator is X³+X+1. The five-bit message is 11000. Find the appended three-bit check sequence c2c1c0.
- Question 45 – Which statement about this C program is correct?
- Question 46 – S1: Every infinite regular language has an undecidable language as a subset. S2: Every finite language is regular. Which are true?
- Question 47 – Define s(P,Q)= i=1nP[i]Q[i]. A set L of nonzero ten-dimensional real vectors satisfies s(P,Q)=0 for every distinct pair. Find the maximum L .
- Question 48 – For statement S, USE(S) contains variables used in S; IN(S) those live at entry; OUT(S) those live at exit. A basic block consists of S1 immediately…
- Question 49 – For constants a≥1,b>1, T(n)=aT(n/b)+f(n). Which general claim is correct, under the usual positive constant base-case assumptions?
- Question 50 – On U(P,Q,R,S,T), dependencies P→QR and RS→T hold. Which can be inferred?
- Question 51 – For binary strings, wR is reversal. Which languages are context-free? w,x may be empty.
- Question 52 – Processes P1,P2 each execute this code with ordinary process-private globals; each creates two threads. Which statements hold?
- Question 53 – There is one instance of each resource type. Under a global lock L, OwnResource(R) acquires R if available. Otherwise it terminates the other owner P,…
- Question 54 – The same two bytes interpreted as an unsigned integer have a little-endian numerical value 255 greater than their big-endian value. Which hexadecimal…
- Question 55 – Distance-vector router R has neighbours X,Y,Z with link costs 3,2,5. Their advertised distances to P are 7,6,5 and to Q are 4,6,8. R initially does…
- Question 56 – For the directed graph shown, which statements hold?
- Question 57 – Which regular expressions denote the binary numbers divisible by three? Leading zeros are allowed and ε is treated as divisible by three. Here + means…
- Question 58 – A three-level page table translates 39-bit virtual addresses with fields: level-1 index 9 bits, level-2 index 9, level-3 index 9, page offset 12.…
- Question 59 – What does this program print?
- Question 60 – S has ten elements. How many ordered tuples (A,B) of subsets of S satisfy A⊆B?
- Question 61 – The augmented grammar is S′→S; S→S#cS SS S@ <S> a b c, with #,@,<,>,a,b,c terminals. Let I0=CLOSURE(S′→·S). Find the number of LR(0) items in…
- Question 62 – Boolean f(w,x,y,z) satisfies f(w,0,0,z)=1, f(1,x,1,z)=x+z, f(w,1,y,z)=wz+y. Find the number of literals in a minimal sum-of-products expression.
- Question 63 – A five-stage pipeline has IF,ID,EX,MEM,WB. All stages take one cycle except EX: ADD takes one and MUL two. ID decodes and reads registers. Instruction…
- Question 64 – A pure ALOHA network uses 1000-bit frames and a 1 Mbps link. The aggregate transmission rate, including retries, is a Poisson process of 1000…
- Question 65 – In the DAG shown with source s, a path’s quality is the product of its edge weights. A vertex’s quality is the maximum path quality from s;…