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 PYQ2004DatabasesNormal FormsMCQ · 1 mark
Consider the relation Student (name, sex, marks), where the primary key is shown underlined, pertaining to students in a class that has at least one boy and one girl. What does the following relational algebra expression produce? (Note: ρ\rho is the rename operator). …
Official PYQ2004DatabasesNormal FormsMCQ · 1 mark
The relation scheme Student Performance (name, courseNo, rollNo, grade)\text{Student Performance (name, courseNo, rollNo, grade)} has the following functional dependencies: name, courseNo, →\rightarrow grade rollNo, courseNo →\rightarrow grade name →\rightarrow rollNo rollNo →\rightarrow name The highest normal form of this relation scheme is
Official PYQ2004Operating SystemI/O SchedulingMCQ · 1 mark
A unix-style I-nodes has 1010 direct pointers and one single, one double and one triple indirect pointers. Disk block size is 11 Kbyte, disk block address is 3232 bits, and 4848-bit integers are used. What is the maximum possible file size?
Official PYQ2004Operating SystemCPU SchedulingMCQ · 1 mark
Consider the following set of processes, with the arrival times and the CPU-burst times gives in milliseconds. …
Official PYQ2004Compiler DesignSyntax-directed TranslationMCQ · 1 mark
Consider the grammar with the following translation rules and EE as the start symbol …
Official PYQ2004Operating SystemConcurrency and SynchronizationMCQ · 1 mark
Consider two processes P1P_1 and P2P_2 accessing the shared variables XX and YY protected by two binary semaphores SXS_X and SYS_Y respectively, both initialized to 1. PP and VV denote the usual semaphore operators, where PP decrements the semaphore value, and VV increments the semaphore value. The pseudo-code of P1P_1 and P2P_2 …
Official PYQ2004AlgorithmsShortest Paths (Dijkstra, Bellman-Ford)MCQ · 1 mark
Suppose we run Dijkstra’s single source shortest path algorithm on the following edge-weighted directed graph with vertex PP as the source. In what order do the nodes get included into the set of vertices for which the shortest path distances are finalized?
Official PYQ2004Programming and Data StructuresTreesMCQ · 1 mark
Consider the following C program segment struct CellNode{ struct CellNode *leftChild int element; struct CellNode *rightChild; }; int Dosomething (struct CellNode *ptr) { int value = 0; if(ptr != NULL) { if (ptr -> leftChild != NULL) value = 1 + DoSomething (ptr -> leftChild); if (ptr -> rightChild != NULL) value = max(value, 1 + Dosomething (ptr …
Official PYQ2004AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
Consider the following C program main() { int x, y, m, n; scanf("%d %d", &x, &y); /* Assume x>0 and y>0*/ m = x; n = y; while(m != n) { if (m > n) m = m-n; else n = n-m; } printf("%d", n); } The program computes
Official PYQ2004Programming and Data StructuresLinked ListsMCQ · 1 mark
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality\text{union, intersection, membership, cardinality} will be the slowest?
Official PYQ2004AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
What does the following algorithm approximate? (Assume m>1,ϵ>0m > 1, \epsilon >0). x = m; y = 1; While (x-y > ϵ) { x = (x+y)/2; y = m/x; } print(x);
Official PYQ2004AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
Two matrices M1M_1 and M2M_2 are to be stored in arrays AA and BB respectively. Each array can be stored either in row-major or column-major order in contiguous memory locations. The time complexity of an algorithm to compute M1×M2M_1 \times M_2 will be
Official PYQ2004Programming and Data StructuresBinary HeapsMCQ · 1 mark
The elements 32,15,20,30,12,25,16,32, 15, 20, 30, 12, 25, 16, are inserted one by one in the given order into a maxHeap. The resultant maxHeap is
Official PYQ2004Programming and Data StructuresLinked ListsMCQ · 1 mark
A circularly linked list is used to represent a Queue. A single variable pp is used to access the Queue. To which node should pp point such that both the operations enQueue\text{enQueue} and deQueue\text{deQueue} can be performed in constant time?
Official PYQ2004Programming and Data StructuresTreesMCQ · 1 mark
Consider the label sequences obtained by the following pairs of traversals on a labeled binary tree. Which of these pairs identify a tree uniquely? preorder and postorder inorder and postorder preorder and inorder level order and postorder
Official PYQ2004Object-Oriented Programming (Historical)MCQ · 1 mark
It is desired to design an object-oriented employee record system for a company. Each employee has a name, unique id, and salary. Employees belong to different categories and their salary is determined by their category. The functions get name, getId and compute salary are required. Given the class hierarchy below, possible locations for these functions are: …
Official PYQ2004Programming and Data StructuresProgramming in CMCQ · 1 mark
Consider the following C program segment: char p[20]; int i; char* s = "string"; int length = strlen(s); for(i = 0; i < length; i++) p[i] = s[length-i]; printf("%s", p); The output of the program is:
Official PYQ2004Programming and Data StructuresProgramming in CMCQ · 1 mark
Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let n=d1 d2 … dmn = d_1\, d_2\, \ldots\, d_m. int n, rev; rev = 0; while(n > 0) { rev = rev * 10 + n%10; n = n/10; } The loop invariant condition at the end of the ithi^{th} iteration is:
Official PYQ2004Programming and Data StructuresRecursionMCQ · 1 mark
Consider the following C function: int f(int n) { static int i = 1; if(n >= 5) return n; n = n+i; i++; return f(n); } The value returned by f(1)f(1) is:
Official PYQ2004AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
The problem 3-SAT\text{3-SAT} and 2-SAT\text{2-SAT} are