Skip to content

GATE CS question library

Practise GATE CS Computer Science previous year questions free. Browse by subject, syllabus topic, year and question type, with answers and available solutions.

Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.

20 on this page
Official PYQ2004Computer NetworksFragmentation and IP Addressing, IPv4, CIDRMCQ · 1 mark
Consider three IP networks A,BA, B and CC. Host HAH_A in network AA sends messages each containing 180180 bytesbytes of application data to a host HCH_C in network CC. The TCP layer prefixes 2020 byte header to the message. This passes through an intermediate network BB. The maximum packet size, including 2020 byte IP header, in each …
Official PYQ2004Compiler DesignLocal OptimizationMCQ · 1 mark
Consider the grammar rule E→E1–E2E \rightarrow E1 – E2 for arith­metic expressions. The code generated is targeted to a CPU having a single user register. The sub­traction operation requires the first operand to be in the register. If E1E1 and E2E2 do not have any com­mon sub expression, in order to get the shortest possible code
Official PYQ2004Programming and Data StructuresProgramming in CMCQ · 1 mark
Choose the best matching between the programming styles in Group 1 and their characteristics in Group 2. …
Official PYQ2004Computer Organization and ArchitectureMachine Instructions and Addressing ModesMCQ · 1 mark
Consider the following program segment for a hypothetical CPU having three user registers R1,R2R_1, R_2 and R3.R_3. \begin{array}{|l|l|c|} \hline \text {Instruction} & \text{Operation }& \text{Instruction size (in Words)} \\\hline \text{MOV R1,5000R_1,5000} & \text{R1R1} \leftarrow \text{Memory[5000][5000]}& \text{22} \\\hline\text{MOV …
Official PYQ2004Theory of ComputationUndecidabilityMCQ · 1 mark
L1L_1 is a recursively enumerable language over Σ\Sigma. An algorithm AA effectively enumerates its words as ω1,ω2,ω3,… .\omega_1, \omega_2, \omega_3, \dots . Define another language L2L_2 over Σ∪{#}\Sigma \cup \left\{\text{\#}\right\} as {wi#wj∣wi,wj∈L1,i<j}\left\{w_i \text{\#} w_j \mid w_i, w_j \in L_1, i < j \right\}. Here # is new symbol. Consider the following …
Official PYQ2004Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following grammar G: S→bS∣aA∣bS \rightarrow bS \mid aA \mid b A→bA∣aBA \rightarrow bA \mid aB B→bB∣aS∣aB \rightarrow bB \mid aS \mid a Let Na(w)N_a(w) and Nb(w)N_b(w) denote the number of a’s and b’s in a string ω\omega respectively. The language L(G)L(G) over {a,b}+\left\{a, b\right\}^+ generated by GG is
Official PYQ2004Theory of ComputationRegular Expressions and Finite AutomataMCQ · 1 mark
The following finite state machine accepts all those binary strings in which the number of 11’s and 00’s are respectively:
Official PYQ2004Theory of ComputationRegular and Context-free LanguagesMCQ · 1 mark
The language {ambncm+n∣m,n≥1}\left\{a^mb^nc^{m+n} \mid m, n \geq1\right\} is
Official PYQ2004Programming and Data StructuresBinary Search TreesMCQ · 1 mark
A program takes as input a balanced binary search tree with nn leaf nodes and computes the value of a function g(x)g(x) for each node xx. If the cost of computing g(x)g(x) is: min⁡(number of leaf-nodesin left-subtree of x  ,  number of leaf-nodesin right-subtree of x)\Large \min \left ( \substack{\text{number of leaf-nodes}\\\text{in left-subtree of $x$}}\;,\; \substack{\text{number of leaf-nodes}\\\text{in right-subtree of $x$}}\right ) …
Official PYQ2004AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
The recurrence equation T(1)=1T(1) = 1 T(n)=2T(n−1)+n,n≥2T(n) = 2T(n-1) + n, n \geq 2 evaluates to
Official PYQ2004AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
Let A[1,…,n]A[1,\ldots,n] be an array storing a bit (11 or 00) at each location, and f(m)f(m) is a function whose time complexity is Θ(m)\Theta(m). Consider the following program fragment written in a C like language: counter = 0; for (i=1; i<=n; i++) { if (a[i] == 1) counter++; else {f (counter); counter = 0;} } The complexity of this program fragment …
Official PYQ2004AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
The time complexity of the following C function is (assume n>0n > 0) int recursive (int n) { if(n == 1) return (1); else return (recursive (n-1) + recursive (n-1)); }
Official PYQ2004Engineering MathematicsGraphs: Connectivity, Matching, ColouringMCQ · 1 mark
Let G1=(V,E1)G_1=(V,E_1) and G2=(V,E2)G_2 =(V,E_2) be connected graphs on the same vertex set VV with more than two vertices. If G1∩G2=(V,E1∩E2)G_1 \cap G_2= (V,E_1\cap E_2) is not a connected graph, then the graph G1∪G2=(V,E1∪E2)G_1\cup G_2=(V,E_1\cup E_2)
Official PYQ2004Engineering MathematicsProbability: Random Variables and DistributionsMCQ · 1 mark
A point is randomly selected with uniform probability in the X−YX-Y plane within the rectangle with corners at (0,0),(1,0),(1,2)(0,0), (1,0), (1,2) and (0,2).(0,2). If pp is the length of the position vector of the point, the expected value of p2p^{2} is
Official PYQ2004Engineering MathematicsGraphs: Connectivity, Matching, ColouringMCQ · 1 mark
How many graphs on nn labeled vertices exist which have at least (n2−3n)2\frac{(n^2 - 3n)}{ 2} edges ?
Official PYQ2004Engineering MathematicsProbability: Random Variables and DistributionsMCQ · 1 mark
Two nn bit binary strings, S1S_1 and S2S_2 are chosen randomly with uniform probability. The probability that the Hamming distance between these strings (the number of bit positions where the two strings differ) is equal to dd is
Official PYQ2004Engineering MathematicsGraphs: Connectivity, Matching, ColouringMCQ · 1 mark
The minimum number of colours required to colour the following graph, such that no two adjacent vertices are assigned the same color, is
Official PYQ2004Engineering MathematicsLinear Algebra: Matrices, Determinants, System of Linear EquationsMCQ · 1 mark
In an M×NM \times N matrix all non-zero entries are covered in aa rows and bb columns. Then the maximum number of non-zero entries, such that no two are on the same row or column, is
Official PYQ2004Engineering MathematicsCombinatorics: Counting, Recurrence Relations, Generating FunctionsMCQ · 1 mark
Mala has the colouring book in which each English letter is drawn two times. She wants to paint each of these 5252 prints with one of kk colours, such that the colour pairs used to colour any two letters are different. Both prints of a letter can also be coloured with the same colour. What is the minimum value of kk that satisfies this requirement?
Official PYQ2004Engineering MathematicsProbability: Random Variables and DistributionsMCQ · 1 mark
An examination paper has 150150 multiple choice questions of one mark each, with each question having four choices. Each incorrect answer fetches −0.25-0.25 marks. Suppose 10001000 students choose all their answers randomly with uniform probability. The sum total of the expected marks obtained by all these students is