GATE-CS-2015 (Set 1)

Last Updated :
Discuss
Comments

Question 1

The following two functions P1 and P2 that share a variable B with an initial value of 2 execute concurrently.

P1() 
{
C = B – 1;
B = 2*C;
}

P2()
{
D = 2 * B;
B = D - 1;
}

The number of distinct values that B can possibly take after the execution is

  • 3

  • 2

  • 5

  • 4

Question 2

Consider a LAN with four nodes S1, S2, S3 and S4. Time is divided into fixed-size slots, and a node can begin its transmission only at the beginning of a slot. A collision is said to have occurred if more than one node transmit in the same slot. The probabilities of generation of a frame in a time slot by S1, S2, S3 and S4 are 0.1, 0.2, 0.3 and 0.4, respectively. The probability of sending a frame in the first slot without any collision by any of these four stations is _________.

  • 0.462

  • 0.711

  • 0.5

  • 0.652

Question 3

In the Stop-and-Wait ARQ protocol, the sender must wait for an acknowledgment before:

  • Sending the first frame

  • Establishing a connection

  • Detecting errors

  • Sending the next frame

Question 4

Consider the following C function.
 

C
int fun1 (int n)
{
   int i, j, k, p, q = 0;
   for (i = 1; i < n; ++i)
   {
      p = 0;
      for (j = n; j > 1; j = j/2)
         ++p;
      for (k = 1; k < p; k = k*2)
         ++q;
   }
   return q;
}

Which one of the following is the time complexity for function fun1?
 

  • n3
     

  • n (logn)2
     

  • nlogn 
     

  • nlog(logn)
     

Question 5

Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting n(≥ 2) numbers? In the recurrence equations given in the options below, c is a constant.

  • T(n) = 2T (n/2) + cn

  • T(n) = T(n – 1) + T(0) + cn

  • T(n) = 2T (n – 2) + cn

  • T(n) = T(n/2) + cn

Question 6

Consider a system with byte-addressable memory, 32 bit logical addresses, 4 kilobyte page size and page table entries of 4 bytes each. The size of the page table in the system in megabytes is ___________

  • 2

  • 4

  • 8

  • 16

Question 7

The output of the following C program is __________.

C
void f1 (int a, int b)
{
  int c;
  c=a; a=b; b=c;
}
void f2 (int *a, int *b)
{
  int c;
  c=*a; *a=*b;*b=c;
}
int main()
{
  int a=4, b=5, c=6;
  f1(a, b);
  f2(&b, &c);
  printf (%d, c-a-b);
  return 0;
}
  • -5

  • -4

  • 5

  • 3

Question 8

Suppose the following disk request sequence (track numbers) for a disk with 100 tracks is given: 45, 20, 90, 10, 50, 60, 80, 25, 70. Assume that the initial position of the R/W head is on track 50. The additional distance that will be traversed by the R/W head when the Shortest Seek Time First (SSTF) algorithm is used compared to the SCAN (Elevator) algorithm (assuming that SCAN algorithm moves towards 100 when it starts execution) is _________ tracks

  • 8

  • 9

  • 10

  • 11

Question 9

Consider a disk pack with a seek time of 4 milliseconds and rotational speed of 10000 rotations per minute (RPM). It has 600 sectors per track and each sector can store 512 bytes of data. Consider a file stored in the disk. The file contains 2000 sectors. Assume that every sector access necessitates a seek, and the average rotational latency for accessing each sector is half of the time for one complete rotation. The total time (in milliseconds) needed to read the entire file is _________.

  • 14020

  • 14000

  • 25030

  • 15000

Question 10

Consider the following pseudo code, where x and y are positive integers.

begin
q := 0
r := x
while r >= y do
begin
r := r – y
q := q + 1
end
end

The post condition that needs to be satisfied after the program terminates is

  • {r = qx + y ∧ r < y}

  • {x = qy + r ∧ r < y}

  • {y = qx + r ∧ 0 < r < y}

  • { q + 1 < r–y ∧ y > 0}

Tags:

There are 65 questions to complete.

Take a part in the ongoing discussion