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 PYQ2007Programming and Data StructuresBinary HeapsMCQ · 1 mark
Consider the process of inserting an element into a Max Heap\text{Max Heap}, where the Max Heap\text{Max Heap} is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is:
Official PYQ2007Programming and Data StructuresTreesMCQ · 1 mark
Consider the following C program segment where CellNode\text{CellNode} represents a node in a binary tree: struct CellNode { struct CellNode *leftChild; int element; struct CellNode *rightChild; }; int Getvalue (struct CellNode *ptr) { int value = 0; if (ptr != NULL) { if ((ptr->leftChild == NULL) && (ptr->rightChild == NULL)) value = 1; else value …
Official PYQ2007AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
What is the time complexity\text{time complexity} of the following recursive function? int DoSomething (int n) { if (n <= 2) return 1; else return (DoSomething (floor (sqrt(n))) + n); }
Official PYQ2007AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
In the following C function, let n≥mn \geq m. int gcd(n,m) { if (n%m == 0) return m; n = n%m; return gcd(m,n); } How many recursive calls are made by this function?
Official PYQ2007Programming and Data StructuresTreesMCQ · 1 mark
A complete n−aryn-ary tree is a tree in which each node has nn children or no children. Let II be the number of internal nodes and LL be the number of leaves in a complete n−aryn-ary tree. If L=41L = 41 and I=10I = 10, what is the value of nn?
Official PYQ2007Programming and Data StructuresRecursionMCQ · 1 mark
Consider the following C function: int f(int n) { static int r = 0; if (n <= 0) return 1; if (n > 3) { r = n; return f(n-2) + 2; } return f(n-1) + r; } What is the value of f(5)f(5)?
Official PYQ2007Programming and Data StructuresArrays, Stacks and QueuesMCQ · 1 mark
Consider a hash table of size seven, with starting index zero, and a hash function (3x+4)mod  7(3x + 4)\mod 7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1,3,8,101, 3, 8, 10 is inserted into the table using closed hashing? Note that − denotes an empty location in the table.
Official PYQ2007Programming and Data StructuresTreesMCQ · 1 mark
The inorder and preorder traversal of a binary tree are d b e a f c g\text{d b e a f c g} and a b d e c f g\text{a b d e c f g}, respectively The postorder traversal of the binary tree is:
Official PYQ2007AlgorithmsShortest Paths (Dijkstra, Bellman-Ford)MCQ · 1 mark
In an unweighted, undirected connected graph, the shortest path from a node SS to every other node is computed most efficiently, in terms of time complexity, by
Official PYQ2007Computer Organization and ArchitectureInstruction PipeliningMCQ · 1 mark
Consider a pipelined processor with the following four stages: IF: Instruction Fetch ID: Instruction Decode and Operand Fetch EX: Execute WB: Write Back The IF, ID and WB stages take one clock cycle each to complete the operation. The number of clock cycles for the EX stage depends on the instruction. The ADD and SUB instructions need 11 clock cycle and …
Official PYQ2007Digital LogicCombinational CircuitsMCQ · 1 mark
The control signal functions of a 44-bitbit binary counter are given below (where XX is “don’t care”): …
Official PYQ2007Digital LogicComputer ArithmeticMCQ · 1 mark
In a look-ahead carry generator, the carry generate function GiG_i and the carry propagate function PiP_i for inputs AiA_i and BiB_i are given by: Pi=Ai⊕Bi and Gi=AiBiP_i = A_i \oplus B_i \text{ and }G_i = A_iB_i The expressions for the sum bit SiS_i and the carry bit Ci+1C_{i+1} of the look ahead carry adder are given by: …
Official PYQ2007Digital LogicCombinational CircuitsMCQ · 1 mark
Suppose only one multiplexer and one inverter are allowed to be used to implement any Boolean function of nn variables. What is the minimum size of the multiplexer needed?
Official PYQ2007Digital LogicBoolean AlgebraMCQ · 1 mark
Define the connective ∗* for the Boolean variables XX and YY as: X∗Y=XY+X′Y′.X * Y = XY + X'Y'. Let Z=X∗YZ = X * Y. Consider the following expressions PP, QQ and RR. P:X=Y∗Z,Q:Y=X∗Z,R:X∗Y∗Z=1P : X = Y * Z, \\ Q :Y = X * Z, \\ R : X *Y * Z = 1 Which of the following is TRUE?
Official PYQ2007Digital LogicBoolean AlgebraMCQ · 1 mark
Let f(w,x,y,z)=∑(0,4,5,7,8,9,13,15)f(w, x, y, z) = \sum {\left(0,4,5,7,8,9,13,15\right)}. Which of the following expressions are NOT equivalent to ff? P: x′y′z′+w′xy′+wy′z+xzx'y'z' + w'xy' + wy'z + xz Q: w′y′z′+wx′y′+xzw'y'z' + wx'y' + xz R: w′y′z′+wx′y′+xyz+xy′zw'y'z' + wx'y' + xyz+xy'z S: x′y′z′+wx′y′+w′yx'y'z' + wx'y'+ w'y
Official PYQ2007Theory of ComputationRegular and Context-free LanguagesMCQ · 1 mark
The language L={0i21i∣i≥0}L=\left\{0^i21^i \mid i \geq 0\right\} over the alphabet {0,1,2}\left\{0, 1, 2\right\} is:
Official PYQ2007Theory of ComputationRegular and Context-free LanguagesMCQ · 1 mark
Which of the following languages is regular?
Official PYQ2007Theory of ComputationRegular Expressions and Finite AutomataMCQ · 1 mark
A minimum state deterministic finite automaton accepting the language L={w∣w∈{0,1}∗,L=\{w\mid w \in \{0, 1\}^*, number of 00s and 11s in ww are divisible by 33 and 55, respectively }\} has
Official PYQ2007Engineering MathematicsLinear Algebra: Matrices, Determinants, System of Linear EquationsMCQ · 1 mark
Consider the set of (column) vectors defined byX={x∈R3∣x1+x2+x3=0, where xT=[x1,x2,x3]T}X = \left \{x \in R^3 \mid x_1 + x_2 + x_3 = 0, \text{ where } x^T = \left[x_1,x_2,x_3\right]^T\right \}.Which of the following is TRUE?
Official PYQ2007Engineering MathematicsPartial Orders and LatticesMCQ · 1 mark
Consider the set S={a,b,c,d}.S =\{ a , b , c , d\}. Consider the following 44 partitions π1,π2,π3,π4π_1,π_2,π_3,π_4 on S:π1={abcd‾},π2={ab‾,cd‾},S : π_1 =\{\overline{abcd}\},\quad π_2 =\{\overline{ab}, \overline{cd}\}, π3={abc‾,d‾},π4={aˉ,bˉ,cˉ,dˉ}\quad π_3 = \{\overline{abc}, \overline{d}\},\quad π_4 =\{\bar{a}, \bar{b}, \bar{c}, \bar{d}\}. Let ≺\prec be the partial order on the set of partitions …