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 PYQ2006Operating SystemMemory Management and Virtual MemoryMCQ · 1 mark
A computer system supports 3232-bit virtual addresses as well as 3232-bit physical addresses. Since the virtual address space is of the same size as the physical address space, the operating system designers decide to get rid of the virtual memory entirely. Which one of the following is true?
Official PYQ2006Operating SystemCPU SchedulingMCQ · 1 mark
Consider three processes (process id 00, 11, 22 respectively) with compute time bursts 22, 44 and 88 time units. All processes arrive at time zero. Consider the longest remaining time first (LRTF) scheduling algorithm. In LRTF ties are broken by giving priority to the process with the lowest process id. The average turn around time is:
Official PYQ2006Operating SystemMemory Management and Virtual MemoryMCQ · 1 mark
A CPU generates 3232-bit virtual addresses. The page size is 44 KB. The processor has a translation look-aside buffer (TLB) which can hold a total of 128128 page table entries and is 44-way set associative. The minimum size of the TLB tag is:
Official PYQ2006Operating SystemConcurrency and SynchronizationMCQ · 1 mark
The atomic fetch-and-set x,yx, y instruction unconditionally sets the memory location xx to 11 and fetches the old value of xx in yy without allowing any intervening access to the memory location xx. Consider the following implementation of PP and VV functions on a binary semaphore SS. void P (binary_semaphore *s) { unsigned y; …
Official PYQ2006Compiler DesignLocal OptimizationMCQ · 1 mark
Consider the following C code segment. for (i = 0, i < n; i++) { for (j = 0; j < n; j++) { if (i%2) { x += (4*j + 5*i); y += (7 + 4*j); } } } Which one of the following is false?
Official PYQ2006Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following translation scheme. S→ERS\rightarrow ER R→∗E{print(‘∗’);}R∣εR\rightarrow *E\left \{ \text{print}(\text{‘}*\text{’}); \right \} R\mid \varepsilon E→F+E{print(‘+’);}∣FE\rightarrow F+E\left \{ \text{print}(\text{‘}+\text{’}); \right \}\mid F F→(S)∣id{print(id.value);}F\rightarrow (S)\mid id \left \{ \text{print}(id.value); \right \} Here idid is a token that represents an integer and …
Official PYQ2006Compiler DesignLocal OptimizationMCQ · 1 mark
Consider these two functions and two statements S1 and S2 about them. int work1(int *a, int i, int j) { int x = a[i+2]; a[j] = x+1; return a[i+2] - 3; } int work2(int *a, int i, int j) { int t1 = i+2; int t2 = a[t1]; a[j] = t2+1; return t2 - 3; } S1: The transformation form work1 to work2 is valid, i.e., for any program state and input arguments, work2 will …
Official PYQ2006Programming and Data StructuresProgramming in CMCQ · 1 mark
Consider the following code written in a pass-by-reference language like FORTRAN and these statements about the code. subroutine swap(ix,iy) it = ix L1 : ix = iy L2 : iy = it end ia = 3 ib = 8 call swap (ia, ib+5) print *, ia, ib end S1: The compiler will generate code to allocate a temporary nameless cell, initialize it to 13, and pass the address of the …
Official PYQ2006Programming and Data StructuresProgramming in CMCQ · 1 mark
Consider this C code to swap two integers and these five statements: the code void swap (int *px, int *py) { *px = *px - *py; *py = *px + *py; *px = *py - *px; } S1: will generate a compilation error S2: may generate a segmentation fault at runtime depending on the arguments passed S3: correctly implements the swap procedure for all input pointers referring …
Official PYQ2006AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
Given two arrays of numbers a1,...,ana_{1},...,a_{n} and b1,...,bnb_{1},...,b_{n} where each number is 00 or 11, the fastest algorithm to find the largest span (i,j)(i, j) such that ai+ai+1+⋯+aj=bi+bi+1+⋯+bja_{i}+a_{i+1}+\dots+a_{j}=b_{i}+b_{i+1}+\dots+b_{j} or report that there is not such span,
Official PYQ2006AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
Consider the following C-function in which a[n]a[n] and b[m]b[m] are two sorted integer arrays and c[n+m]c[n+m] be another integer array, void xyz(int a[], int b [], int c []){ int i,j,k; i=j=k=0; while ((i<n) && (j<m)) if (a[i] < b[j]) c[k++] = a[i++]; else c[k++] = b[j++]; } Which of the following condition(s) hold(s) after the termination …
Official PYQ2006AlgorithmsSearching, Sorting, HashingMCQ · 1 mark
The median of nn elements can be found in O(n)O(n) time. Which one of the following is correct about the complexity of quick sort, in which median is selected as pivot?
Official PYQ2006AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
Consider the following recurrence: T(n)=2T(n)+1,T(n)=2T\left ( \sqrt{n}\right )+1, T(1)=1T(1)=1 Which one of the following is true?
Official PYQ2006AlgorithmsAsymptotic Worst Case Time and Space ComplexityMCQ · 1 mark
A set XX can be represented by an array x[n]x[n] as follows: x[i]={1if i∈X0otherwisex\left [ i \right ]=\begin {cases} 1 & \text{if } i \in X \\ 0 & \text{otherwise} \end{cases} Consider the following algorithm in which xx, yy, and zz are Boolean arrays of size nn: algorithm zzz(x[], y[], z[]) { int i; for(i=0; i<n; ++i) z[i] = (x[i] ∧ ~y[i]) ∨ (~x[i] …
Official PYQ2006Programming and Data StructuresArrays, Stacks and QueuesMCQ · 1 mark
An implementation of a queue QQ, using two stacks S1S1 and S2S2, is given below: void insert (Q, x) { push (S1, x); } void delete (Q) { if (stack-empty(S2)) then if (stack-empty(S1)) then { print(“Q is empty”); return; } else while (!(stack-empty(S1))){ x=pop(S1); push(S2,x); } x=pop(S2); } Let nn insert and m(≤n)m(\leq n) delete operations be …
Official PYQ2006AlgorithmsGraph Traversals (BFS, DFS)MCQ · 1 mark
Let TT be a depth first search tree in an undirected graph GG. Vertices uu and νν are leaves of this tree TT. The degrees of both uu and νν in GG are at least 22. which one of the following statements is true?
Official PYQ2006AlgorithmsMinimum Spanning TreesMCQ · 1 mark
Consider the following graph: Which one of the following cannot be the sequence of edges added, in that order, to a minimum spanning tree using Kruskal’s algorithm?
Official PYQ2006Computer NetworksTransport Layer: Flow Control, Congestion Control, UDP, TCP, SocketsMCQ · 1 mark
Station AA needs to send a message consisting of 99 packets to Station BB using a sliding window (window size 33) and go-back-nn error control strategy. All packets are ready and immediately available for transmission. If every 55th packet that AA transmits gets lost (but no acks from BB ever get lost), then what is the number of …
Official PYQ2006Computer NetworksTransport Layer: Flow Control, Congestion Control, UDP, TCP, SocketsMCQ · 1 mark
Station AA uses 32  byte32\; \text{byte} packets to transmit messages to Station BB using a sliding window protocol. The round trip delay between A and BB is 80  milliseconds80\; \text{milliseconds} and the bottleneck bandwidth on the path between AA and BB is 128  kbps128\; \text{kbps} . What is the optimal window size that AA should use?
Official PYQ2006Computer NetworksFragmentation and IP Addressing, IPv4, CIDRMCQ · 1 mark
Two computers C1C1 and C2C2 are configured as follows. C1C1 has IP address 203.197.2.53203.197.2.53 and netmask 255.255.128.0255.255.128.0. C2C2 has IP address 203.197.75.201203.197.75.201 and netmask 255.255.192.0255.255.192.0. Which one of the following statements is true?