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
A computer system supports -bit virtual addresses as well as -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?
Consider three processes (process id , , respectively) with compute time bursts , and 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:
A CPU generates -bit virtual addresses. The page size is KB. The processor has a translation look-aside buffer (TLB) which can hold a total of page table entries and is -way set associative. The minimum size of the TLB tag is:
The atomic fetch-and-set instruction unconditionally sets the memory location to and fetches the old value of in without allowing any intervening access to the memory location . Consider the following implementation of and functions on a binary semaphore . void P (binary_semaphore *s) { unsigned y; …
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?
Consider the following translation scheme. Here is a token that represents an integer and …
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 …
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 …
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 …
Given two arrays of numbers and where each number is or , the fastest algorithm to find the largest span such that or report that there is not such span,
Consider the following C-function in which and are two sorted integer arrays and 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 …
The median of elements can be found in time. Which one of the following is correct about the complexity of quick sort, in which median is selected as pivot?
Consider the following recurrence: Which one of the following is true?
A set can be represented by an array as follows: Consider the following algorithm in which , , and are Boolean arrays of size : algorithm zzz(x[], y[], z[]) { int i; for(i=0; i<n; ++i) z[i] = (x[i] ∧ ~y[i]) ∨ (~x[i] …
An implementation of a queue , using two stacks and , 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 insert and delete operations be …
Let be a depth first search tree in an undirected graph . Vertices and are leaves of this tree . The degrees of both and in are at least . which one of the following statements is true?
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?
Station needs to send a message consisting of packets to Station using a sliding window (window size ) and go-back- error control strategy. All packets are ready and immediately available for transmission. If every th packet that transmits gets lost (but no acks from ever get lost), then what is the number of …
Station uses packets to transmit messages to Station using a sliding window protocol. The round trip delay between A and is and the bottleneck bandwidth on the path between and is . What is the optimal window size that should use?
Two computers and are configured as follows. has IP address and netmask . has IP address and netmask . Which one of the following statements is true?
