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
The and operations on counting semaphores, where s is a counting semaphore, are defined as follows: If then wait; If then wake up process waiting on s; Assume that and the wait and signal operations on binary semaphores are provided. Two binary semaphores …
The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing the integers in the given order. What will be the contents of the list after function completes execution? struct node { int value; struct node *next; }; void …
Choose the correct option to fill and so that the program below prints an input string in reverse order. Assume that the input string is terminated by a new line character. void reverse(void) { int c; if(?1) reverse(); ?2 } main() { printf("Enter text"); printf("\n"); reverse(); printf("\n"); }
A computer on a network is regulated by a token bucket. The token bucket is filled at a rate of . It is initially filled to capacity with . What is the maximum duration for which the computer can transmit at the full ?
What is printed by the following C program? int f(int x, int *py, int **ppz) { int y, z; **ppz += 1; z = **ppz; // corrected z = *ppz; to z = **ppz; *py += 2; y = *py; x += 3; return x+y+z; } void main() { int c, *b, **a; c = 4; b = &c; a = &b; printf("%d", f(c, b, a)); }
A client process P needs to make a TCP connection to a server process S. Consider the following situation: the server process S executes a , a and a system call in that order, following which it is preempted. Subsequently, the client process P executes a system call followed by …
If a class network on the Internet has a subnet mask of , what is the maximum number of hosts per subnet?
In the slow start phase of the TCP congestion algorithm, the size of the congestion window:
An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if
Which of the following are true? A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursion can be implemented with static storage allocation Multi-level access link (or display) arrangement is needed to arrange activation records only if the programming language being …
Which of the following are regular sets?
Match the following NFAs with the regular expressions they correspond to: P Q R S
Match the following: …
Which of the following statements is false?
We have a binary heap on elements and wish to insert more elements (not necessarily one after another) into this heap. The total time required for this is
You are given the postorder traversal, , of a binary search tree on the elements . You have to determine the unique binary search tree that has as its postorder traversal. What is the time complexity of the most efficient algorithm for doing this?
Dijkstra's single source shortest path algorithm when run from vertex in the above graph, computes the correct shortest path distance to
The subset-sum problem is defined as follows: Given a set of positive integers and a positive integer , determine whether there is a subset of whose elements sum to . An algorithm solves this problem in time. Which of the following statements is false?
Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let be the number of comparisons required to sort elements. Then
A B-tree of order is built from scratch by successive insertions. What is the maximum number of node splitting operations that may take place?
