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
#include <stdio.h> int foo(int S[],int size) { if(size == 0) return 0; if(size == 1) return 1; if(S[0] != S[1]) return 1+foo(S+1,size-1); return foo(S+1,size-1); } int main() { int A[]={0,1,2,2,2,0,0,1,1}; printf("%d",foo(A,9)); return 0; } The value printed by the given program is ___________. (Answer in integer)
Let be a datatype for an implementation of linked list defined as follows: typedef struct list { int data; struct list *next; } LIST; Suppose a program has created two linked lists, and , whose contents are given in the figure below (code for creating and is not provided here). contains nodes, and …
Consider the following C program: #include <stdio.h> int gate (int n) { int d, t, newnum, turn; newnum = turn = 0; t=1; while (n>=t) t *= 10; t /=10; while (t>0) { d = n/t; n = n%t; t /= 10; if (turn) newnum = 10*newnum + d; turn = (turn + 1) % 2; } return newnum; } int main () { printf ("%d", gate(14362)); return 0; } The value printed by the …
The maximum value of such that the edge between the nodes and is included in every minimum spanning tree of the given graph is _________. (answer in integer)
In a double hashing scheme, and are the auxiliary hash functions. The size of the hash table is . The hash function for the -th probe in the open address table is . The following keys are inserted in the given order: . The slot …
Consider two grammars and with the production rules given below: …
Let . For , and , let denote the number of occurrences of in . Which one or more of the following option(s) define(s) regular language(s)?
Consider the database transactions T1 and T2 , and data items X and Y . Which of the schedule(s) is/are conflict serializable? …
Consider the following relational schema: Students ( name: string, age: integer, cgpa: real) Courses ( cname: string, credits: integer) Enrolled ( grade: string) Which of the following options is/are …
Given a computing system with two levels of cache (L1 and L2) and a main memory. The first level (L1) cache access time is nanosecond (ns) and the "hit rate" for L1 cache is while the processor is accessing the data from L1 cache. Whereas, for the second level (L2) cache, the "hit rate" is and the "miss penalty" for transferring …
A -stage instruction pipeline has stage delays of , and , respectively, in nanoseconds. The delay of an inter-stage latch is nanoseconds. Assume that there are no pipeline stalls due to branches and other hazards. The time taken to process instructions in microseconds is __________. (rounded off to two decimal …
In a - tree where each node can hold at most four key values, a root to leaf path consists of the following nodes: The -marked keys signify that these are data entries in a leaf. Assume that a pointer between keys and …
A computer system supports a logical address space of bytes. It uses two-level hierarchical paging with a page size of bytes. A logical address is divided into a -bit index to the outer page table, an offset within the page of the inner page table, and an offset within the desired page. Each entry of the inner page table uses eight …
Consider the following algorithm someAlgo that takes an undirected graph as input. someAlgo (G) Let be any vertex in . Run BFS on starting at . Let be a vertex in at maximum distance from as given by the BFS. Run BFS on again with as the starting vertex. Let be the vertex at maximum distance …
Let . For , let be the product of symbols in modulo 7. We take , where is the null string. For example, . Define …
An application executes number of instructions in seconds. There are four types of instructions, the details of which are given in the table. The duration of a clock cycle in nanoseconds is __________. (rounded off to one decimal place) …
Consider the following C program: #include<stdio.h> int main(){ int a; int arr[5] = {30,50,10}; int *ptr; ptr = &arr[0] + 1; a = *ptr; (*ptr)++; ptr++; printf("%d", a + (*ptr) + arr[1]); return 0; } The output of the above program is _________. (Answer in integer)
Consider the following C program: #include <stdio.h> int g(int n) { return (n+10); } int f(int n) { return g(n*2); } int main() { int sum, n; sum=0; for (n=1; n<3; n++) sum += g(f(n)); printf ("%d", sum); return 0; } The output of the given C program is ___________. (Answer in integer)
A quadratic polynomial over complex numbers is said to be square invariant if . Suppose from the set of all square invariant quadratic polynomials we choose one at random. The probability that the roots of the chosen polynomial are equal is __________. (rounded …
The unit interval is divided at a point chosen uniformly distributed over in into two disjoint subintervals. The expected length of the subinterval that contains is __________. (rounded off to two decimal places)
