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
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: is the rename operator). …
The relation scheme has the following functional dependencies: name, courseNo, grade rollNo, courseNo grade name rollNo rollNo name The highest normal form of this relation scheme is
A unix-style I-nodes has direct pointers and one single, one double and one triple indirect pointers. Disk block size is Kbyte, disk block address is bits, and -bit integers are used. What is the maximum possible file size?
Consider the following set of processes, with the arrival times and the CPU-burst times gives in milliseconds. …
Consider the grammar with the following translation rules and as the start symbol …
Consider two processes and accessing the shared variables and protected by two binary semaphores and respectively, both initialized to 1. and denote the usual semaphore operators, where decrements the semaphore value, and increments the semaphore value. The pseudo-code of and …
Suppose we run Dijkstra’s single source shortest path algorithm on the following edge-weighted directed graph with vertex as the source. In what order do the nodes get included into the set of vertices for which the shortest path distances are finalized?
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 …
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
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among will be the slowest?
What does the following algorithm approximate? (Assume ). x = m; y = 1; While (x-y > ϵ) { x = (x+y)/2; y = m/x; } print(x);
Two matrices and are to be stored in arrays and 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 will be
The elements are inserted one by one in the given order into a maxHeap. The resultant maxHeap is
A circularly linked list is used to represent a Queue. A single variable is used to access the Queue. To which node should point such that both the operations and can be performed in constant time?
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
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: …
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:
Consider the following program fragment for reversing the digits in a given integer to obtain a new integer. Let . 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 iteration is:
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 is:
The problem and are
