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
Which one of the following statements is ?
Consider the table employee(empId, name, department, salary) and the two queries below. Assuming that department has more than one employee, and we want to find the employees who get higher salary than anyone in the department which one of the statements is TRUE for any arbitrary employee table? Select e.empId From …
Consider the relation employee(name, sex, supervisorName) with name as the key, supervisorName gives the name of the supervisor of the employee under consideration. What does the following Tuple Relational Calculus query produce? …
Two processes, and , need to access a critical section of code. Consider the following synchronization construct used by the processes: /* P1 */ while (true) { wants1 = true; while (wants2 == true); /* Critical Section */ wants1 = false; } /* Remainder section */ /* P2 */ while (true) { wants2 = true; while (wants1 == true); /* Critical Section …
A single processor system has three resource types and , which are shared by three processes. There are units of each resource type. Consider the following scenario, where the column alloc denotes the number of units of each resource type allocated to each process, and the column request denotes the number of units of each resource type …
A virtual memory system uses First In First Out (FIFO) page replacement policy and allocates a fixed number of frames to a process. Consider the following statements: P: Increasing the number of page frames allocated to a process sometimes increases the page fault rate. Q: Some programs do not exhibit locality of reference. Which one of the following is …
An operating system used Shortest Remaining System Time first (SRT) process scheduling algorithm. Consider the arrival times and execution times for the following processes: …
In a simplified computer the instructions are: …
Consider the following two statements: P: Every regular grammar is LL(1) Q: Every regular set has a LR(1) grammar Which of the following is TRUE?
Consider the grammar with non-terminals , terminals , with as the start symbol, and the following set of rules: The grammar is NOT LL(1) because:
Consider the following C program segment: int IsPrime (n) { int i, n; for (i=2; i<=sqrt(n);i++) if(n%i == 0) {printf("Not Prime \n"); return 0;} return 1; } Let denote number of times the loop is executed by the program on input . Which of the following is TRUE?
An array of numbers is given, where is an even number. The maximum as well as the minimum of these numbers needs to be determined. Which of the following is TRUE about the number of comparisons needed?
Let be the minimum weight among all edge weights in an undirected connected graph. Let be a specific edge of weight . Which of the following is FALSE?
Which of the following is TRUE about formulae in Conjunctive Normal Form?
Consider the process of inserting an element into a , where the 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:
Consider the following C program segment where 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 …
What is the of the following recursive function? int DoSomething (int n) { if (n <= 2) return 1; else return (DoSomething (floor (sqrt(n))) + n); }
In the following C function, let . 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?
A complete tree is a tree in which each node has children or no children. Let be the number of internal nodes and be the number of leaves in a complete tree. If and , what is the value of ?
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 ?
